Skip to content

Commit

Permalink
[Docs] rework README
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Dec 3, 2023
1 parent 74bef22 commit efb17cd
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 8 deletions.
102 changes: 94 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,34 @@
## Helm Language Server Protocol
Helm-ls is a [helm](https://github.com/helm/helm) language server protocol [LSP](https://microsoft.github.io/language-server-protocol/) implementation.


<!-- vim-markdown-toc GFM -->

* [Demo](#demo)
* [Getting Started](#getting-started)
* [Download](#download)
* [Make it executable](#make-it-executable)
* [Integration with yaml-language-server](#integration-with-yaml-language-server)
* [Configuration options](#configuration-options)
* [LSP Server Configuration](#lsp-server-configuration)
* [Configuration Overview](#configuration-overview)
* [LSP Server](#lsp-server)
* [yaml-language-server config](#yaml-language-server-config)
* [Default Configuration](#default-configuration)
* [Editor Config examples](#editor-config-examples)
* [Neovim (using nvim-lspconfig)](#neovim-using-nvim-lspconfig)
* [Vim Helm Plugin](#vim-helm-plugin)
* [Setup laguage server](#setup-laguage-server)
* [Emacs eglot setup](#emacs-eglot-setup)
* [Contributing](#contributing)
* [License](#license)

<!-- vim-markdown-toc -->

## Demo
[![asciicast](https://asciinema.org/a/485522.svg)](https://asciinema.org/a/485522)

## Getting Started
### Vim Helm Plugin
You'll need [vim-helm](https://github.com/towolf/vim-helm) plugin installed before using helm_ls, to install it using vim-plug (or use your preferred plugin manager):
```lua
Plug 'towolf/vim-helm'
```

### Download
* Download the latest helm_ls executable file from [here](https://github.com/mrjosh/helm-ls/releases/latest) and move it to your binaries directory
Expand All @@ -28,6 +50,8 @@ Plug 'towolf/vim-helm'
curl -L https://github.com/mrjosh/helm-ls/releases/download/master/helm_ls_{os}_{arch} --output /usr/local/bin/helm_ls
```

If you are using neovim with [mason](https://github.com/williamboman/mason.nvim) you can also install it with mason.

### Make it executable
```bash
chmod +x /usr/local/bin/helm_ls
Expand All @@ -43,7 +67,68 @@ To install it using npm run (or use your preferred package manager):
npm install --global yaml-language-server
```

## nvim-lspconfig setup
## Configuration options

You can configure helm-ls with lsp workspace configurations.


# LSP Server Configuration

Welcome to the configuration options for our Language Server Protocol (LSP) server! Customize the server behavior according to your preferences.

## Configuration Overview

### LSP Server

- **Log Level**: Adjust log verbosity.

### yaml-language-server config

- **Enable yaml-language-server**: Toggle support of this feature.
- **Path to yaml-language-server**: Specify the executable location.
- **Diagnostics Settings**:
- **Limit**: Number of displayed diagnostics per file.
- **Show Directly**: Show diagnostics while typing.

- **Additional Settings** (see [yaml-language-server](https://github.com/redhat-developer/yaml-language-server#language-server-settings)):
- **Schemas**: Define YAML schemas.
- **Completion**: Enable code completion.
- **Hover Information**: Enable hover details.

### Default Configuration

```lua
settings = {
['helm-ls'] = {
logLevel = "debug",
yamlls = {
enabled = true,
diagnosticsLimit = 50,
showDiagnosticsDirectly = false,
path = "yaml-language-server",
config = {
schemas = {
kubernetes = "**",
},
completion = true,
hover = true,
-- any other config: https://github.com/redhat-developer/yaml-language-server#language-server-settings
}
}
}
}
```

## Editor Config examples

### Neovim (using nvim-lspconfig)
#### Vim Helm Plugin
You'll need [vim-helm](https://github.com/towolf/vim-helm) plugin installed before using helm_ls, to install it using vim-plug (or use your preferred plugin manager):
```lua
Plug 'towolf/vim-helm'
```

#### Setup laguage server
```lua
local lspconfig = require('lspconfig')

Expand All @@ -57,10 +142,11 @@ lspconfig.helm_ls.setup {
}
}
```
See [examples/nvim/init.lua](https://github.com/mrjosh/helm-ls/blob/master/examples/nvim/init.lua) for an
complete example, which also includes yaml-language-server.

[![asciicast](https://asciinema.org/a/485522.svg)](https://asciinema.org/a/485522)

## Emacs eglot setup
### Emacs eglot setup

Integrating helm-ls with [eglot](https://github.com/joaotavora/eglot) for emacs consists of two steps: wiring up Helm template files into a specific major mode and then associating that major mode with `helm_ls` via the `eglot-server-programs` variable.
The first step is necessary because without a Helm-specific major mode, using an existing major mode like `yaml-mode` for `helm_ls` in `eglot-server-programs` may invoke the language server for other, non-Helm yaml files.
Expand Down
2 changes: 2 additions & 0 deletions examples/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- a minimal example config for setting up neovim with helm-ls and yamlls

-- setup lazy plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
Expand Down

0 comments on commit efb17cd

Please sign in to comment.