Questions tagged [code-formatting]
Code formatting is the way to format the source code of programs, such as using spaces and tabs, improving legibility.
code-formatting
1,624
questions
2
votes
1
answer
53
views
clang-format option to set penalty for breaking preprocessor directives
Is there an option to set the penalty for breaking preprocessor directives into multiple lines?
For example, if I have the following snippet:
#define my_constant 1 // Lorem ipsum dolor sit amet, ...
-4
votes
1
answer
71
views
does spacing between statements, indentation and comments in code affects its time and space complexity? [closed]
I'm trying to understand how code formatting and documentation impacts the performance of a program
Spacing between statements: having more or fewer blank lines between code statements.
Indentation: ...
0
votes
0
answers
25
views
Want to add API response to eclipse code editor temporarily and once click outside temporarily portion Api response should disappear
I am using the below code to write Api response in eclipse code editor.
StyleText textWiget =(StyleText) textEditor.getAdapter(Control.class);
textWiget.replaceTextRange(insertOffset, 0, apiResponse);
...
0
votes
1
answer
30
views
Visual Studio 2022 - indent closing function paren with beginning of argument
In Microsoft driver code (even the driver templates included in VS), they frequently format the function signature like this:
VOID
EvtIoStop(
_In_ WDFQUEUE Queue,
_In_ WDFREQUEST Request,
...
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'
};
...
0
votes
0
answers
37
views
IntelliJ SQL-Formatter to indent SET after UPDATE
How can I modify the IntelliJ SQL-Formatter to insert an indent before the SET (after an UPDATE)?
Current code:
UPDATE role
SET is_available = 0
, is_updated = 1
WHERE name = 'Admin';
Desired ...
0
votes
0
answers
15
views
Enforcing Consistent Code Formatting for HTML and Typescript (VS Code & WebStorm)
I'm in a team working on Angular projects and using Prettier for code formatting (HTML, TypeScript, SCSS). We're encountering merge conflicts due to inconsistent Prettier formatting across team ...
0
votes
0
answers
32
views
Formatting issues with PhpStorm for React/RN
I'm having issues with my PhpStorm settings where it's wrapping on save. I'm not seeing any setting that would allow me to prevent this. I've confirmed it's not Prettier or ESLint causing the issue.
...
2
votes
0
answers
24
views
Pre tag with style="white-space: pre-line" removes leading spaces as desired, but how can I prevent it from losing internal spacing?
I'm having an issue with the HTML pre tag. If I do a very simple test it preserves spacing the way that I want it to. For instance, notice that there are two spaces in a row in certain parts of the ...
0
votes
1
answer
154
views
Visual Studio Code Cleanup: How to avoid removing unassgiend/unused variable when file is on save
I am using Code Cleanup in Visual Studio and noticed when file is on save.
The unused variable will be removed like:
I tried editing the .editorConfig file but it didn't seem to work with any of the ...
4
votes
2
answers
190
views
How do you set formatting rules for C# spread operator in Visual Studio?
I know this is probably not the right place to ask this, but I doubt I'd find an answer somewhere else.
Visual Studio 17.9.5 will, by default, format the following snippet as such
int[] arr = [1, 2];
...
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 ...
0
votes
0
answers
27
views
Why Intelij inserts space after final parameter in annotations when using Reformat Code
Why does Intelij randomly decided to insert space after final parameter in every annotation.
How it was until now:
@GetMapping("/something")
@Tag(name = "Something", description = &...
1
vote
0
answers
40
views
Having space problem while using phpfmt [code formatter] with ...$variable_name
Here is my example code where i am having error while using phpfmt [code formatter].
function ( int | float...$numbers ): int | float {
return array_sum( $numbers );
};
Here as we can see in the ...
0
votes
1
answer
131
views
Is there a way to code format info.plist file like prettier?
If the info.plist file changes, the PR changes and it's very cumbersome to modify. Is there a way to modify it through github action or CI build? Or I'm looking for a way to keep it consistent through ...