Skip to content

yveszoundi/eglot-yaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

README

Overview

This project is a set of functions for obtaining smart yaml code completion inside Emacs, using the Redhat YAML LSP Server. The implementation leverages eglot (and its transient dependency project.el for project management).

Smart code completion is enabled by selecting a schema from a pre-defined catalog:

FunctionDescription
eglot-yaml-schema-for-bufferSelect a JSON schema for the current YAML buffer

Dependencies

  • The only Emacs package dependencies are eglot and yaml-mode (or yaml-ts-mode).
  • The following is assumed:
    • You’re using the Redhat YAML LSP Server for yaml files
      • The installation needs Node.js (its npm command)
      • You can install the LSP server via the command: npm i -g yaml-language-server
    • You’ve enabled eglot for yaml files (yaml-mode or yaml-ts-mode)

Installation

Copy the contents of eglot-yaml.el to a new Emacs buffer and run the command:

M-x package-install-from-buffer

Usage

Customization

You can configure few settings to reflect your preferences via M-x customize-group (eglot-yaml).

Invocation

  • Associate eglot to yaml buffers: (add-hook 'yaml-mode-hook (lambda () (eglot-ensure)))
  • Once eglot is up and running for a given yaml buffer, invoke M-x eglot-yaml-schema-for-buffer
    • You’ll be prompted to select a schema for yaml auto-completion
    • You can then use the completion mechanism of your choice (company-mode, etc.)

Releases

No releases published

Packages