I’ve setup kak-lsp like so
plug "ul/kak-lsp" do %{
cargo build --release --locked
cargo install --force --path . --locked
cargo clean
} config %{
set-option global lsp_cmd "kak-lsp --kakoune -vvv -c $HOME/.config/kak-lsp/kak-lsp.toml -s %val{session} --log $HOME/.config/kak-lsp/kak-lsp.log"
define-command lsp-restart %{ lsp-stop; lsp-start }
set-option global lsp_completion_trigger "execute-keys 'h<a-h><a-k>\S[^\s,=;*(){}\[\]]\z<ret>'"
set-option global lsp_diagnostic_line_error_sign "!"
set-option global lsp_diagnostic_line_warning_sign "?"
hook global WinSetOption filetype=(c|cpp|objc|d|rust|haskell|nim|elixir|latex|javascript) %{
lsp-start
# ^ I'm apparently need to use this and not an `eval %sh{}`, because it will gripe in *debug*
# that "command lsp-start already exists" or something like that.
lsp-enable-window
echo -debug "Enabling LSP for filtetype %opt{filetype}"
lsp-auto-hover-enable
lsp-auto-hover-insert-mode-disable
set-option global lsp_auto_highlight_references true
set-option global lsp_hover_anchor true
# Semantic highlighting
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
hook -once -always window WinSetOption filetype=.* %{
remove-hooks window semantic-tokens
}
# Other things
#hook window BufWritePre .* lsp-formatting-sync # this breaks shit
hook window BufWritePost .* lsp-diagnostics
hook -always global KakEnd .* lsp-exit
hook global WinSetOption filetype=rust %{
set-option window lsp_server_configuration rust.clippy_preference="on"
}
}
}
And my kak-lsp.toml
lsp_hover_anchor=true
lsp_hover_max_lines=6
snippet_support = true
verbosity = 3
[semantic_scopes]
# Map textmate scopes to kakoune faces for semantic highlighting
# the underscores are translated to dots, and indicate nesting.
# That is, if variable_other_field is omitted, it will try the face for
# variable_other and then variable
#
# To see a list of available scopes in the debug buffer, run lsp-semantic-available-scopes
variable = "variable"
entity_name_function = "function"
entity_name_type = "type"
variable_other_enummember = "variable"
entity_name_namespace = "module"
# Semantic tokens support
# See https://github.com/microsoft/vscode-languageserver-node/blob/8c8981eb4fb6adec27bf1bb5390a0f8f7df2899e/client/src/semanticTokens.proposed.ts#L288
# for token/modifier types.
[semantic_tokens]
type = "type"
variable = "variable"
namespace = "module"
function = "function"
string = "string"
keyword = "keyword"
operator = "operator"
comment = "comment"
[semantic_modifiers]
documentation = "documentation"
readonly = "default+d"
[server]
# exit session if no requests were received during given period in seconds
# works only in unix sockets mode (-s/--session)
# set to 0 to disable
timeout = 1800 # seconds = 30 minutes
[language.c_cpp]
filetypes = ["c", "cpp", "objc", "objcpp", "cuda"]
roots = [".ccls", "compile_commands.json"]
command = "ccls"
[language.d]
filetypes = ["d", "di"]
roots = [".git", "dub.sdl", "dub.json"]
command = "dls"
[language.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "rls"
[language.haskell]
filetypes = ["haskell"]
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
command = "haskell-language-server-wrapper"
args = ["--lsp"]
[language.nim]
filetypes = ["nim"]
roots = ["*.nimble", ".git"]
command = "nimlsp"
[language.elixir]
filetypes = ["elixir", "exs", "eex"]
roots = ["mix.exs"]
command = "~/Tools/Elixir/elixir-ls/release/language_server.sh"
[language.latex]
filetypes = ["latex"]
roots = [".git"]
command = "texlab"
[language.javascript]
filetypes = ["javascript"]
roots = ["package.json", "jsconfig.json"]
command = "tsserver"
[language.typescript]
filetypes = ["typescript"]
roots = ["package.json", "tsconfig.json"]
command = "tsserver"
But when I open up a Typescript project, I’ve yet to see anything that indicates kak-lsp has started. I can’t find it as a running process, nor can I find tsserver
running. There’s no hovering, or any completion outside of what is in the buffer. This is the same with other language servers.
What exactly am I missing?
EDIT: ~/.cargo/bin
is in my path for the shell I use (fish-shell), but does it need to be in the path for plain sh
as well?
Ah, I see this issue is that I have to actually have the kak-lsp
command ran with eval %sh{}
, and that in the kak-lsp.toml
I have to have the field filetypes
not fileTYPE
. I’ve fixed them in this post as well.