问题标签 [editorconfig]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
802 浏览

c# - EditorConfig 函数调用的每个参数的新行

我一直在搜索文档,我认为这不是一个选项,但基本上我想强制函数调用的每个参数都在一个新行上。

例如我讨厌这个:

我更讨厌这个(每行不同数量的参数):

我希望有一个editorconfig条目将上述内容变为:

理想情况下,我能够在强制执行上述操作之前指定最大参数数量,但这可能是一个白日梦,例如我希望 1 或 2 个,甚至可能 3 个参数保留在下面的一行中:

0 投票
1 回答
524 浏览

c# - VS 的 EditorConfig 命名在 VS 2017 中不起作用

我尝试使用新的 VS 功能 .editorconfig 来设置我自己的代码样式。但其中一部分不起作用。我听说过 Roslyn 错误,处理命名样式,但我不知道问题出在哪里。我的.editorconfig:

查看“# Naming”部分和下面的屏幕截图。如您所见,“#Common rule”和“csharp_style_var_for_built_in_types”工作正常——第 17 和 21 行。但是“#Async 方法应该有“Async”后缀”、“#Interfaces”和参数不起作用(第 19、13 和30)。

在此处输入图像描述

0 投票
1 回答
385 浏览

json - 为什么编辑器为 JSON 文件插入最后一个换行符,尽管配置它不这样做?

我有以下内容.editorconfig

这是 VS 代码配置:

  • 在选择格式选择的所有内容package.json和选择时,在场时将删除最终的newline。
  • 选择Format Document时,缺少时会添加最后一个换行符。
  • 保存文件时,会在丢失时添加最后一个换行符。

什么可能导致添加最后的换行符?

0 投票
1 回答
178 浏览

editor - 如何通过 editorconfig 在 sublime 文本中设置语法高亮

我的.editorconfig文件看起来像这样

我把它放在文件夹层次结构的顶部。但是,崇高的文本将所有.rush文件显示为纯文本,我必须手动将语法高亮更改为 Ruby。

任何人都知道如何做到这一点?

0 投票
1 回答
2173 浏览

git - .editorconfig in shared Git repository

I have prepared my .editorconfig file which I want to use on multiple Git repositories. Each repository holds a Visual Studio solution (C#). My first thought was to put the .editorconfig file in its own repository and then include it in all "solution repositories" as submodule. The problem however: The submodule will be in a subfolder. The contained .editorconfig will thus not be applied to the whole project/solution (but only to the subfolder and its children). It seems to me that I cannot specify a path to my solution-wide .editorconfig in the solution configuration file (.sln), either.

What is the best approach to actually share a single .editorconfig file between multiple Git repositories? The .editorconfig file still needs to be version controlled (and thus shared between users), ie. no local editorconfig configuration.

0 投票
2 回答
1957 浏览

c# - EditorConfig:在 C# 的打开/关闭括号之前和之前强制使用空格

我想配置我的 EditorConfig ( https://editorconfig.org/ ) 配置,通过在左括号和右括号之前添加空格var v = new Object(kind) {Id = num++};来自动重新格式化C# 代码片段。var v = new Object(kind) { Id = num++ };我浏览了文档并检查了 C# 手册(https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#example-editorconfig-文件),但还没有找到解决方案。

0 投票
1 回答
524 浏览

visual-studio - 在 Visual Studio 下使用 editoconfig 强制 const 大写

我正在编写一个 editorconfig 文件来强制执行一些编码样式,并且我想强制常量应该是大写的,所以我在 editorConfig 文件中创建了以下规则:

我正在使用以下代码对此进行测试:

但是,Visual Studio 并不表示该行不正确。是错误还是我的文件不正确?

0 投票
1 回答
1649 浏览

c# - 我可以从命令行通过 C# 文件运行 EditorConfig 吗?

IDE 中的 Visual Studio 支持 EditorConfig 的较新版本很有用,但最好是我可以从命令行运行它(因此在自动化中)。

有没有像 Visual Studio IDE 那样支持所有 EditorConfig 设置的独立工具?Microsoft Docs:EditorConfig 的 .NET 编码约定设置

这是我到目前为止发现的:

使用独立工具有没有办法强制 Visual Studio “无头”运行代码清理?这可能是我唯一的解决方案。

0 投票
1 回答
1141 浏览

javascript - 如何指定应在 Visual Studio Code 中创建的默认 .editorconfig 文件?

我正在使用“EditorConfig for VS Code”扩展,它提供了右键单击选项来在当前项目目录中创建 .editorconfig 文件。创建时,.editorconfig 文件具有以下内容:

这不符合我的偏好,所以我每次开始一个新项目时都需要更改这些配置设置,这很烦人,因为我经常在学习或测试一些 javascript 库或框架时创建一个新项目。

那么有没有办法在通过这个扩展创建时指定这个文件的默认内容?

0 投票
1 回答
822 浏览

c# - 在 Rider 中的方法参数后禁用换行符

每当我让 JetBrains Rider 重新格式化我的代码时,它都会替换

这看起来很奇怪。我怎样才能禁用它?

我的 Rider 代码样式设置被重置为默认值,我的 .editorconfig 如下所示:

我正在寻找正确的 editorconfig-property 来禁用它几个小时并尝试了多种其他设置,但我没有找到正确的设置。

将所有csharp_place_attribute属性设置为true也没有效果。

你有什么想法?