Make A Basic LSP Server In Rust
"test"
These are basic scratch notes for what I did to get hello world setup and making progress for a LSP for neopolitan
Notes
-
use this to attach manually:
https://neovim.io/doc/user/lsp.html#vim.lsp.buf_attach_client%28%29
- Looks like from the tower-lsp-boilerplate you need
capabilities: ServerCapabilities {
text_document_sync: Some(TextDocumentSyncCapability::Kind(
TextDocumentSyncKind::FULL,
)),
semantic_tokens_provider: Some(...stuff...),
..ServerCapabilities::default()
}
Stuff:
:lua vim.lsp.set_log_level('debug')
:lua =vim.lsp.get_active_clients()
:lua vim.lsp.buf_attach_client(0, #ID)
Cargo.toml
[package]
name = "neopolitan-lsp"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = { version = "1.32", features=['full'] }
tower-lsp = "0.20.0"
src/main.rs
use Result;
use *;
use ;
async
nvim.lua
vim.lsp.start({
name = 'neopolitan',
cmd = {'neopolitan-lsp'},
root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]),
})
Notes
-
I installed the binary with
cargo install --path .
to get it on my path. -
The
root_dir
is from the example is isn't what I need, but it doesn't fight with anything
-- end of line --