You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an ongoing feedback issue from User Voice.
Reacted by Gert Cuykens, Tobias Cohen, Tiago Brandão, Gearlles Ferreira, Edwin Urquilla, Stanislav Panferov, Mem Maina, Benjamin, Glen, Johan Sim Jian An and 580 more
Reacted by Drew Bartlett, Panda, Amit Joki, Yurii Holskyi, Christian Thalmann, Dolibeth, ibeex, Virgiel, katon, Richard Lalancette and 3 more
Reacted by Guilherme Branco Stracini, Victor Bianchi, Realm, Carl Walsh, Vu Quoc Huy, Alex, NTPLThavarajan, Manu Evans, Virgil Yang, Brains and 30 more
Reacted by Daniel, Haroen Viaene, Nick, Matej Ľach, Rita Zerrizuela, allan cm, Vikrant Negi, Teodor Sandu, Mojtaba, Francisco and 35 more
From User Voice - Maintain indentation level on copy and paste
"When you cut a block of code and paste it somewhere with a different indentation level (i.e. inside nested ifs) it'd be nice to get it properly indented, automatically on paste."
Reacted by Tobias Cohen, Abhishek Amit, Glen, Mem Maina, Tim Mensch, Pierre Rossouw, Florian Reuschel, Rita Zerrizuela, Vaughn Royko, Yoni Medoff and 179 more
From User Voice - Auto indenting line based on language's standard
"In PyCharm, when you type ":" and press Enter then the next line is automatically indented to the appropriate level according to the chosen language's standard."
Reacted by abetkin, Michal Babjak, Maxime Bernard, Anthony Grimes, Chris Lee, William Goodall, Ivan Čurić, Dmitry Viktorov, Łukasz Łukasik, Mauro Doganieri and 47 more
From User Voice - Tab size per language
"One specific thing that I've came across though: I've set my tab size to 2 in my user settings file. That tab size is honored when I format a .ts or .js file. It is NOT honored when I auto format a .cs file - then it seems to go on a 4 space indent. Is this a separate setting?"
Reacted by Micah Zoltu, Marvin Hagemeister, Carl Walsh, Dmitry Viktorov, HY, Paul P, Rommel Meza, Debalin Das, Remco Veldkamp, hjl and 24 more
From User Voice - CSS / Less indenting
"The only thing that's missing for me is the out of the box LESS indent functionality (all other file types I work with work just fine). I had to install a plugin that auto formats CSS but it's not exactly the same. It's also missing some features like preserving spaces/line breaks and so on... something that should be configurable if you're adding this support. "
Reacted by Maria Ines Parnisari, Utain Wongpreaw, Aluan Haddad, Nathan Friend, Guillermo Croppi, Marcos Vinícius Rubido, yaway, Zuberbühler, Christian Oliff, Chemie~ and 4 more
From User Voice - Format issues with C#
"This needs to be added. I want to write my C# code with the K&R style, but every time I try to format it it screws everything up."
Reacted by Dmitry Viktorov, Boris Prpic, tinyant, Dražen Šoronda, Fergal Moran, Nikita, Ash Kumar, Dustin Milotte, Joseph Jojo, Dominic Dambrogia and 2 more
From User Voice - Auto formatting
"It should pick up the type of language based on the choice you made at the bottom right of the screen. If I open a .log file for instance that has xml in it, I would like it to autoformat to the xml setting I changed it too. using the editor.action.format ONLY works based on the file name not what I have told it the contents are. Definitely should appear on the context menu"
Reacted by Carl Walsh, Dvir Hanum, Matthew House, BogdanD, Jian Peng, Brains, Belan, fab1o, Andrea Pavoni, marcevrard and 2 more
Currently there's no auto-indentation for CoffeeScript (e.g. function, condition, and loop bodies), and in some situations tab key produces 4 spaces in a 2 space file (default indentation settings).
Reacted by Philip Kahn, Tim Shannon, Shriram Balaji, asim kaleem khan, katon and Abhishek Dubey
Reacted by Jacopo Galati, Weverton J. da Silva, Mohamed Sobhy, Oscar Gardiazabal, Alan Naidon, Eamon, Marek Maciejewski, Cristtopher Quintana Toledo and Abhishek Dubey
Powershell (I suspect this may be the same for other languages):
Heredoc text is not folded as the end tag must have no white space before it. Often heredoc text has no leading whitespace on any line.
Here is the code I used for testing:
function FunctionName {
$a = @"
This is some sample text to
demonstrate a code folding issue
withing VS Code.
"@
}
Sublime Text 3 has the feature to paste text with automatic indentation (Ctrl+Shift+V), which basically adds or removes levels and adjusts the first line to match the current block indentation.
UPD:
This behavior can be default for Ctrl+V (like in IntelliJ IDEA, afaik), and have Ctrl+Shift+V for HTML previews as it is right now.
UPD 2:
There is an extension that adds an extension.pasteAndFormat command, which can be used in keybindings.json (combination of editor.action.clipboardPasteAction and editor.action.format).
I thought why not allowing users to define keybindings with multiple commands using the array syntax, like this?
This would solve the problem and add a possibility to create mini-macros, sort of! 😃
Reacted by Wade Anderson, Aleksej Komarov, Felix Itzenplitz, Dauren Akilbekov, Ross van Zyl, Panajev, Florian Reuschel, Yisi, Taylor Brown, Carl Walsh and 35 more
Ooo, pasting with correct indentation should be the default.
Reacted by Mem Maina, Florian Reuschel, Leo Lozes, Nikolay Seliverstov, Isaac de Andrade, Shiran Ginige, Makeev Vitaliy, Decade, Bipin Nag, hiroyamasuka and 54 more
Sight...
Lower right corner, if that kind of file doesn't have a parser associated you'll see something like "Plain Text", if it does it will state the mode like "Html" or "JavaScript" or "TypeScript"...
Also anything you can do through interface can be done through the command palette, press Ctrl + Shift + P and type "Language", one of them should say "Change Language Mode".
Then is up to you which one you want to select, you said you want Html right? just type html and select one of the options.
My point is you shouldn't have to worry about finding a plugin for something basic like this. Atom does this out of the box without any plugins, and automatically can do it for any language that has a syntax highlighting plugin. Prettier/eslint/rubocop/whatever might not respect my user-configured tab/spaces preference (2 spaces always in my case) so you're taking something that should be a basic editor feature and leaving it up to the third party ecosystem which is going to do a terrible, inconsistent job with it because there are no editor-level conventions that let a language specify how the editor should do auto-indenting for that language.
Right now my workflow is literally use vscode for most things, copy paste to and from atom whenever I need to mess with indents, because the vscode tools for that are that bad.
I have default settings with 2 spaces for indent. I want the the cursor to figure out where it should be when I hit enter, as I am typing it, like every other IDE (Intellij, Xcode, Android Studio, Eclipse, etc)
Stuff like this works fine.
if (x) {
good();
}
Problems arise when I hit ENTER at the end of a statement on a multiline that ends in a diff column than it started, or hitting ENTER mid statement to break a longer line. For example:
I would like this to happen as I type and press ENTER (4 spaces, double my default indent)
I have spent hours with vscode settings and extensions but cannot get this simple behavior. The "formatOnType" option is close, but doesn't seem to work for ENTER key, and there are still no options for line-continuation, chained methods, etc.
Ideally:
A. The cursor always knows where it should be after hitting enter.
B. EditorConfig-like continuation_indent_size so that the above can be fine-tuned.
This is what the config looks like in Intellij:
Reacted by sam0x17, Alex E, zenoven, Yurii Holskyi, Alexander Kolnogorov, Virgil, Etienne and Mikhail Elfimov
Reacted by sam0x17, Yurii Holskyi, Stephen Gardner, Alexander Kolnogorov and Etienne
+1000 to what clocksmith said.
That's EXACTLY what I came here hoping to find.
It's actually not possible?
Someone save us. I want to search for a plugin but seems like there have been many fruitless efforts and I've spent long enough configuring this to match the ease of use that WebStorm offered.
agree, what clocksmith said, with the addition that "auto format" should be an editor-level option that works for any language plugin like it does in Atom.
Another thing I would like to point at is, when I am in a .php file, say it contains HTML. I can format the HTML by choosing the Language Mode to HTML. But it is better to have an option to directly format the php file without choosing to change the Language Mode option to HTML. It should be able to format the HTML in the php file.
Could you please add to Visual Studio Code some way to configure "Format Document" option.
It would really help us with work. When we work in teams where everyone uses different editor, VSC cannot be configured as the team decided the code should look like. So I am forced not to use VSC because this is not configurable. This is deal breaker for me. Using VSC makes my Git commits have so many differences that this makes other team crazy.
Hello,
I was checking copy pasting of Python code in a markdown editor such as stackedit.io, the code looses its indentation. Whereas if I copy the same code from Sublime, the indentation is preserved on such markdown editor.
Closing this aggregate issue as it is out of date and it is unclear what it is tracking
If you are running into an issue with formatting or indentation, or would like to suggest a feature related to formatting or indentation, please open a new issue
Activity
waderyan commentedon Mar 11, 2016
From User Voice - Maintain indentation level on copy and paste
"When you cut a block of code and paste it somewhere with a different indentation level (i.e. inside nested ifs) it'd be nice to get it properly indented, automatically on paste."
waderyan commentedon Mar 11, 2016
From User Voice - Auto indenting line based on language's standard
"In PyCharm, when you type ":" and press Enter then the next line is automatically indented to the appropriate level according to the chosen language's standard."
waderyan commentedon Mar 11, 2016
From User Voice - Tab size per language
"One specific thing that I've came across though: I've set my tab size to 2 in my user settings file. That tab size is honored when I format a .ts or .js file. It is NOT honored when I auto format a .cs file - then it seems to go on a 4 space indent. Is this a separate setting?"
waderyan commentedon Mar 11, 2016
From User Voice - CSS / Less indenting
"The only thing that's missing for me is the out of the box LESS indent functionality (all other file types I work with work just fine). I had to install a plugin that auto formats CSS but it's not exactly the same. It's also missing some features like preserving spaces/line breaks and so on... something that should be configurable if you're adding this support. "
waderyan commentedon Mar 11, 2016
From User Voice - Format issues with C#
"This needs to be added. I want to write my C# code with the K&R style, but every time I try to format it it screws everything up."
waderyan commentedon Mar 11, 2016
From User Voice - HTML / CSHTML editing capabilities
"Just look at VS2015's capabilities during editing of an HTML or CSHTML file - replicate that."
waderyan commentedon Mar 11, 2016
From User Voice - Auto formatting
"It should pick up the type of language based on the choice you made at the bottom right of the screen. If I open a .log file for instance that has xml in it, I would like it to autoformat to the xml setting I changed it too. using the editor.action.format ONLY works based on the file name not what I have told it the contents are. Definitely should appear on the context menu"
jreadytalk commentedon Mar 11, 2016
Currently there's no auto-indentation for CoffeeScript (e.g. function, condition, and loop bodies), and in some situations tab key produces 4 spaces in a 2 space file (default indentation settings).
geomorillo commentedon Mar 11, 2016
Autoformat like netbeans does...
waderyan commentedon Mar 11, 2016
Jhobanny Morillo (@geomorillo) can you be more specific? What exactly does Netbeans do that is missing?
mrboring commentedon Mar 12, 2016
Powershell (I suspect this may be the same for other languages):
Heredoc text is not folded as the end tag must have no white space before it. Often heredoc text has no leading whitespace on any line.
Here is the code I used for testing:
stylemistake commentedon Mar 14, 2016
Sublime Text 3 has the feature to paste text with automatic indentation (
Ctrl+Shift+V), which basically adds or removes levels and adjusts the first line to match the current block indentation.UPD:
This behavior can be default for
Ctrl+V(like in IntelliJ IDEA, afaik), and haveCtrl+Shift+Vfor HTML previews as it is right now.UPD 2:
There is an extension that adds an
extension.pasteAndFormatcommand, which can be used inkeybindings.json(combination ofeditor.action.clipboardPasteActionandeditor.action.format).I thought why not allowing users to define keybindings with multiple commands using the array syntax, like this?
This would solve the problem and add a possibility to create mini-macros, sort of! 😃
JVimes commentedon Mar 14, 2016
Ooo, pasting with correct indentation should be the default.
cs04riva commentedon Mar 15, 2016
Formatting CSS doesn't seem to properly work anymore.
You use to be able to paste in a block of css in one line, hit the shift + alt +f and it would correctly format the code. This no longer works.
For example:
body{background-color:#FFF;}#test{position:absolute;}Would turn into:
127 remaining items
luchillo17 commentedon Jun 11, 2018
Sight...
Lower right corner, if that kind of file doesn't have a parser associated you'll see something like "Plain Text", if it does it will state the mode like "Html" or "JavaScript" or "TypeScript"...
Also anything you can do through interface can be done through the command palette, press
Ctrl + Shift + Pand type "Language", one of them should say "Change Language Mode".Then is up to you which one you want to select, you said you want
Htmlright? just typehtmland select one of the options.bexoss commentedon Jul 30, 2018
auto formatting jsx file is going crazy, How can I avoid this?

sam0x17 commentedon Jul 30, 2018
My point is you shouldn't have to worry about finding a plugin for something basic like this. Atom does this out of the box without any plugins, and automatically can do it for any language that has a syntax highlighting plugin. Prettier/eslint/rubocop/whatever might not respect my user-configured tab/spaces preference (2 spaces always in my case) so you're taking something that should be a basic editor feature and leaving it up to the third party ecosystem which is going to do a terrible, inconsistent job with it because there are no editor-level conventions that let a language specify how the editor should do auto-indenting for that language.
Right now my workflow is literally use vscode for most things, copy paste to and from atom whenever I need to mess with indents, because the vscode tools for that are that bad.
clocksmith commentedon Aug 19, 2018
I have default settings with 2 spaces for indent. I want the the cursor to figure out where it should be when I hit enter, as I am typing it, like every other IDE (Intellij, Xcode, Android Studio, Eclipse, etc)
Stuff like this works fine.
Problems arise when I hit ENTER at the end of a statement on a multiline that ends in a diff column than it started, or hitting ENTER mid statement to break a longer line. For example:
I would like this to happen as I type and press ENTER (4 spaces, double my default indent)
I would even settle for this (2 spaces, same as my default indent)
But this is what I get before running the format command.
I have spent hours with vscode settings and extensions but cannot get this simple behavior. The "formatOnType" option is close, but doesn't seem to work for ENTER key, and there are still no options for line-continuation, chained methods, etc.
Ideally:
A. The cursor always knows where it should be after hitting enter.
B. EditorConfig-like continuation_indent_size so that the above can be fine-tuned.
This is what the config looks like in Intellij:
zenoven commentedon Oct 4, 2018
exactly the same issue with clocksmith
spent too much time searching for a solution but none succeed
stephengardner commentedon Oct 19, 2018
+1000 to what clocksmith said.
That's EXACTLY what I came here hoping to find.
It's actually not possible?
Someone save us. I want to search for a plugin but seems like there have been many fruitless efforts and I've spent long enough configuring this to match the ease of use that WebStorm offered.
sam0x17 commentedon Oct 19, 2018
agree, what clocksmith said, with the addition that "auto format" should be an editor-level option that works for any language plugin like it does in Atom.
drdebmath commentedon Oct 30, 2018
Another thing I would like to point at is, when I am in a .php file, say it contains HTML. I can format the HTML by choosing the Language Mode to HTML. But it is better to have an option to directly format the php file without choosing to change the Language Mode option to HTML. It should be able to format the HTML in the php file.
createdbyjurand commentedon Nov 9, 2018
Could you please add to Visual Studio Code some way to configure "Format Document" option.
It would really help us with work. When we work in teams where everyone uses different editor, VSC cannot be configured as the team decided the code should look like. So I am forced not to use VSC because this is not configurable. This is deal breaker for me. Using VSC makes my Git commits have so many differences that this makes other team crazy.
sam0x17 commentedon Nov 9, 2018
I second what Jurand (@createdbyjurand) says, this is a desperately needed feature. Eclipse has this, and Atom to a lesser extent.
sanjayabc1234 commentedon Jan 16, 2019
Hello,
I was checking copy pasting of Python code in a markdown editor such as stackedit.io, the code looses its indentation. Whereas if I copy the same code from Sublime, the indentation is preserved on such markdown editor.
Any idea how to resolve this issue?
Thanks,
mjbvz commentedon May 1, 2019
Closing this aggregate issue as it is out of date and it is unclear what it is tracking
If you are running into an issue with formatting or indentation, or would like to suggest a feature related to formatting or indentation, please open a new issue