first of, you should start kak-lsp by using lsp-enable-window and not by calling eval %sh{...}. Plug already loads lsp for you, so you only need the hook that will call it for needed filetype:
plug "ul/kak-lsp" do %{
cargo install --locked --force --path .
} config %{
hook global WinSetOption filetype=latex lsp-enable-window
}
Though Kakoune doesn’t set latex filetype for .latex buffers, so we can fix this:
hook global BufCreate .*\.latex %{
set-option buffer filetype latex
}
Latex specific settings then should go under hook for filetype:
hook global WinSetOption filetype=latex %{
# Line Wrapping
add-highlighter window/ wrap -indent -width 120
# Compile on save
hook window BufWritePost .* %{ %sh{ pdflatex header.tex } }
}
I changed my settings but again it doesn’t work. It is recognizing the file type because compile on save and wrap do work, but when I run kak-capabilities nothing appears.
Is there an easy way of testing components separately? I mean kak-lsp and texlab.
I’ve downloaded texlab source, compiled it with cargo build --release installed it with cargo install --path . --locked and it works for me with the config I’ve mentioned in my previous reply. @useredsa are you sure that you have texlab installed correctly?
The usual kak-lsp troubleshooting procedure might offer some clues:
instead of letting Kakoune automatically launch kak-lsp, launch it manually yourself with a specific session name:
kak-lsp --session foobarbaz
In a separate terminal, run Kakoune with the same session name, so it will connect to the kak-lsp you’ve already started:
kak -s foobarbaz path/to/my/document.latex
Run lsp-capabilities in Kakoune, and check the terminal containing kak-lsp for error messages.
If that doesn’t provide enough clues, try it again but this time add -v to the kak-lsp command line… or -vv or -vvv or however much additional verbosity you want.
Thanks for the info on debugging kak-lsp. Doing it I managed to find the mistake. Basically, when I told plug to install the plugin, it didn’t work because cargo wasn’t in my path at the moment. I didn’t notice that because although it said error, after hitting enter to retry it said done. Also, I had some other problems.