Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

0 votes
0 answers
43 views

VS Code : force horizontal alignment of parentheses, braces and square brackets

Is there any way to auto format code (in VS Code) in a way that forces horizontal alignment of parentheses, braces and square brackets? For example: let foo = { a: 'a', b: 'b', c: 'c' }; ...
Marc F's user avatar
  • 73
2 votes
2 answers
451 views

How to automating Code Formatting in VSCode for Jupyter Notebooks with Black Formatter?

I've been enjoying the convenience of the Black Formatter extension in Visual Studio Code, especially its "Format on Save" feature for Python files. Being able to automatically format my ...
Ellie Su's user avatar
0 votes
1 answer
87 views

Why does if break into multiple lines?

Why does this if: if (value == null || value.trim().isEmpty || !value.contains('@')) breaks into multiple lines upon save?: if (value == null || value.trim().isEmpty || !value.contains('@')) { ...
niko craft's user avatar
  • 2,967
1 vote
1 answer
511 views

Visual Studio Code - Microsoft Black Formatter from command line?

I have the Microsoft Black Formatter extension in VSCode (in WSL, inside Windows 11). I can format opened python files with no problem, one-by-one, either using keyboard shortcut or right click on the ...
Andras Vanyolos's user avatar
0 votes
0 answers
42 views

How to re-format HTML (in vscode) to remove unnecessary line breaks after every tag

I know that most code formatters have config to prevent breaking on <b>, <i> etc tags, but I cannot figure out what to do if the disaster already happened and I want to go back from 1000 ...
alparius's user avatar
1 vote
2 answers
83 views

How to work with poorly formatted Code in VSCode without committing format changes?

I am currently working on a project in Visual Studio Code that has poorly formatted code. Due to project constraints, I am not allowed to reformat the existing code and commit those changes. This ...
Mikhail Yevchenko's user avatar
-1 votes
2 answers
178 views

VS Code code formatting for TypeScript and JavaScript [duplicate]

I'm looking for extensions or JSON settings to format my code given below: if(true) { } else { } and not like below: if(true){ } else { }
Mohammed Sufian's user avatar
0 votes
0 answers
154 views

How can I make VS Code format C/C++ function return types on their own line?

I'm on macOS. GNU C++ in Visual Studio Code automatically format like int main () { ... } Instead I want to do : int main() { ... } Follows my current settings: "[cpp]": { "...
Juan J's user avatar
  • 37
0 votes
0 answers
117 views

How to make VSCode break long lines of JavaScript down without resorting to Prettier or Standard?

I'm trying to transition from JetBrains IDEs to Visual Studio Code, but I'm running into an issue with formatting JavaScript. When an assignment statement is over the line length limit, the VSCode ...
John Y's user avatar
  • 1,250
5 votes
0 answers
1k views

How to configure Prettier to format Cypress code with chained calls?

I'm using Prettier to format my Cypress code, but it's breaking lines in a way that I don't like. Specifically, it's formatting lines like this: cy.contains("div[role='alert']", "Status ...
JVMatos's user avatar
  • 69
0 votes
1 answer
241 views

keyword "public" not indented correctly using vscode in c/c++

i'm using the default visual studio formatter for c/c++, yet it seems to be formatting the word "public" different, its adding 2 white spaces (refer to image) which as far as i know isn't ...
borygamer's user avatar
4 votes
2 answers
2k views

How to prevent VSCode from reordering python imports across statements?

This is the correct way to import Gtk3 into python: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, GObject When I save such code in VSCode with "editor....
lvella's user avatar
  • 13.2k
0 votes
0 answers
109 views

How to format Code in Visual Studio Code?

Is it possible to format all of the code in Visual Studio Code to my specific prefrences. I want the formatter to leave a space before any brackets and go onto a new line before and after any curly ...
user avatar
0 votes
0 answers
72 views

Customize VSCode new lines on save format

I'm using vscode format on save feature and it was working great. but now it is forcing to insert a line break when using Square Brackets for arrays [ ] on objects. Like: If I try to write this: { &...
PlayHardGoPro's user avatar
1 vote
1 answer
462 views

Why does formatting code in VS Code always return uglier code than I expected?

I'm formatting code in VS Code. However, VS Code always returns uglier code than I expected. Example: My original code: body: Padding( ...
My Car's user avatar
  • 4,503

15 30 50 per page
1
2 3 4 5
8