Visual Studio Format Code Mac



  1. Visual Studio Format Code Machine
  2. Visual Studio 2019 Mac Format Code
  3. Visual Studio Format Code Shortcut
  4. Visual Studio Code Mac Install

Pretty XML is a XML formatter extension for Visual Studio Code and VSCodium. It formats XML documents just like Visual Studio on Windows.Supported file extensions: xml, xaml, xsd, xsl, plist, mobileconfig, config, csproj, axml, resx and all other XML type of files.

There is also Visual Studio for Mac version of this extension. Check it out at PrettyXML.VSMac

Suggestions , improvement PRs are welcome.

Features

  1. Prettify XML (XML Formatting)

    Right Click and Select Prettify XML or use shortcut

    • First attribute on same line as start tag.
    • All attributes indented in line with first attribute.
    • If no child for an element then close inline end tag.(Setting)
    • No empty lines.
  2. Pretty XML: Minimize

    Minimizes XML.

GIFs

Prettify XML

PrettyXML: Minimize

Keyboard Shortcuts

CommandPlatformShortcut
Prettify XMLMacCmd+K L
Prettify XMLWindows, LinuxControl+K L
PrettyXML: MinimizeMacCmd+K `
PrettyXML: MinimizeWindows, LinuxControl+K `

Formatted Document Example

Settings

These will be for Prettify XML command.

Setting KeyDefault ValueDescription
prettyxml.settings.indentSpaceLength2No. of spaces for indentation.
prettyxml.settings.useSingleQuotesfalseUse ' instead of '
prettyxml.settings.useSelfClosingTagtrueIf no child nodes then self closing tag />
prettyxml.settings.formatOnSavefalseEnable format on save

Requirements

VS Code 1.47 or higher.

Installation

Visual Studio Code - Visual Studio MarketPlace

For VSCodium - open-vsx.org

Important!

You will need .Net SDK or Mono installed on your machine.

Known Issues

Limited DTD support.Issues can be reported at issues section

Release Notes

See Change Log

For more information

  1. Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform.
  2. Jul 07, 2020 Visual Studio Code keyboard Shortcuts helps developers maximize their productivity by allowing them to work faster and more efficiently. Here I am listing down all the keyboard shortcuts and cheats of Visual Studio Code editor for Windows, Mac and Linux Operating systems.

Visual Studio Format Code Machine

For visual studio code version 1.36.1 (2019) To auto-format the selection, use ⌘K ⌘F (the trick is that this is to be done in sequence, ⌘K first, followed by ⌘F). To just indent (shift right) without auto-formatting, i.e., blindly indent, use ⌘. Formatting code consistently is a pain, especially when working on a team. The beauty of modern day web development is that the tooling has gotten so much better! In this article, we will look at setting up Prettier to automatically format your code in Visual Studio Code. VS Code plugin for LuaFormatter. Reformats your Lua source code. Extension Settings. Vscode-lua-format.configPath: Specifies the style config file.

An extension that provides live preview, syntax highlighting and snippets for the AsciiDoc format using Asciidoctor flavor.

Contents

  • AsciiDoc support for Visual Studio Code
    • How to Use
    • Build and Install from Source

How to Install

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter:

ext install asciidoctor.asciidoctor-vscode

Alternatively you can use the built-in extension browser to find the AsciiDoc by joaompinto extension and install it.

How to Use

The extension activates automatically when opening an AsciiDoc file (.adoc, .ad, .asc, .asciidoc).

Preview

To show the preview you can use the same commands as the Markdown extension:

  • Toggle Preview - ctrl+shift+v (Mac: cmd+shift+v)
  • Open Preview to the Side - ctrl+k v (Mac: cmd+k v)

The preview refreshes automatically, but it can also be forced with the AsciiDoc: Refresh Preview command.

The preview supports setting attributes through the asciidoc.preview.attributes option.

By default the preview style follows the VSCode theme (workbench.colorTheme). To use Asciidoctor's style set option asciidoc.preview.useEditorStyle to false. It is also possible to set your own preview stylesheet with the asciidoc.preview.style option.

(See more details under Options)

Export as PDF

The extension provides a quick command to export your AsciiDoc file as PDF.

  • Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)
  • Select AsciiDoc: Export document as PDF
  • Choose the folder and filename for the generated PDF

By default a separate binary is downloaded and used to render the document in PDF format. To use Asciidoctor PDF set option asciidoc.use_asciidoctorpdf to true.
(See more details under Options)

Save as HTML

The extension provides a quick command to export your AsciiDoc file as HTML using the default Asciidoctor stylesheet.

Visual Studio 2019 Mac Format Code

  • Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)
  • Select AsciiDoc: Save HTML document
  • The file is generated in the same folder as the source document

The shortcout key of ctrl+alt+s (Mac: cmd+alt+s) will also save the document.

Save to Docbook

The extension provides a quick command to export your AsciiDoc file as Docbook.

  • Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)
  • Select AsciiDoc: Save to Docbook
  • The file is generated in the same folder as the source document

Docbook 5 is supported out of the box.

Docbook 4.5 is more difficut to support (mostly because it's ancient).

Docbook 4.5 requires the use of command line Asciidoctor and requires the use of either the community maintained docbook converter (which can be installed using specific_install) or an older version of Asciidoctor (v1.5.8 or earlier).

To use Docbook 4.5, the following is known to work on Debian based systems:

  1. From the command line, install the specific_install gem: gem install specific_install
  2. Then install the community supported Docbook 4.5 converter from the command line: gem specific_install -l https://github.com/asciidoctor/asciidoctor-docbook45
  3. Then change the User setting asciidoc.asciidoctor_command to: asciidoctor -r asciidoctor-docbook45
  4. Finally, untick (disable) asciidoc.use_asciidoctor_js
Visual Studio Format Code Mac

Snippets

Several code snippets are provided including but not limited to: include statements, images, links, header, headings, lists, blocks, etc...

For a full list open the command palette and select Insert Snippet.

User Settings

This extension is controlled by a multitude of user settings.

The following list contains all the options and their default value.

Option: Default valueDescription
asciidoc.asciidoctor_command: 'asciidoctor'The path or command invoked when using Asciidoctor for the preview.
asciidoc.asciidoctorpdf_command: 'asciidoctor-pdf'The path or command invoked when using Asciidoctor PDF for the Export as PDF function.
asciidoc.forceUnixStyleSeparator: trueForce set the file separator style to unix style. If set false, separator style will follow the system style.
asciidoc.preview.style: 'The local path to a CSS style sheet to use in the AsciiDoc preview. Relative paths are interpreted relative to the workspace folder. If no workspace is open the document path.
asciidoc.preview.attributes: {}Set attributes to be used in the preview. Attributes need to be written as an object of type {string: string}
asciidoc.preview.breaks: falseSets how line-breaks are rendered in the AsciiDoc preview. Setting it to 'true' creates a <br> for every newline.
asciidoc.preview.doubleClickToSwitchToEditor: trueDouble click in the AsciiDoc preview to switch to the editor.
asciidoc.preview.fontFamily: '-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', 'HelveticaNeue-Light', 'Ubuntu', 'Droid Sans', sans-serif'Controls the font family used in the AsciiDoc preview.
asciidoc.preview.fontSize: 14Controls the font size in pixels used in the AsciiDoc preview.
asciidoc.preview.lineHeight: 1.6Controls the line height used in the AsciiDoc preview. This number is relative to the font size.
asciidoc.preview.linkify: trueEnable or disable conversion of URL-like text to links in the AsciiDoc preview.
asciidoc.preview.markEditorSelection: trueMark the current editor selection in the AsciiDoc preview.
asciidoc.preview.openAsciiDocLinks: 'inPreview'How should clicking on links to AsciiDoc files be handled in the preview.
'inPreview' Try to open links in the the AsciiDoc preview
'inEditor' Try to open links in the the editor
asciidoc.preview.scrollEditorWithPreview: trueWhen an AsciiDoc preview is scrolled, update the view of the editor.
asciidoc.preview.scrollPreviewWithEditor: trueWhen an AsciiDoc editor is scrolled, update the view of the preview.
asciidoc.preview.scrollPreviewWithEditorSelection: true[Deprecated] Scrolls the AsciiDoc preview to reveal the currently selected line from the editor.
This setting has been replaced by 'asciidoc.preview.scrollPreviewWithEditor' and no longer has any effect.
asciidoc.preview.refreshInterval: 2000Interval (in miliseconds) between preview refreshes (when the document is changed), 0 means refresh only on save
asciidoc.preview.useEditorStyle: trueUse editor style instead of default asciidoctor.css
asciidoc.previewFrontMatter: 'hide'Sets how YAML front matter should be rendered in the AsciiDoc preview. 'hide' removes the front matter. Otherwise, the front matter is treated as AsciiDoc content.
asciidoc.saveDocbook.docbookVersion: docbook5Choose either Docbook 5 or Docbook 4.5 for Docbook output command
asciidoc.trace: 'off'Enable debug logging for the AsciiDoc extension.
asciidoc.use_asciidoctor_js: trueUse Asciidoctor.js instead of the 'asciidoctor_command' to render the preview.
asciidoc.use_asciidoctorpdf: falseUse Asciidoctor PDF instead of the integrated renderer for the Export as PDF command.
asciidoc.use_kroki: falseEnable kroki integration to generate diagrams.

Identifying the VS Code Environment

The env-vscode attribute is set on all output documents. If you need to identify or handle the VS Code environment you can use an ifdef expression similar to the following:

Diagram Integration

This extension supports a wide range of diagrams from BPMN to Graphviz to PlantUML and Vega graphs using kroki and asciidoctor-kroki.

You can see the full range on the kroki website.

Note that this extension will send graph information to https://kroki.io. If this is an issue it is also possible to use your own kroki instance (see the instructions for further information).

To enable diagram support, set the use_kroki parameter in your User Settings to true.

Format

Visual Studio Format Code Shortcut

To cache and save diagrams locally set the kroki-fetch-diagram attribute in your document header:

This will store images by default in your document folder, however you may also set imagesdir to store them elsewhere:

Visual Studio Code Mac Install

Build and Install from Source

Manual

Script

The script included in the repository automates all operations needed to build the extension. Run bash ./script/build.sh help for more information.

WARNING: The script only works in MacOS and Windows

Issues

If you encounter any problems with the extension and cannot find the solution yourself, please open an issue in the dedicated GitHub page: asciidoctor-vscode/issues.

Before opening an issue, please make sure that it is not a duplicate. Your problem may have already been brought up by another user and been solved: asciidoctor-vscode/issues all.

When you do open an issue, remember to include the following information:

  1. Description of the issue
  2. VSCode version, OS (Help -> About) and extension version
  3. Steps to reproduce the issue
    IMPORTANT: We cannot solve the issue if you do not explain how you encountered it
  4. If the problem occurs only with a specific file, attach it, together with any screnshot that might better show what the issue is.

If your issue only appeared after updating to a new version of the extension, you can roll back to a previous one via the extensions browser. Click on the small gear icon beside the AsciiDoc extension, then select Install Another Version.... A selection menu will appear allowing you to select which version you want to install.

Contributing

To contribute simply clone the repository and then commit your changes. When you do a pull requests please clearly highlight what you changed in the pull comment.

Do not update the extension version or changelog, it will be done by the maintainers when a new version is released.

If you want to update the readme, you are free to fix typos, errors, add or improve descriptions, but if you have a style change in mind please use an issue (or specific pull request) so that it can be discussed.

Credits

  • AsciiDoc by Stuart Rackham
  • Asciidoctor organization for the the language flavor
  • Asciidoctor.js for the preview
  • Asciidoctor PDF for the Export to PDF function
  • wkhtmltopdf for the Export to PDF function

All the following people who have contributed to the extension:

  • Achille Lacoin
  • Andre Bossert
  • Bart Sokol
  • chriskoerner
  • cirrusj
  • Dan Allen
  • Daniel Mulholland
  • danyill
  • Garrett D'Amore
  • Gigacee
  • Guillaume Grossetie
  • Jackson C. Wiebe
  • jacksoncougar
  • João Pinto
  • Johannes Rössel
  • Joshua Stafman
  • Kevin Palmowski
  • Lars Hvam
  • larshp
  • Loïc PÉRON
  • Marcelo Alvim
  • Mark Roszko
  • Masanori Asano
  • Matteo Campinoti
  • MatteoCampinoti94
  • ojn
  • Øyvind Hansen
  • sgn
  • shaneknysh
  • Stephen Pegoraro
  • Tatsunori Uchino
  • Tilmann Oestreich
  • Waldir Pimenta




Comments are closed.