My Resharper CSS configuration seems to have changed for my Visual Studio 2015 project (Resharper Ultimate 2016.2.2), so that any time I type a line in a CSS file and hit the semi-colon, it inserts a blank line above. Additionally when I open a new pair of curly braces, it places a blank line above and below the new cursor position, in the following fashion:
.radio-list {
*cursor*
}
The behaviour change only started recently and a fellow developer is also experiencing the same issue. Any ideas on which Resharper option can be changed to reverse this behaviour?
I managed to pin the issue down to a bug in the way Resharper is processing the comments in the css file. I had a headline comment at the top of the file:
/* Comment */
/* Comment */
body.wait *, body.wait {
cursor: wait !important;
}
Removing that blank line between the first two comments made the issue go away. Putting something else like a space or another comment also fixes it.
Related
This is driving me nuts. I just want to write a series of // single line comments aligned on the same column but when I hit the enter key Android studio auto-indents and I get the following:
//Todo do need to determine next fragment to navigate to
//
Instead of:
//Todo do need to determine next fragment to navigate to
//
It also injects a tab instead of spaces so that the backspace key brings me back to the end of the previous line.
I can't find anything in settings.
Thanks
Seems the options are in:
File -> Settings -> CodeStyle -> C/C++ ->
Uncheck these options:
[ ] Use Tab Character
[ ] Keep Indents on Empty Lines
Then [Apply] then [OK]
In my case, I even have to Exit/Re-enter Android Studio, in order for the changes to take effect (I believe it's a bug).
And also, placing Settings, under File menu, is NOT quite trivial for me (at least in my other IDE apps).
I've been having a problem in Visual Studio 2019 where the program enters tabs as four spaces. This is annoying, since I have to hit backspace 4 times to erase an indent, and I need to use arrow keys 4 times to navigate an indent.
This used to work fine, but I had to uninstall and re-install Visual Studio to fix another problem (it kept running old versions of my code and wouldn't run the new version), and ever since then, I haven't been able to get it to work.
I went to settings, and selected 'keep tabs', but it still replaces it with four spaces every time i hit the Tab button. Interestingly, when I start a new line, I can navigate and backspace normally, but if I enter any more tabs, they are replaced with 4 spaces.
I've tried looking around, but I can't seem to find anything that addresses my issue. Can anyone help?
How to fix problem in Visual Studio with "Keep tabs" not working.
I also had this problem with tabs being converted to spaces.
I checked Tools>Options>Text Editor> (All languasges as well as c/c++) >Tabs> and assured that "Keep tabs" was selected.
After some trouble shooting I found that only one file had this problem (file1.h).
I created a new empty file (file2.h) that worked correctly.
I took the statements from file1.h and divided them into small block. Then I moved the blocks to file2 and after each block I tested file2.
After a few block suddenly file2.h failed. When I removed the last block from file2 the problem was solved.
My conclusion is, that the source code contained some invivisible code, that made the text editor turn off the "Keep tabs" setting.
I have seen comments about a setting "Use adaptive formatting" that might be relevant. So far I have turned this setting off.
My setup is Visual Studio Community 2019 v 16.4.4 with an Arduino plug in from Visual Micro v 1912 28 2.
/Steen
Disable the checkbox: Tools->Options->Text Editor->Advanced->Use Adaptive Formatting
You will still need to delete the spaces it inserted for you, but will retain tabs afterwards.
Also note that Visual Studio 2019 now uses and prioritizes .editorconfig files over the Tools -> Options -> Text Editor settings.
If you have tried the above answers and still cannot get your indent and tab settings to work, then look for an .editorconfig file anywhere in your project's directory structure.
For instance in my project Angular CLI created one for me when I initialize a new ng project in my .net Web API directory structure. All my *.ts files were not cooperating.
I had to edit the .editorconfig file to look like this in order to get 4 space indent and tab instead of spaces. Once I did that, Ctrl + K + D (reformat) started working again:
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false
Recently updated to Android Studio 3.5 and now my code is full of annoying yellow lines with warning that I would like to suppress.
However, when trying clicking on the yellow bulb and use the solution proposed, it does not work, it just adds a comment-like line that has no effect, example:
When getting this warning:
"Use => for short members whose body is a single return statement"
Yellow bulb just adds a line above like this:
// ignore: prefer_expression_function_bodies
Any permanent solution to these annoying warnings in Android Studio?
The Dart analyzer does this and the ignore comment should suppress the warnings. By the way, this should not have anything to do with your Android Studio version.
There are two main ways to suppress specific lints "globally":
Use ignore_for_file comments. This is analogous to ignore, but works for the whole file.
Simply add the following somewhere:
// ingore_for_file: prefer_expression_function_bodies
Specify exclusions in your analysis_options.yaml file. You can always view documentation for all the lints, e.g. for prefer_expression_function_bodies, and any lint can be excluded in your analysis_options.yaml file (it should be placed in the same directory as your pubspec.yaml):
linter:
rules:
prefer_expression_function_bodies: false
Learn more.
When I hit the shortcut command in Android Studio that comments out a line of code the two slashes go to the begging of the line, leaving empty space in front of the line. Is it possible to align the the two slashes just before the beginning of the code?
//I want to achieve this
// this happens by default
Go to Settings > Editor > Code Style > Java. Then select the Code Generation tab and uncheck the Line comment at first column checkbox.
File-> settings->Editor->java-> Code generation->
under comment code section uncheck the Line comment at first column
I love using the Auto Formatting tool in Visual Studio CTRL K + CTRL D However, there are times when VS makes the formatting just a tad off from what I want if, for instance, I'm making a detailed kind of pseudo-code that relies on specific comments and indentation. Is there a way I can still use the CTRL K + CTRL D command and set visual studio to ignore a certain block of code or set of line numbers? Also, if there's an answer in VS 2013 but not in 2012, please post because I may be upgrading soon. Thanks in advance.
I got hit by this problem today with my pseudo-code comments too and thought I'd share the way I solved it.
While there is no way to prevent Visual Studio from auto-formatting parts of code, there is a way to prevent it from auto-formatting pseudo-code comments.
Instead of using something this like this
// if condition
// do this
// else
// do something else
use the tripple-slashes /// instead
/// if condition
/// do this
/// else
/// do something else
As a bonus you get automatic insertion of /// in new lines and auto-indenting that keeps previous row's indentation level.
This seems not to depend on editor indentation options.
It also seems not to mess up XML documentation
(Yes, I know this is an old question. No, I do not want to take Cameron's right for accepted answer.)