Skip to content

Commit b5e3ea4

Browse files
authored
fix: correct usage issues and docs for neovim (#6)
1 parent 0e36f9e commit b5e3ea4

File tree

4 files changed

+47
-15
lines changed

4 files changed

+47
-15
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sysdig-lsp"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
edition = "2024"
55
authors = [ "Sysdig Inc." ]
66
readme = "README.md"

README.md

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ Navigate to **Settings > Configure Kate > LSP Client > User Server Settings** an
137137

138138
### JetBrains IDEs
139139

140-
141140
> [!WARNING]
142141
> The configuration for JetBrains IDEs is not definitive.
143142
> In the future, we plan to develop a dedicated plugin that will automatically manage the LSP and expand its functionalities.
@@ -157,7 +156,7 @@ Navigate to **Settings > Configure Kate > LSP Client > User Server Settings** an
157156
}
158157
```
159158

160-
### Vim with coc.nvim
159+
### Vim with coc.nvim (to be reviewed)
161160

162161
Add the following to your `coc.nvim` configuration:
163162

@@ -177,22 +176,55 @@ Add the following to your `coc.nvim` configuration:
177176

178177
### Neovim with nvim-lspconfig
179178

180-
Refer to the [Neovim LSP configuration guide](https://neovim.io/doc/user/lsp.html#lsp-config) and add:
179+
Install [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig?tab=readme-ov-file#install):
180+
181+
```bash
182+
git clone https://github.com/neovim/nvim-lspconfig ~/.config/nvim/pack/plugins/start/nvim-lspconfig
183+
```
184+
185+
Now you can use `require("lspconfig")`, so add in your `~/.config/nvim/init.lua`:
181186

182187
```lua
183-
return {
184-
default_config = {
185-
cmd = { 'sysdig-lsp' },
186-
root_dir = util.root_pattern('.git'),
187-
filetypes = {
188-
'dockerfile',
188+
local lspconfig = require("lspconfig")
189+
local configs = require("lspconfig.configs")
190+
191+
if not configs.sysdig then
192+
configs.sysdig = {
193+
default_config = {
194+
cmd = { "sysdig-lsp" },
195+
root_dir = lspconfig.util.root_pattern(".git"),
196+
filetypes = { "dockerfile" },
197+
single_file_support = true,
198+
init_options = {
199+
sysdig = {
200+
api_url = "https://us2.app.sysdig.com",
201+
-- api_token = "my_token", -- if not specified, will be retrieved from the SYSDIG_API_TOKEN env var.
202+
},
203+
},
189204
},
190-
single_file_support = true,
191-
init_options = {
192-
activateSnykCode = 'true',
205+
}
206+
end
207+
208+
lspconfig.sysdig.setup({})
209+
```
210+
211+
### Neovim 0.11+ (without plugins)
212+
213+
Refer to the [Neovim LSP configuration guide](https://neovim.io/doc/user/lsp.html#lsp-config) and add the following config in `~/.config/nvim/init.lua`:
214+
215+
```lua
216+
vim.lsp.config.sysdig = {
217+
cmd = {"sysdig-lsp"},
218+
root_markers = {"Dockerfile"},
219+
filetypes = { "dockerfile" },
220+
init_options = {
221+
sysdig = {
222+
api_url = "https://us2.app.sysdig.com",
223+
-- api_token = "my_token", -- if not specified, will be retrieved from the SYSDIG_API_TOKEN env var.
193224
},
194225
},
195226
}
227+
vim.lsp.enable("sysdig")
196228
```
197229

198230
## Hacking

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async fn main() {
1616
let (service, messages) = LspService::new(|client| {
1717
let subscriber = tracing_subscriber::registry()
1818
.with(LSPLogger::new(client.clone()))
19-
.with(tracing_subscriber::fmt::layer());
19+
.with(tracing_subscriber::fmt::layer().with_writer(std::io::stderr));
2020

2121
tracing::subscriber::set_global_default(subscriber)
2222
.expect("setting default subscriber failed");

0 commit comments

Comments
 (0)