问题标签 [autoformatting]
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.
.net - 就像 Visual Studio 的自动格式化一样,以缩进形式以编程方式格式化 XML
我还没有找到一种方法,使用 .NET 的 XmlWriter 和关联的 XmlWriterSettings 以缩进形式格式化 XML 字符串,就像 Visual Studio 使用其自动格式化命令(Ctrl-E Ctrl-D,或者,取决于键盘映射)那样, Ctrl-K Ctrl-D)。
我想这样做是因为我习惯性地在 VS 中自动格式化所有文件,包括代码和 .config 文件。我有一个更新 .config 文件的安装程序应用程序,我想查看实际差异而不是更改整个文档。
我还没有探索自动格式的所有不同格式选项,但我喜欢每个 XML 属性位于单独的行上,第一个与开始标记在同一行,随后的与第一个对齐,像这样:
我尝试使用 XmlWriterSettings 属性“NewLineHandling = NewLineHandling.None”和“NewLineOnAttributes = true”进行格式化,但这会将第一个属性放在开始标记下方,并且无论元素名称中的字符数如何,所有属性都具有相同的缩进,像这样:
请注意,标准 XmlWriter 还以“ />”(斜杠前的额外空格)结束仅属性元素,我不喜欢这但不确定这是否是 XML 标准。我认为 Visual Studio 使用开发人员随时可用的相同 API 选项,但我还没有找到那些神奇的设置。无论如何,这是我的格式方法:
c# - 在内联块注释后自动格式化新行
Visual Studio 自动格式化在所有块注释之后放置一个新行 - 至少是我正在使用的那个。显然,它只针对那些排在第一位的评论。
被格式化为:
由于我使用内联块注释作为代码复制工具的标记,因此我想为所有块注释禁用该“功能”。自动格式应该简单地忽略它们。
自动格式化时不应换行。
这可能吗?如何?我尝试了 C# 格式设置的“新行”部分中的所有内容,但没有运气。
php - PHP Autoformat Paragraph tags
This is a fairly basic question however I've only ever managed to find three answers. I want to autoparagraph unformatted content that may or may not contain other html elements. The two good to go functions are the wordpress wpautop, HTMLPurifier AutoFormat.AutoParagraph and lastly some random addParagraphsNew. However the first is incompatible with my applications license, the second doesn't add line breaks within the paragraph tags and the third is flakey.
Does anyone know on a commercially suitable licensed script that allows html content that has line breaks and double line breaks to be converted into <br />
and <p>
tags?
I believe the HTMLPurifier option is probably the best way to go my hacking into the AutoFormat.AutoParagraph plugin to get it to add line breaks but I was hoping was something slightly easier. Lazy I know.
php - 从代码格式中排除部分代码
是否有一个注释标签,我可以在其中包含自动格式化程序将忽略的一段(php 代码)?
有时我会在一段复杂的 php 代码中使用独特的缩进样式。例如,如果我传递几个数组,我会在线初始化。有时这是保持可读性的唯一方法。不幸的是,这在应用代码格式化程序后丢失了。
css - Netbeans CSS 自动格式
在 Netbeans 6.9.1(PHP 包)中,代码格式(ALT++ SHIFT)F似乎不适用于 CSS 文件,即当我尝试运行它时,什么也没有发生。这是正常的还是我错过了什么?
php - 用于 PHP 的 VIM 中的自动格式化
我希望能够采用以下代码
并做到
通过整个文件,而不是真正去每个语句并更正它。我不是正则表达式大师,所以任何帮助将不胜感激:)
xml - Dreamweaver - 在 CDATA 标记中自动格式化 xml?
我有一个包含许多 CDATA 标记的 xml,这些标记本身包含一个 xml 文档,每个文档都作为一个字符串。
目前这些 CDATA 块实际上就是这样,一个没有任何格式的字符串。
有什么方法可以让 Dreamweaver 自动格式化/缩进 CDATA 标记中的这些代码块?
macos - 是否有任何支持代码自动格式化(又名美化)的 Mac OS 代码编辑器?
到目前为止,我对Espresso印象深刻,但它似乎没有提供任何自动格式化(我被 Visual Studio 宠坏了)。是否有支持此功能的 Mac 通用代码编辑器?具体来说,我对 PHP 和 JavaScript 很感兴趣,但很想知道可能存在的任何选项。
php - 粘贴时如何禁用 Eclipse PDT 自动格式化代码
我正在使用带有 PDT 的 Eclipse Indigo 3.7.0 进行 PHP 开发。当我复制/粘贴一些代码时,Eclipse 会自动对其进行格式化。
例如,复制这个:
粘贴在此:
关于如何禁用它的任何想法?最好的祝福。
eclipse - Aptana Studio Standalone JS 自动格式化的行为与 Eclipse 插件版本不同
出于某种原因,当我使用 Aptana 的 JS 编辑器格式化这个 dojo-fied javascript 块时
标签在自动格式化时被破坏
类似这样的块
格式正确,保留标签。
Aptana 的 Eclipse 插件版本不这样做并且格式正确。这发生在 Aptana Studio 3 的普通版本上,没有任何插件或修改。有没有人遇到过这个?