Skip to content

YANG#

Server#

For more information about the LSP server, check yang-lsp.

Installation#

For more instructions on how to install manually, check here.

Debugger: Not available#


author: esmasth root_file: docs/manual-language-docs/lsp-yang.md


YANG (yang-lsp)#

lsp-mode provides YANG language support via the TypeFox/yang-lsp Server. The server identifier is yls as an abbreviation of the released binary called yang-language-server.

Configuration#

Add following configuration in .emacs or init.el to hook lsp on YANG files, since yang-mode is the supported major mode.

(add-hook 'yang-mode-hook 'lsp)

It recommended to add following configuration for the yang.settings file, which resides at the user/project/workspace root, to be validated via lsp-json. This may be automated by lsp-yang in later stages.

(setq lsp-json-schemas
      `[(:fileMatch ["yang.settings"] :url lsp-yang-yls-settings-schema-url)])

To automatically trigger the lsp-json based validation, following configuration is recommended.

(add-hook 'jsonc-mode-hook 'lsp)

Known Issues#

  • Files in the project need to be opened in buffer to be known by LSP server
  • yang.settings is not associated with its JSON schema yang-lsp-settings-schema.json yet
  • yang-lsp settings file yang.settings is not respected
  • lsp-format-buffer does not follow yang-mode or yang.settings
  • Snippets have a bad format with extraneous characters

Available configurations#

lsp-yang-yls-binary-path#

Type: file

Default: ~/.emacs.d/.cache/lsp/yang-lsp/yang-language-server-0.7.6/bin/yang-language-server

The path to yang-language-server binary.


lsp-yang-yls-download-url#

Type: string

Default: https://github.com/TypeFox/yang-lsp/releases/download/v0.7.6/yang-language-server_0.7.6.zip

Automatic download url for yang-lsp server


lsp-yang-yls-executable#

Type: string

Default: yang-language-server

The yang-lsp server executable to use.

Leave as just the executable name to use the default behavior of finding the executable with variable exec-path.


lsp-yang-yls-settings-schema-url#

Type: string

Default: https://raw.githubusercontent.com/TypeFox/yang-lsp/v0.7.6/schema/yang-lsp-settings-schema.json

URL for yang-lsp server settings schema


lsp-yang-yls-store-path#

Type: file

Default: ~/.emacs.d/.cache/lsp/yang-lsp/yang-lsp

The path to the file in which yang-language-server will be stored.


lsp-yang-yls-version#

Type: string

Default: 0.7.6

yang-lsp server version to download.

It has to be set before lsp-yang.el is loaded and it has to be available here: https://github.com/TypeFox/yang-lsp/releases/



Last update: May 14, 2024