Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/editor: write about nvim-dap #1109

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions docs/editor-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ by Regal.

## Neovim

There are a number of different plugins available for [Neovim](https://neovim.io/) which integrate
with language servers using the Language Server Protocol.
[Neovim](https://neovim.io/) supports both the Language Server Protocol and the Debug Adapter Protocol.

Generally, the Regal binary should be [installed](https://docs.styra.com/regal#getting-started)
first. [`mason.vim`](https://github.com/williamboman/mason.nvim) users can install the
Regal binary with `:MasonInstall regal`
([package definition](https://github.com/mason-org/mason-registry/blob/2024-07-23-asian-hate/packages/regal/package.yaml)).

### Language Server Protocol (LSP)

There are a number of different plugins available for Neovim which integrate
with language servers using the Language Server Protocol.

Below are a number of different plugin options to configure a language server
client for Regal in Neovim.

### nvim-lspconfig
#### nvim-lspconfig

[nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) has native support for the
Regal language server. Use the configuration below to configure Regal:
Expand All @@ -40,7 +44,7 @@ Regal language server. Use the configuration below to configure Regal:
require('lspconfig').regal.setup()
```

### none-ls
#### none-ls

[none-ls](https://github.com/nvimtools/none-ls.nvim) - Use Neovim as a
language server to inject LSP diagnostics, code actions, and more via Lua.
Expand Down Expand Up @@ -71,7 +75,7 @@ Example of the diagnostics in as shown in the UI:

![regal in none-ls](./assets/editors-neovim.png)

### nvim-cmp
#### nvim-cmp

[nvim-cmp](https://github.com/hrsh7th/nvim-cmp) supports the adding of language
servers as a source.
Expand All @@ -80,7 +84,7 @@ To use Regal with `nvim-cmp`, it is recommended that you use
the [`nvim-lspconfig` source](https://github.com/hrsh7th/cmp-nvim-lsp) and
follow the instructions above to configure `nvim-lspconfig`.

### Other plugins
#### Other plugins

To see live linting of Rego, your plugin must support
[`textDocument/diagnostic`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_diagnostic)
Expand All @@ -90,6 +94,25 @@ There are many language server integrations for Neovim, if you'd like to see
another one listed, please [open an issue](https://github.com/StyraInc/regal/issues/new)
or drop us a message in [Slack](http://communityinviter.com/apps/styracommunity/signup).

### Debug Adapter Protocol (DAP)

#### nvim-dap and nvim-dap-rego

[nvim-dap](https://github.com/mfussenegger/nvim-dap) is a DAP client
implementation for Neovim.
This plugin provides basic functions to control debuggers from Neovim.

[nvim-dap-rego](https://github.com/rinx/nvim-dap-rego) provides basic
configurations for Regal's DAP interface.

To set up Regal's debugger,

```lua
require('dap-rego').setup()
```

Then you can launch debug sessions by calling `:lua require('dap').continue()`.

## Helix

The [Helix](https://helix-editor.com/) editor comes with a default config that tries to
Expand Down