From e3048c775fedf8a6957e2a3d5c889674d91046e1 Mon Sep 17 00:00:00 2001 From: "Mike Jones (Docs)" Date: Tue, 23 Sep 2025 16:40:25 -0700 Subject: [PATCH 1/3] Refactor XML text editor options --- .openpublishing.redirection.json | 10 +++ .../options-text-editor-xml-formatting.md | 66 ---------------- .../options-text-editor-xml-miscellaneous.md | 57 -------------- docs/toc.yml | 6 -- .../options-text-editor-xml-formatting.md | 78 +++++++++++++++++++ docs/xml-tools/toc.yml | 2 + 6 files changed, 90 insertions(+), 129 deletions(-) delete mode 100644 docs/ide/reference/options-text-editor-xml-formatting.md delete mode 100644 docs/ide/reference/options-text-editor-xml-miscellaneous.md create mode 100644 docs/xml-tools/options-text-editor-xml-formatting.md diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index 4b1b2dabfcd..0f6f455705a 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -5,6 +5,16 @@ "redirect_url": "/visualstudio/msbuild/msbuild", "redirect_document_id": false }, + { + "source_path": "docs/ide/reference/options-text-editor-xml-formatting.md", + "redirect_url": "/visualstudio/xml-tools/options-text-editor-xml-formatting", + "redirect_document_id": false + }, + { + "source_path": "docs/ide/reference/options-text-editor-xml-miscellaneous.md", + "redirect_url": "/visualstudio/xml-tools/options-text-editor-xml-formatting", + "redirect_document_id": false + }, { "source_path": "docs/ide/reference/options-text-editor-xaml-formatting.md", "redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/options-text-editor-xaml-formatting", diff --git a/docs/ide/reference/options-text-editor-xml-formatting.md b/docs/ide/reference/options-text-editor-xml-formatting.md deleted file mode 100644 index 5d9d7b17f31..00000000000 --- a/docs/ide/reference/options-text-editor-xml-formatting.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Options, Text Editor, XML, Formatting -description: Learn how to use the Formatting page in the XML section to to specify how elements and attributes are formatted in your XML documents. -ms.date: 10/29/2018 -ms.topic: reference -f1_keywords: -- VS.ToolsOptionsPages.Text_Editor.XML.Formatting -ms.custom: "ide-ref" -author: maddymontaquila -ms.author: maleger -manager: mijacobs -ms.subservice: general-ide ---- -# Options, Text Editor, XML, Formatting - -Use the **Formatting** options page to specify how elements and attributes are formatted in your XML documents. To access XML formatting options, choose **Tools** > **Options** > **Text Editor** > **XML**, and then choose **Formatting**. - -## Attributes - -**Preserve manual attribute formatting** - -Do not reformat attributes. This setting is the default. - -> [!NOTE] -> If the attributes are on multiple lines, the editor indents each line of attributes to match the indentation of the parent element. - -**Align attributes each on a separate line** - -Align the second and subsequent attributes vertically to match the indentation of the first attribute. The following XML text is an example of how the attributes would be aligned: - -```xml - - -``` - -## Auto Reformat - -**On paste from clipboard** - -Reformat XML text pasted from the clipboard. - -**On completion of end tag** - -Reformat the element when the end tag is completed. - -## Mixed Content - -**Format mixed content by default.** - -Attempt to reformat mixed content, except when the content is found in an `xml:space="preserve"` scope. This setting is the default. - -If an element contains a mix of text and markup, the contents are considered to be mixed content. Following is an example of an element with mixed content. - -```xml -c:\data\AlphaProject\ - test1.txt - test2.txt - -``` - -## See also - -- [XML options - miscellaneous](options-text-editor-xml-miscellaneous.md) -- [XML tools in Visual Studio](../../xml-tools/xml-tools-in-visual-studio.md) diff --git a/docs/ide/reference/options-text-editor-xml-miscellaneous.md b/docs/ide/reference/options-text-editor-xml-miscellaneous.md deleted file mode 100644 index 9b97844d5ed..00000000000 --- a/docs/ide/reference/options-text-editor-xml-miscellaneous.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: Options, Text Editor, XML, Miscellaneous -description: Learn how to use the Miscellaneous page in the XAML section to to change the autocompletion and schema settings for the XML Editor. -ms.date: 10/29/2018 -ms.topic: reference -f1_keywords: -- VS.ToolsOptionsPages.Text_Editor.XML.Miscellaneous -ms.custom: "ide-ref" -author: maddymontaquila -ms.author: maleger -manager: mijacobs -ms.subservice: general-ide ---- -# Options, Text Editor, XML, Miscellaneous - -Use the **Miscellaneous** options page to change the autocompletion and schema settings for the XML Editor. To access miscellaneous XML options, choose **Tools** > **Options** > **Text Editor** > **XML**, and then choose **Miscellaneous**. - -## Auto Insert - -**Close tags** - -The text editor adds close tags when authoring XML elements. If an element start tag is selected, the editor inserts the matching close tag, including a matching namespace prefix. This check box is selected by default. - -**Attribute quotes** - -When authoring XML attributes, the editor inserts the `="` and `"` characters and positions the caret (**^**) inside the quotation marks. This check box is selected by default. - -**Namespace declarations** - -The editor automatically inserts namespace declarations wherever they are needed. This check box is selected by default. - -**Other markup (Comments, CDATA)** - -Comments, CDATA, DOCTYPE, processing instructions, and other markup is autocompleted. This check box is selected by default. - -## Network - -**Automatically download DTDs and schemas** - -Schemas and document type definitions (DTDs) are automatically downloaded from HTTP locations. This feature uses System.Net with autoproxy server detection enabled. This check box is selected by default. - -## Outlining - -**Enter outlining mode when files open** - -Turns on the outlining feature when a file is opened. This check box is selected by default. - -## Caching - -**Schemas** - -Specifies the location of the schema cache. The **Browse** button opens the current schema cache location in a new window. The default location is *%VsInstallDir%\xml\Schemas*. - -## See also - -- [XML options - formatting](options-text-editor-xml-formatting.md) -- [XML tools in Visual Studio](../../xml-tools/xml-tools-in-visual-studio.md) diff --git a/docs/toc.yml b/docs/toc.yml index f596801d9a5..572678b0da1 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -988,12 +988,6 @@ href: ide/reference/options-text-editor-fsharp-code-fixes.md - name: IntelliSense href: ide/reference/options-text-editor-fsharp-intellisense.md - - name: XML - items: - - name: Formatting - href: ide/reference/options-text-editor-xml-formatting.md - - name: Miscellaneous - href: ide/reference/options-text-editor-xml-miscellaneous.md - name: Windows Forms Designer href: ide/reference/options-windows-forms-designer.md - name: XAML Designer diff --git a/docs/xml-tools/options-text-editor-xml-formatting.md b/docs/xml-tools/options-text-editor-xml-formatting.md new file mode 100644 index 00000000000..2aa243d2be7 --- /dev/null +++ b/docs/xml-tools/options-text-editor-xml-formatting.md @@ -0,0 +1,78 @@ +--- +title: Configure XML formatting in the text editor +description: Learn how to configure XML formatting and miscellaneous options in the Visual Studio text editor. +ms.date: 9/23/2025 +ms.topic: how-to +#customer intent: As a Visual Studio user, I want to control how XML is formatted and completed in the editor so that my documents are readable and follow my standards. +f1_keywords: +- VS.ToolsOptionsPages.Text_Editor.XML.Formatting +- VS.ToolsOptionsPages.Text_Editor.XML.Miscellaneous +ms.custom: "ide-ref" +author: maddymontaquila +ms.author: maleger +manager: mijacobs +ms.subservice: general-ide +--- +# Configure XML formatting in the Visual Studio text editor + +You can control how XML elements, attributes, and other content are formatted and completed in Visual Studio. This article shows you how to configure formatting and miscellaneous options for XML editing, so your documents are readable and follow your standards. + +## Prerequisites + +- Visual Studio installed +- An XML file or project + +## Configure XML formatting options + +Use the **Formatting** options page to specify how elements and attributes are formatted in your XML documents. + +1. In Visual Studio, go to **Tools** > **Options**. +2. Expand **Text Editor** > **XML**. +3. Select **Formatting**. +4. Choose your preferred formatting options: + - **Preserve manual attribute formatting**: Do not reformat attributes. This setting is the default. + > [!NOTE] + > If the attributes are on multiple lines, the editor indents each line of attributes to match the indentation of the parent element. + - **Align attributes each on a separate line**: Align the second and subsequent attributes vertically to match the indentation of the first attribute. Example: + ```xml + + + ``` + - **Auto Reformat**: + - **On paste from clipboard**: Reformat XML text pasted from the clipboard. + - **On completion of end tag**: Reformat the element when the end tag is completed. + - **Mixed Content**: + - **Format mixed content by default**: Attempt to reformat mixed content, except when the content is found in an `xml:space="preserve"` scope. This setting is the default. + If an element contains a mix of text and markup, the contents are considered to be mixed content. Example: + ```xml + c:\data\AlphaProject\ + test1.txt + test2.txt + + ``` + +## Configure miscellaneous XML options + +Use the **Miscellaneous** options page to change the autocompletion and schema settings for the XML Editor. + +1. In **Tools** > **Options**, expand **Text Editor** > **XML**. +2. Select **Miscellaneous**. +3. Adjust the following options as needed: + - **Auto Insert**: + - **Close tags**: The text editor adds close tags when authoring XML elements. If an element start tag is selected, the editor inserts the matching close tag, including a matching namespace prefix. This check box is selected by default. + - **Attribute quotes**: When authoring XML attributes, the editor inserts the `="` and `"` characters and positions the caret (**^**) inside the quotation marks. This check box is selected by default. + - **Namespace declarations**: The editor automatically inserts namespace declarations wherever they are needed. This check box is selected by default. + - **Other markup (Comments, CDATA)**: Comments, CDATA, DOCTYPE, processing instructions, and other markup is autocompleted. This check box is selected by default. + - **Network**: + - **Automatically download DTDs and schemas**: Schemas and document type definitions (DTDs) are automatically downloaded from HTTP locations. This feature uses System.Net with autoproxy server detection enabled. This check box is selected by default. + - **Outlining**: + - **Enter outlining mode when files open**: Turns on the outlining feature when a file is opened. This check box is selected by default. + - **Caching**: + - **Schemas**: Specifies the location of the schema cache. The **Browse** button opens the current schema cache location in a new window. The default location is *%VsInstallDir%\xml\Schemas*. + +## Next steps + +- [XML options - miscellaneous](options-text-editor-xml-miscellaneous.md) +- [XML tools in Visual Studio](../../xml-tools/xml-tools-in-visual-studio.md) diff --git a/docs/xml-tools/toc.yml b/docs/xml-tools/toc.yml index f55c1e0bed6..f69486aae19 100644 --- a/docs/xml-tools/toc.yml +++ b/docs/xml-tools/toc.yml @@ -36,6 +36,8 @@ href: how-to-execute-an-xslt-transformation-from-the-xml-editor.md - name: Edit XML files href: how-to-edit-xml-files.md + - name: Configure XML editor options + href: options-text-editor-xml-formatting.md - name: XSLT walkthroughs items: - name: XSLT IntelliSense From 9ea59a829287b14398d6cd8602a2d46e455d0467 Mon Sep 17 00:00:00 2001 From: "Mike Jones (Docs)" Date: Tue, 23 Sep 2025 16:45:48 -0700 Subject: [PATCH 2/3] link fixes --- docs/xml-tools/options-text-editor-xml-formatting.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/xml-tools/options-text-editor-xml-formatting.md b/docs/xml-tools/options-text-editor-xml-formatting.md index 2aa243d2be7..10b26d7b4c9 100644 --- a/docs/xml-tools/options-text-editor-xml-formatting.md +++ b/docs/xml-tools/options-text-editor-xml-formatting.md @@ -74,5 +74,4 @@ Use the **Miscellaneous** options page to change the autocompletion and schema s ## Next steps -- [XML options - miscellaneous](options-text-editor-xml-miscellaneous.md) -- [XML tools in Visual Studio](../../xml-tools/xml-tools-in-visual-studio.md) +- [XML tools in Visual Studio](../xml-tools/xml-tools-in-visual-studio.md) From 54cd4e4e2ed52e5ff698488b6681a9d932674710 Mon Sep 17 00:00:00 2001 From: "Mike Jones (Docs)" Date: Thu, 25 Sep 2025 13:42:15 -0700 Subject: [PATCH 3/3] edits --- docs/xml-tools/options-text-editor-xml-formatting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/xml-tools/options-text-editor-xml-formatting.md b/docs/xml-tools/options-text-editor-xml-formatting.md index 10b26d7b4c9..22aef5bdd76 100644 --- a/docs/xml-tools/options-text-editor-xml-formatting.md +++ b/docs/xml-tools/options-text-editor-xml-formatting.md @@ -1,5 +1,5 @@ --- -title: Configure XML formatting in the text editor +title: Configure formatting in the XML editor description: Learn how to configure XML formatting and miscellaneous options in the Visual Studio text editor. ms.date: 9/23/2025 ms.topic: how-to @@ -13,7 +13,7 @@ ms.author: maleger manager: mijacobs ms.subservice: general-ide --- -# Configure XML formatting in the Visual Studio text editor +# Configure formatting in the XML editor You can control how XML elements, attributes, and other content are formatted and completed in Visual Studio. This article shows you how to configure formatting and miscellaneous options for XML editing, so your documents are readable and follow your standards.