I use JSDoc syntax to document a lot of parts throughout all my apps.
I often need to make some minimal documentation for SASS variables as well.
However, while any JS/TS/Vue file works really well with JSDoc style comment blocks in VSCode, Sass files seem to try and work against me when trying to type a JSDoc comment...
I know it's possible by just adding some sort of snippet that expands into a JSDoc comment block, but the problem is when pressing ENTER, in JS/TS/Vue files it automatically adds the proper indentation and * in front of the new line inside the comments.
In Sass files, not only is the indentation is consistently wrong when pressing ENTER in a comment block and it's not helping me at all by adding * or the closing */ tag...
I have looked all over the extensions of VSCode as well, but couldn't find anything that helped.
Does anyone know how I can solve this issue?
Related
Is there a way to do so? I find a lot of my time is taken up correcting indentation formatting in VSCode after pasting, because it seems to sometimes take the source indenting and apply it at the destination (so the entire pasted code block is at the wrong indent level) or worse, just mess up indents entirely (no idea what's going on here) and I need to manually fix every line.
Example use case, for single PHP files which contain PHP, HTML, and Javascript, I often only want the pasted Javascript block to format nicely. Turning on "paste on format" will format the entire document, often times making the PHP sections awkwardly arranged.
I know that VSCode has "format on paste" in settings, but this formats the entire document. How can I format only the pasted code? Is this even possible?
Thank you
I am not certain whether you're fine with this roundabout solution, but you can format selection with Ctrl+K Ctrl+F (see official vscode site for more detail). So rather than turning on format on paste you can paste and then reselect it and do the shortcut above.
If you're not satisfied with this method, you can try using a vscode extension that was given here under a somewhat similar copy and paste problem
In VSCode there is a setting for having snippets first in the list of suggestions ("editor.snippetSuggestions": "top",). This is great, as you might want a snippet to take precedence over other intellisense items when it matches what you've written.
However, the snippets will also be ordered at the top when you display suggestions without writing anything. I often show suggestions inside classes to see what properties/methods I have available, but in those cases I have to scroll through my entire list of snippets before the properties/methods show up. Is there any way to turn off snippet suggestions when you have not written anything?
Example image of the suggestions showing above halfway down in the suggestion list:
This is not an option as of yet, and a feature request for this funtionality has been added. https://github.com/microsoft/vscode/issues/147357
In the meantime, a workaround is to hide snippets from completions and use the explicit > Insert Snippet command instead. (Copied from the issue response)
I'm using Netbeans 11, and I have now switch from Ruby sass to Dart sass.
The thing is that when I comment a block of code on my .scss files, they are commented like that:
#mixin test($var){
/*color:red;
font-size: #{var}*10;*/
color:blue;
}
The thing is that now in Dart sass, what's in between the /**/ is compiled and raises sometimes errors. Though I just want to comment it. So I would need to comment this way:
#mixin test($var){
//color:red;
//font-size: #{var}*10;
color:blue;
}
This is fine for 2 lines, but sometimes I need to comment big blocks, and Netbeans is not using the // but /**/. So is there a way to change the default commenting of Netbeans for .scss files? I mean this has to be somewhere since you can sometimes comment in blocks with #.
Any help would be greatly appreciated. Thanks a lot in advance!
Unfortunately, you can't do it. NetBeans matches file extensions with corresponding FileTypes (MIME). For each FileType, there is parsing implementation for it and it handles commenting and uncommenting. It does it differently for each mime type and usually, it is deep in the code of NetBeans.
If you are interested, the code for commenting css/scss files is here and here.
I suppose alternatively you could use a cool feature called multiline editing. It allows editing multiple lines simultaneously. See here for example.
So just
Move the cursor to the right
Press ctrl+shift+R
Press the mouse and move the cursor up, as if you are selecting the region.
Press //
Press ctrl+shift+R
For commenting it looks like this:
quiet some time, I used Notepad++ for coding my vbs-scripts. Now I'm switching to vscode, for improved syntax highlighting and IntelliSense- features.
Some time ago, I added some "header-file" I want to include to each of my scripts, because I use the same variables in each project and am too lazy to re-type the same text over again. Is there a way to make vscode IntelliSense to recognize the variables I defined in my header-file? If so, how? I would prefer not having build my own snippets, for I still expand my "header-file".
Thank you for your help,
kind regards,
Georg
The standard method is to modify the c_cpp_properties.json, VS code can do that for you if you prefer, just when you encounter the error (squiggily line under the #include <generic_header.>) as such: include error
Mouse over the error and a pop up will show as such: error popup
(Ignore the spanish bit)
Then just use the quick fix hotkey (Ctrl + .) and vscode will do it for you.
I use VSCode and I think its a great editor, but when I write a comment in html it drops to a new line under what I'm commenting which is really irritating.
If I comment a closing div I want it next to the closing div not under it.
I have uninstalled prettier but that made no difference.
Is what I want even possible in VSCode?
Any advise would be appreciated because I am so irritated that I am considering using a different editor (I'm on a Mac just in case it matters).
Thanks in advance.
This was a problem for me too, as were other new line / white space related HTML issues.
Assuming you are not using any formatters besides the native VSCode HTML language features (you said you uninstalled prettier, but you didn't mention whether you were using something else),
there is a setting HTML white space which you can set to preserve to leave your comments untouched.
Note that you may need to go into settings and check what is being used as the HTML default formatter