I have no idea if kak-lsp is running

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.

you can check :lsp-capabilities. If it shows something then the server is running.

Does your „edit“ mean you solved it? Or do you still need help?

Next kak-lsp feature, config validation? :slight_smile:

Uh well I solved a problem.

The issue now is that I don’t see the lsp providing any hovering or diagnostics. The completions just seems to be stuff that’s in the file as well.

I know for sure ccls can do all of that, but there’s nothing there that really indicates ccls is being used. Like it would in Emacs.

I ran :lsp-capabilities like @andreyorst said in a little C project that has the files necessary for ccls (and *debug* even shows that supposedly ccls was enabled), but nothing popped up.

Does anyone else have this issue? Because if not, I’m unsure as to why it’s just me.

Can you give us:

  • kak-lsp -V or if you build from source git show in the directory.

  • kak -version (has the git in it if you built from source)

kak-lsp -V: kak-lsp 8.0.0-snapshot
kak -version: Kakoune v2020.01.16-273-g74e3e5ef

The kak-lsp -V isn’t very helpful, but if it helps it was just updated a few minutes ago when I ran plug-update. So whatever the most recent update to master was, I guess?

what about other servers, like RLS for Rust - does it work? Have you tried other than ccls server for C/C++, like clangd?

пн, 15 июн. 2020 г., 17:58 Alec Stewart via Kakoune Community Hub <noreply@discuss.kakoune.com>:

I’d tried in total ccls for C, dls for D, nimlsp for Nim, elixir_ls for Elixir, and tsserver for Javascript and Typescript.

All the same results of no hover, diagnostics, or any completion outside of what was in the buffer.

I have yet to try rls for Rust, texlab for LaTeX, or haskell-language-server-wrapper for Haskell.

Well rls didn’t work either. I’m going to guess the others aren’t either.

Is it something silly like I need to set my PATH for plain sh? All the language server commands are in my PATH for fish.

I wouldn’t be so concerned about this issue if others were having the same problem.

Yes, Kakoune doesn’t use fish at all, unless you explicitly say it to (but then everything will break), so you probably have to maintain POSIX complaint $PATH variable.

Well running :eval %sh{ echo $PATH } shows the PATH that I’ve set in fish that contains the paths to the corresponding executables. Kakoune must run /bin/sh interactively, which is why the $PATH variable is set like it is in fish. EDIT: I mean that would make the most sense anyway.

I would also think kak-lsp should throw an error saying it couldn’t find the corresponding executables for the LSPs if that was the issue.

This issue is really bugging me, because I feel like there’s one small dumb thing I did that causing me all of this trouble.

I got in trouble once by not remembering that OS-X uses a very different directory for the kak-lsp config than Linux (I switch between). You aren’t on OS-X and using like ~/.config/… are you?

Nope.

I’m on Linux and everything is in ~/.config.

EDIT: I’m putting this on kak-lsp github page as an issue. I’m trying to look over everything to see if this is something on my part.