code-formatting

What inserts space inside empty curly braces block?

血红的双手。 提交于 2019-12-11 11:55:53
问题 Using Visual Studio 2015, editing C# code, typing two character sequence {} . 'Something' constantly inserts single space inside the block resulting in { } , which might be pretty annoying for someone. What is causing this behavior when all IntelliSense and Resharper formatting is disabled? 回答1: Although not very intuitive and expected: Smart choice in Visual Studio menu item Tools/Options/Text Editor/C#/Tabs/Indenting is causing this behavior. Changing it to Block stops it... 回答2: If you are

How Can I make sure I applied the correct code format in intelliJ

安稳与你 提交于 2019-12-11 10:19:20
问题 I have both Java and Scale code in the project. Editing 2 types of code in one task is common. I inputted the google-java-code-style schema for Java code format and installed the scalafmt plugin in the intellij IDEA. Both of them use Ctrl+Shift+L to reformat the code. How can I make sure the correct one has been called when I press those hot keys. I feel all the code were formatted by the google-java-code-style schema for the moment. Is there any indicators could inform me which schema or

Format to add standard code blocks within Markdown lists

可紊 提交于 2019-12-11 09:50:08
问题 I've found that I can't get code blocks within numbered lists. For example, when I add a code block by indenting by four spaces normally like below: 1. Do the first thing $ git stuff $ git other stuff 2. second thing: $ git more stuff it comes out like this, where the $ git lines are normal text and are not formatted as code: Do the first thing $ git stuff $ git other stuff second thing: $ git more stuff I can use the backticks to do it, i.e. 1. Do the first things `$ git stuff` `$ git other

Json parsing, generating and beautifiying / formatting with AutoHotkey?

♀尐吖头ヾ 提交于 2019-12-11 09:47:05
问题 How to convert a json string into autohotkey objects/arrays... and the other way around? And how to get the json string nicely formatted with newline characters and space indentations? 回答1: Here is a Json class I wrote recently. It automatically handles indentation and newline chars. You can even specify which characters to use etc. And it also handles edge cases like double quotes within strings (they need to be escaped in json), that's something I was really missing from other json

Eclipse code formatting is not aligning fields in columns properly

自作多情 提交于 2019-12-11 06:58:58
问题 Eclipse code formatter is not aligning fields equally with Align fields in columns option checked when field is of type int or boolean . Here's how it shows up after formatting: private Rect mTempRect; private int lastClickX; private int lastClickY; private int mMaxLinesCount; private boolean mWrapped; private boolean expanded; private SpannableString mLinkHideText; I'm using Eclipse Version: 4.2.1 JUNO x64, Ubuntu 12.04 LTS 64 bits. 回答1: Solved! The problem was that Eclipse was using a

How to keep spaces within angle brackets of C++ casting operators in Visual C++ 2015?

故事扮演 提交于 2019-12-11 01:38:34
问题 I want to format my C++ casting operators this way: Class * foo = static_cast< Class * >( bar ); Visual Studio insists on removing the spaces within the angle brackets: Class * foo = static_cast<Class*>( bar ); How do I prevent it from doing so? 回答1: Go to Options > Text Editor > C/C++ > Formatting > Spacing , and check the (wrongly named) Insert space within parentheses of a C-style cast box. For some reason, it also applies to the angle brackets of C++ casting operators. 来源: https:/

Are there any plugins for Visual Studio which automatically formats code how I like?

☆樱花仙子☆ 提交于 2019-12-10 23:36:24
问题 When I open any code file, whether something i've written or something from another developer, I want it to automatically format it with my preference of bracing, indentation, line spacing, etc.. Ideally, when saving a file to disk, it would only save the formatting for code/lines i've touched. It would still display the rest of the code formatted, however it would not save these to disk (so as to not piss off other developers). 回答1: You could use Resharper for this. It will show warnings for

Git modify contents of index directly for pre-commit formatting hook

偶尔善良 提交于 2019-12-10 20:48:27
问题 I would like to automatically format my files before they are added to Git's index. Right now, I have a pre-commit hook that looks like this: #!/bin/bash set -e exec 1>&2 workingext="working.$$" ext="bak.$$" git diff -z --cached --name-only | egrep -z '\.(pl|pm|t)$' | \ while read -d'' -r f; do # First modify the file in the index mv "$f" "$f.$workingext" git show :"$f" > "$f" perl -c "$f" perltidy -pbp -nst -b -bext="$ext" "$f"; rm -f "$f.$ext" git add "$f" mv "$f.$workingext" "$f" # Then

F# Visual Power Tools doesn't work

泄露秘密 提交于 2019-12-10 17:23:51
问题 I'm trying to work with F# . For all projects in VS2015 solution i want to have similar code style. I have installed Visual F# Power Tools and setted formatting configuration to: According to this configuration (space after comma) the following code: fun unit ->Log.Information( "Found: {category}\\{name}\\{instance}",category,name,instance ) should be converted to: fun unit ->Log.Information( "Found: {category}\\{name}\\{instance}", category, name, instance ) But when i'm trying to format

Uncrustify split function call parameters

∥☆過路亽.° 提交于 2019-12-10 17:18:58
问题 I want to format the code like this: a) line width maximum 120 b)- function call parameters one per line with indent if the length of the function is called is > 120 else function call in one line c)- it the function call is inside a if, for, while, etc... the parameters should be formatted as written at b) I have the code (it is just a fictive): void a_function() { if(verify_if_the_conditions_are_meet(first_parameter, second_parameter, third_parameter, fourth_parameter, fifth_parameter,