Add emacs lsp-mode documentation and fix typo (#47)

This commit is contained in:
Sibi Prabakaran 2022-12-25 02:39:04 +05:30 committed by GitHub
parent 6aa1e29457
commit cac705a233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View file

@ -107,6 +107,31 @@ if executable('nil')
endif
```
### Emacs with [`lsp-mode`]
[`lsp-mode`]: https://github.com/emacs-lsp/lsp-mode
Add the following elisp code to your configuration. (using `use-package`)
```elisp
(use-package lsp-mode
:ensure t)
(use-package lsp-nix
:ensure lsp-mode
:after (lsp-mode)
:demand t
:custom
(lsp-nix-nil-formatter ["nixpkgs-fmt"]))
(use-package nix-mode
:hook (nix-mode . lsp-deferred)
:ensure t)
```
There are various other configurations to tweak it. Refer the
[specific manual page](https://emacs-lsp.github.io/lsp-mode/page/lsp-nix-nil/ "https://emacs-lsp.github.io/lsp-mode/page/lsp-nix-nil/") for more details.
### Emacs with [`eglot`]
[`eglot`]: https://github.com/joaotavora/eglot

View file

@ -1,7 +1,7 @@
## LSP Configuration
There are some tunable options and settings for `nil`.
They are retrieved via LSP and support runtine modification.
They are retrieved via LSP and support runtime modification.
All settings are nested under a key `"nil"`.
For example, `formatting.command` means to write
@ -24,7 +24,7 @@ The values shown here are the default values.
// It should accepts file content in stdin and print the formatted code into stdout.
// Type: [string] | null
// Example: ["nixpkgs-fmt"]
"command": null,
"command": null,
},
"diagnostics": {
// Ignored diagnostic kinds.