Skip to content

Latest commit

 

History

History
85 lines (52 loc) · 3.83 KB

README.md

File metadata and controls

85 lines (52 loc) · 3.83 KB

XML Extension provides a deeper integration with XML through the use of schemas, XML validation, code completion, linting and optional document formatting. XML Extension also provides a schema for Nova's own Syntax definitions.

XML Extension adds XML schema support to Nova

Work in Progress

This version of XML is a prerelease and not all functionality exists yet. Things that are still to be done are on GitHub Issues.

Requirements

XML Extension runs the eclipse/lemminx XML language server as a native binary and has no external requirements.

Entitlements

XML Extension uses these entitlements for these purposes:

  • process is to run the Language Server itself
  • network is to download schemas and cache them to ~/.lemmix
  • filesystem is to read in XML files, write formatted files and cache schemas

Usage

XML Extension runs any time you open a local project with XML files in it, automatically lints all open files, then reports errors and warnings in Nova's Issues sidebar and the editor gutter:

XML Extension adds XML schema support to Nova

XML Extension intelligently suggests completions for you as you write, based on the current documents associated schema.

See completion options as you write

XML Extension displays relevant documentation when you hover over symbols:

Get tooltips when writting XML files

Commands

  • Format will format the current XML document.
  • Rename will rename the tag you have selected.

Configuration

To configure global preferences, open Extensions → Extension Library... then select XML's Preferences tab.

You can also configure preferences on a per-project basis in Project → Project Settings...

Associating Schemas

There are two schema languages for XML, DTD and XSD. DTD files are simpler and shorter to write whereas XSD schemas are more verbose but provide greater functionality.

Schemas can be loaded relative to the XML file in question.

Nova Syntax Definitions

XML Extension uses a schema catalog to automatically register a schema for Nova Syntax definitions. You can opt into it like this:

<?xml version="1.0" encoding="UTF-8"?>
<syntax name="javascript" xmlns="https://www.nova.app/syntax">
  <!-- ... -->
</syntax>

Local Catalog

If your project uses its own catalog file(s) for mapping namespaces to schemas, you can point to them in the project's configuration settings for XML.

This will allow XML Extension to load mappings from your local files as well.

You may need to run the Restart XML Server command for these changes to take effect

Writing Schemas

W3 Schools has good tutorials for creating both DTD and XSD schemas.

For an example, check out Inventory.xml and Intentory.xsd in the example repo. It shows how to structure a schema and associate it relatively.