VS Code editor.autoIndent - settings

I can't figure out what VS Code's editor.autoIndent setting does. I've tried copy+pasting unindented code with the settings turned on and off and the code is just pasted as it was copied - unindented.
Can someone please explain to me what this setting does and a clear use case?
Thanks!

I wasn't paying attention to the Extensions with indentation rules of the language must be available part of the editor.autoIndent description. I installed the Prettier extension, added it's identifier to "editor.defaultFormatter": "esbenp.prettier-vscode" and editor.autoIndent now works perfectly.
I've also created a video explaining it, which might help.

Many modules in vscode may provide some code formatting, depending on the language to format ...
And there is EditorConfig (https://EditorConfig.org) that should simplify this task, quickly, and once for all environments, as long it is largely supported by other IDE.
Any way, in order to format your code, you'll have to ask for this action, usinf either the F1 key + "format this document", or Ctrl+Maj+I

Related

How to determine where an intellisense-like suggestion comes from? (and suppress it)

When writing Ruby code, the following suggestion comes up each time the cursor hits an end statement (intellisense-like):
It is very annoying (breaks the flow, since it must be escaped) and useless. I don't know where or what extension it comes from.
How do I determine what piece of plugin injects this suggestion?
And then, how do I shut it off?
In your settings.json file - you have the ability to control which plugin is making recommendations - mine has the following:
"editor.quickSuggestions": null // use rubocop for formatting
"ruby.intellisense": "rubyLocate",
Purely disabling the intellisense functionality would be controlled by these settings.
https://code.visualstudio.com/docs/editor/intellisense
I don't believe that you can purely turn off the 'end' only intellisense - it appears to be an all-or-none proposition.

Why does VS 2019 make hash comments use a large font in YAML files?

This is more of an annoyance, but does anyone know why VS 2019 switches the font for hash comments in YAML files? I'd imagine it happens for any file using hash comments. My guess is that it has something to do with markdown, but I don't have any extensions for markdown, unless one of my installed extensions has it as an extra feature.
Here's an example:
Here's my installed extensions:
[
In writing this, I looked in coderush's settings and found the answer. Unchecking this option stops the annoying (in my case -- it's probably useful to a lot of other people) behavior.
Since the question was already written by the time I figured it out, I'm posting this answer in case it helps someone else.

RStudio interface / behavior changes in 1.0.136

Various things are different in 1.0.136, e.g. running code with ctrl-enter has all sorts of strange behavior in an RMarkdown document, running code that has a syntax error somehow leads to all of the code being run in a block above (below?) the wrong code, etc. Sorry for not posting an MWE, but at the moment I just want to know if anyone is aware of these new "features" and if so how they can be turned off or better yet how I can just downgrade to the previous version of RStudio (which I can't currently find on the website).
Yes they changed some default settings that were present in the old interface.
Change the setting in markdown next to the knit button, from:
Chunk Output Inline -> Chunk Output in Console
Pictured here.
You can probably mess with the the Global Setting->Rmarkdowns under Tools to get it back the way it was before, but this was the fastest way for me.

Customize VisualStudio syntax highlighting even more

I am wondering if it is possible to set VisualStudio IDE so it highlights private/protected/public variables of the class differently as well as change formatting on locals (i.e. variables that are either passed in or declared inside a function, like this).
I did not find any such options in the normal Fonts and Colors menu of VS. Also a search on SO reveals that (at least as of 2 years ago) only add-ons provide such features. But is there a way to manually edit some file? Just because we don't get a nice UI to edit, doesn't mean underlying framework automatically doesn't support it. I mean add-ons have to plug into something to do their magic in the editor. Any insights into this issue?
Thanks!
EDIT: I have found the following information on MSDN Syntax Highlighting (Managed Package Framework). But the explanation/examples given are woefully inadequate. Does anyone know of a more extensive docs/tutorials/etc. for MPF?
I could be wrong (probably am) but I think plugins that do what you want replace the default highlighter in Visual Studio, so I don't think there is a file you can edit. As far as I know, you need a plugin. ReSharper might do this...I'm not sure though (I don't use it)

What are the most important IDE features missing in Vim?

I have been programming almost exclusively in Vim since 1/1/2001, and I feel that Vim fulfulls all my needs as an editor/IDE, but I can't help but wonder if perhaps there have been some new killer features developed for other IDEs in the last decade that would allow me to be more productive than I can be using Vim. So I ask: What are the most important IDE features missing in Vim??
Integrated debugging with all the fanciness that Visual Studio/Eclipse provide (thread debugging, etc etc)
Autocomplete with inline documentation support for methods/properties
Build and run from 'within' the editor application
I miss the excellent refactoring support and code tips from tools such as Resharper. Regexs are powerful for code modification, but understanding the code as Resharper does is just a tad better IMO.
Fortunately I can get both Resharper and Vim in Visual Studio so I am happy.
The real question is: what do VIM have that IDEs are missing.
I find that refactoring would be a real nice thing to have. Changing a java package name in vim with lots of source files can be pretty cumbersome.
Originally the refactoring was the killer feature that made us switch from Emacs. I have now used Eclipse extensively for Java for the last 6 years, and I expect any replacement to have:
Refactoring: Rename variables, functions, change method signatures (including all calls to it).
Debugging: "You are here" "Your current variables are" plus stuff like "go to the defined class for this object" or "go to the actual type for this object". I belive the latter requires quite a bit of integration between debugger and editor.
Code replacement while debugging. Change code, press Ctrl-S and the code in your debugging session is updated with what you just changed. A killer feature for big programs.
Navigation: Simple navigation of class hierarchy (please show me all implementations of this method in this interface and similar).
Javadoc integration - Eclipse can show javadoc just by hovering the mouse over an identifier.
Plus some more :)
Edit: I occasionally miss the Emacs functionality inside Eclipse, but the Eclipse editor has become stronger so it is not so bad anymore. In this regard the Save Action allowing a Format at every save was a killer. This ensures that changes show up properly in the source repository.
Search in files: In most editors, there is a separate window doing the search in files, and simultaneously editing can continue on the main window. The search results are updated as and when they are found. Also the current results can be viewed by clicking on it, even when the searching is ongoing, without waiting for the entire search to be completed.(whereas in cim one has to wait till vimgrep/ctags has finished to view the results)
This is particularly useful for search in large number of files.
So basically something like a search in background and simultaneously show results which can be clicked on to view them simultaneously.
(something like Microsoft Visual Studio 6.0 does)
The things I missed were code completion and debugging. That's why I started using eclim http://eclim.sourceforge.net/index.html so I could use vim for what it does best and eclipse when I actually need it. Try it out - it's a fantastic combination.
It's like the old question "What's worn under a kilt?"
Answer: "Nothing. Everything's in perfect working order!".
But seriously, I'd like to see a more intuitive (easy to use) help system added to Vim.
There is nothing missing in Vim that an IDE has. The only thing we could argue about is; Vim needs to be customized and IDE comes out of the box.
Let me comment the other answeres and how to solve such "needs".
build
As mentioned, use :make and learn how to customize it.
refactoring
Use the very well known ropevim (for Python), it makes a great reafactoring tool. You won't need more than that. There are many others, search for your language.
Autocompletion
I use this snippet together with mapping to TAB (I think supertab plugin does that)
" python stuff
python << EOF
import os
import sys
import vim
for p in sys.path:
if os.path.isdir(p):
vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
EOF
" tags for python libs
set tags+=~/.vim/tags/python.ctags
autocmd FileType python,mako set omnifunc=pythoncomplete#Complete
autocmd FileType html,mako set omnifunc=htmlcomplete#Complete
autocmd FileType html,mako set omnifunc=htmlcomplete#CompleteTags
autocmd FileType mako set filetype=mako.html.js
Help system
in Vim is perfect, you just have to learn it's system. It has it's own conventions how are things organized.
Debugging
I don't know for other languages than Python, but running pdb and !python % does it's job.

Resources