我已经使用Visual Studio作为我的主要IDE一段时间了(尽管我仍然使用Emacs进行一些个人项目).
我喜欢Emacs格式化C/C++代码的方式,我想说服Visual Studio对C#代码使用类似的约定.例如,在Emacs中,C函数调用如下所示:
functionName(argument1,
argument2,
argument3);
Run Code Online (Sandbox Code Playgroud)
在Visual Studio格式化的C#代码中,函数调用如下所示:
functionName(argument1,
argument2,
argument3);
Run Code Online (Sandbox Code Playgroud)
这对我来说似乎更糟糕.
有没有办法调整Visual Studio代码格式规则?任何可以处理的插件?
非常感谢,
通常,传递给函数的参数数量可能很大.考虑以下情况:
calculate(dataManager.getLastUpdate().getNumberOfChildren(),
dataManager.getLastUpdate().getNumberOfParents(),
dataManager.getLastUpdate().getNumberOfGrandChildren(),
long milliseconds,
int somethingelse)
Run Code Online (Sandbox Code Playgroud)
是否有一个指南Java可以提供一种方法来协调论点?在一行中拟合所有参数看起来不太漂亮.
为什么COBOL必须缩进,因为在每个源文件中都有额外的间距?
考虑这段代码(注意额外的空格):
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
Run Code Online (Sandbox Code Playgroud)
在Fortran代码中可以看到类似的格式:
program hello
print *, "Hello World!"
end program hello
Run Code Online (Sandbox Code Playgroud)
但为什么COBOL和Fortran需要这个空白?什么原因?
我想直接在pgAdmin4中autoformat /美化我的SQL查询.我从Eclipse中开发Java知道这个功能,我可以使用一个简单的快捷方式来美化整个代码.
到目前为止,我只找到了一个命令行解决方案,使我的SQL查询非常漂亮:pgFormatter.
我不知道如何描述它,但我正在寻找一种工具,可以为我的代码提供关于如何...更优雅的建议.
例如,使嵌套的if()语句成为switch语句.这样的事情.由于我不知道如何描述我的问题,我不知道该搜索什么.我的东西代码美化不要专门改变陈述吧?
为什么JSLint在代码中报告:
function cos(a) {
var b = 0;
if (a) {
b = 1;
}
else {
b = 2;
}
return b;
}
Run Code Online (Sandbox Code Playgroud)
错误:
Problem at line 6 character 5: Expected exactly one space between '}' and 'else'.
Run Code Online (Sandbox Code Playgroud)
可以通过禁用JSLint的Tolerate messy white space选项来关闭此错误.
或者换句话说 - 为什么语法:
} else {更好
...
}
else {
...
Run Code Online (Sandbox Code Playgroud)
Google还使用} else {表单语法.
但我不明白为什么.谷歌提到"隐含的分号插入",但在开放的背景下{,不是关闭一个.
JavaScript可以关闭后插入分号}的if,即使下一个标记是块else指令?
对不起,我的问题有点乱 - 我试着大声思考.
可能重复:
根据一组编码标准检查C/C++源代码的免费工具?
我正在开始一个涉及我无法直接访问的几个人的c ++项目.我们就编码风格指南达成了一致意见,例如根据可访问性定义了班级成员的外壳(即帕尔卡案中的私人情况,骆驼案中的公众和受保护人.请不要开始讨论风格指南.我已经足够了.谢谢.).
我现在要做的是生成一些样式指南违规报告.我不想强制执行样式指南,例如在提交时,但我想提供一个工具,每个开发人员可以使用它来查看他/她的代码违反样式指南的位置(如果他/她想要检查它).
你知道一个可以做这项工作的工具吗?
(它需要能够理解一些C++,例如检测类成员的可访问性.)
是否有键盘快捷方式或快速方法将以下代码更改为Visual Studio 2013中的单行?我也安装了Resharper.
多
new XElement("Option",
new XAttribute("Name", "FileDelete"),
"1"
),
Run Code Online (Sandbox Code Playgroud)
单
new XElement("Option", new XAttribute("Name", "FileDelete"),"1" ),
Run Code Online (Sandbox Code Playgroud) resharper code-formatting keyboard-shortcuts visual-studio visual-studio-2013
I'd like to have my C# projects (.NET Core 3.1+) to be linted and formatted on each build both locally and in CI environment. I know that there's new .NET Analyzers feature and dotnet-format tool in .NET 6, but I can't understand from the documentation if I can make a single comprehensive configuration file that both these tools would use so I can enforce certain code style in my team. Could you help me understand if it is possible?
code-formatting ×10
java ×2
.net ×1
c# ×1
c++ ×1
cobol ×1
eclipse ×1
formatting ×1
fortran ×1
javascript ×1
jslint ×1
lint ×1
perl ×1
perl-tidy ×1
pgadmin-4 ×1
postgresql ×1
resharper ×1