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

Questions tagged [code-formatting]

Code formatting is the way to format the source code of programs, such as using spaces and tabs, improving legibility.

0 votes
2 answers
115 views

Common Lisp formatting/indentation

(defun heapify-down (heap-id index) (if (is-leaf heap-id index) nil (let ((left (left-child index)) (right (right-child index)) ...
Matias Bonoli's user avatar
-1 votes
1 answer
88 views

How do I configure prettier to not separate my attributes onto new lines and not separate my opening bracket and closing bracket?

Before I state any of my problems this is my .prettierrc file so far { "semi": true, "useTabs": true, "tabWidth": 4 } Problem 1: I would like my prettier to ...
MrGod1y'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
80 views

Managing JupyterLab extensions with different Conda environments

I've been trying to install a code formatter into Jupyter lab. I'm unsure how to manage such extensions with multiple conda environments. I have JupyterLab installed on my base conda environment and ...
oweydd's user avatar
  • 111
1 vote
1 answer
114 views

How to prevent Xcode re-indentation from affecting block comments?

In Xcode, let's say I have an arbitrary section of code in a Swift file such as: static func getDocumentsDirectory() -> URL { let paths = FileManager.default.urls(for: .documentDirectory, in: ....
User45i6h45ih3455's user avatar
4 votes
0 answers
119 views

Format brace-list of lambda expressions nicely

Is there any way I can setup clang-format to nicely* format an expression like this? foo({ [](int) { bar(); baz(); }, [](float) {} }); With my current config this gets ...
chrysante's user avatar
  • 2,637
0 votes
0 answers
66 views

Ctrl k+D not working on last microsft vs update

After last update of Microsoft VS ctrl K+D for format code not working for razor page although it format cs page I tried to format form Edit-Advanced-format document but the code didn't format Then i ...
Sabah's user avatar
  • 11
-1 votes
1 answer
37 views

Does a code transformer / formatter exist that will add curly braces to Typescript code

I want all the code in our repository to always use blocks enclosed with brackets for the clauses of if statements, loops and even for inline functions. The following code is banned: const func = () =&...
kaan_atakan's user avatar
  • 3,887
2 votes
2 answers
78 views

Alignment issue when printing formatted prime numbers in J language

I am a relatively new programmer in J-Lang and recently discovered its efficacy in Code Golfing, where it excels in scoring. I am currently working on a coding problem that involves printing all prime ...
user21524036's user avatar
0 votes
0 answers
118 views

Why does my code give a segfault whilst I haven't used raw pointers combined with the new keyword?

I've been working on my own little project for the last few days, and, still being a beginner, I figured it would be a good idea to make a chess game. I've already made some other simple programmes in ...
JoligeJ's user avatar
  • 47
0 votes
1 answer
531 views

How to Configure Prettier/ESLint to Keep Space Between Function Name and Parentheses? VS Code

I'm using Visual Studio Code for a JavaScript project and facing a formatting challenge with Prettier, which I'm using in conjunction with ESLint. My preference is to maintain a space between the ...
Gabe Mata'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
0 votes
2 answers
80 views

How to put item from room into inventory

I am having issues with not being able to get any item and move it into my inventory on this text-based game, I have tried a couple of things but none of it has helped and I am genuinely stuck. I am ...
TEsco's user avatar
  • 3
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

15 30 50 per page