Unable to verify if kak-lsp is working - mac

I am on a MacBook. I have added all the required config files, but the LSP doesn’t seem to work. I can see all the options listed in the command area but can’t see the completions as I type. I see completions for only the code that is already available in the file. I have copied the default kak-lsp.toml to ~/.config/kak-lsp/kak-lsp.toml and have also installed kak-lsp using brew. I initially tried installing it via plug.kak but I got an Error 101, so I reverted to installing it via brew.

Any help on this would be highly appreciated.

Did you run lsp-enable? Which server are you using, and what is the input file?

This command should give you a kakoune instance with working LSP support, plus a log file (which could point out any errors).

(Unfortunately, kak-lsp is a bit hard to set up but I’m sure it will be worth it. We should try to show the last few thousand log lines inside the editor.)

Also, check the *debug* buffer for suspicious messages

I don’t see the command lsp-enable in my command completion. I see lsp-enable-window though. If I add that to the kakrc, the debug buffer says that it is already loaded. Apart from that, I don’t get any error message in debug buffer. I suspect some silly issue with path in mac?

kak-lsp.toml

I have a config for other languages too. But, I am getting it to work for JS or TS at least for now. I have copied the default config from the plugin to config directory, but with some modifications.

PS: I will soon try to replace pics with code.

typescript-language-server on a simple JS file works for me:
image

Make sure kak-lsp and typescript-language-server are in your $PATH

Please find the error message from log:

1 Like

The error shows that kak-lsp tries to run the flow server for javascript, which is the server in the default config.
This means that kak-lsp didn’t pick up your kak-lsp.toml. Refer to Configuring kak-lsp for how to find the location. In particular, on macOS it’s not ~/.config/kak-lsp/kak-lsp.toml but ~/Library/Preferences/kak-lsp/kak-lsp.toml

(FWIW recent versions of the dirs library have changed to $HOME/Library/Application Support but kak-lsp does not use that yet. Probably it should, while still falling back to the old path.)

Are you sure ~/Library/Preferences/kak-lsp is where we need to house the kak-lsp.toml? When I ls into this directory, all I can see is a bunch of plist files.

Edit: You were right, it seems to be picking the config file from Preferences. However, I don’t see the required auto-completions yet.

Here’s what VS Code shows:

works for me, can you post a full log (where lsp_cmd has -vvvv)

Here is the log file with -vvvv like you asked. Everything seems to be normal from what I can see within the editor. Even the lsp-capabilities return some options except that they’re not shown in the completion. Really confused what might be happening here.

Apr 23 21:35:21.890 INFO Starting main event loop, module: kak_lsp::session:28
Apr 23 21:36:33.042 DEBG From editor: 
session  = "foobar"
client   = "client0"
buffile  = "/Users/sebastia/personal/interview-prep-js/addTwoDigits/addNums.js"
filetype = "javascript"
version  = 31
method   = "capabilities"
[params]
, module: kak_lsp::editor_transport:129
Apr 23 21:36:33.042 DEBG Searching for vars starting with KAK_LSP_PROJECT_ROOT_JAVASCRIPT, module: kak_lsp::project_root:58
Apr 23 21:36:33.042 INFO Found project root "/Users/sebastia/personal/interview-prep-js" because it contains "package.json", module: kak_lsp::project_root:41
Apr 23 21:36:33.042 DEBG Routing editor request to Route { session: "foobar", language: "javascript", root: "/Users/sebastia/personal/interview-prep-js" }, module: kak_lsp::session:94
Apr 23 21:36:33.042 DEBG Spawning a new controller for Route { session: "foobar", language: "javascript", root: "/Users/sebastia/personal/interview-prep-js" }, module: kak_lsp::session:114
Apr 23 21:36:33.043 INFO Starting Language server `typescript-language-server --stdio`, module: kak_lsp::language_server_transport:20
Apr 23 21:36:33.044 DEBG To server: {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"markdown":{"parser":"kak-lsp","version":"12.1.0"}},"offsetEncoding":["utf-8","utf-16"],"textDocument":{"callHierarchy":{"dynamicRegistration":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false,"isPreferredSupport":false},"codeLens":{"dynamicRegistration":false},"colorProvider":{"dynamicRegistration":false},"completion":{"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"preselectSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"snippetSupport":false},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"contextSupport":false,"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":false},"definition":{"dynamicRegistration":false,"linkSupport":false},"documentHighlight":{"dynamicRegistration":false},"documentLink":{"dynamicRegistration":false,"tooltipSupport":false},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":true},"formatting":{"dynamicRegistration":false},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":false},"onTypeFormatting":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":false},"rangeFormatting":{"dynamicRegistration":false},"references":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false,"prepareSupport":false},"selectionRange":{},"semanticTokens":{"dynamicRegistration":false,"formats":["relative"],"requests":{"full":true,"range":false},"tokenModifiers":["documentation","readonly","constant"],"tokenTypes":["comment","namespace","operator","keyword","string","type","variable","function"]},"signatureHelp":{"contextSupport":false,"dynamicRegistration":false,"signatureInformation":{"documentationFormat":["plaintext"],"parameterInformation":{"labelOffsetSupport":false}}},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":false,"willSaveWaitUntil":false},"typeDefinition":{"dynamicRegistration":false,"linkSupport":false}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":false,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"executeCommand":{"dynamicRegistration":false},"symbol":{"dynamicRegistration":false,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"workspaceEdit":{"changeAnnotationSupport":{},"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","delete","rename"]},"workspaceFolders":false}},"clientInfo":{"name":"kak-lsp","version":"12.1.0"},"processId":91968,"rootPath":"/Users/sebastia/personal/interview-prep-js","rootUri":"file:///Users/sebastia/personal/interview-prep-js","trace":"off"},"id":0}, module: kak_lsp::language_server_transport:177
Apr 23 21:36:33.215 DEBG From server: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"completionProvider":{"triggerCharacters":[".","\"","'","/","@","<"],"resolveProvider":true},"codeActionProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["_typescript.applyWorkspaceEdit","_typescript.applyCodeAction","_typescript.applyRefactoring","_typescript.organizeImports","_typescript.applyRenameFile"]},"hoverProvider":true,"renameProvider":true,"referencesProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"workspaceSymbolProvider":true,"implementationProvider":true,"typeDefinitionProvider":true,"foldingRangeProvider":true,"callsProvider":true}}}, module: kak_lsp::language_server_transport:151
Apr 23 21:36:33.216 DEBG To server: {"jsonrpc":"2.0","method":"initialized","params":{}}, module: kak_lsp::language_server_transport:177
Apr 23 21:36:33.216 DEBG To server: {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"javascript","text":"function addTwoNums(n) {\n    var nums = ('' + n).split('');\n    return parseInt(nums[0]) + parseInt(nums[1]);\n}\nconsole.log(addTwoNums(29));\n","uri":"file:///Users/sebastia/personal/interview-prep-js/addTwoDigits/addNums.js","version":31}}}, module: kak_lsp::language_server_transport:177
Apr 23 21:36:33.217 DEBG To editor `foobar`: eval -client client0 -verbatim -- info 'kak-lsp commands supported by javascript language server:

lsp-hover
lsp-completion (hooked on InsertIdle)
lsp-definition (mapped to `gd` by default)
lsp-implementation
lsp-references (mapped to `gr` by default)
lsp-workspace-symbol
lsp-formatting
lsp-range-formatting
lsp-rename
lsp-code-actions
lsp-diagnostics', module: kak_lsp::editor_transport:80
Apr 23 21:36:34.995 DEBG From server: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/sebastia/personal/interview-prep-js/addTwoDigits/addNums.js","diagnostics":[]}}, module: kak_lsp::language_server_transport:151
Apr 23 21:36:34.998 DEBG To editor `foobar`: eval -buffer '/Users/sebastia/personal/interview-prep-js/addTwoDigits/addNums.js' %§set buffer lsp_diagnostic_error_count 0; set buffer lsp_diagnostic_hint_count 0; set buffer lsp_diagnostic_info_count 0; set buffer lsp_diagnostic_warning_count 0; set buffer lsp_errors 31 ; eval "set buffer lsp_error_lines 31  '0|%opt[lsp_diagnostic_line_error_sign]'"; set buffer lsp_diagnostics 31 §, module: kak_lsp::editor_transport:84
Apr 23 21:36:37.608 DEBG From server: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/sebastia/personal/interview-prep-js/addTwoDigits/addNums.js","diagnostics":[]}}, module: kak_lsp::language_server_transport:151
Apr 23 21:36:37.611 DEBG To editor `foobar`: eval -buffer '/Users/sebastia/personal/interview-prep-js/addTwoDigits/addNums.js' %§set buffer lsp_diagnostic_error_count 0; set buffer lsp_diagnostic_hint_count 0; set buffer lsp_diagnostic_info_count 0; set buffer lsp_diagnostic_warning_count 0; set buffer lsp_errors 31 ; eval "set buffer lsp_error_lines 31  '0|%opt[lsp_diagnostic_line_error_sign]'"; set buffer lsp_diagnostics 31 §, module: kak_lsp::editor_transport:84
Apr 23 21:36:40.926 DEBG From editor: 
session  = "foobar"
client   = ""
buffile  = ""
filetype = ""
version  = 0
method   = "stop"
[params]
, module: kak_lsp::editor_transport:129
Apr 23 21:36:40.926 INFO Shutting down language servers and exiting, module: kak_lsp::session:171
Apr 23 21:36:40.926 INFO Exit javascript in project /Users/sebastia/personal/interview-prep-js, module: kak_lsp::session:176
Apr 23 21:36:40.926 INFO Waiting for Controller to finish..., module: kak_lsp::thread_worker:19
Apr 23 21:36:40.926 DEBG To server: {"jsonrpc":"2.0","method":"exit","params":null}, module: kak_lsp::language_server_transport:177
Apr 23 21:36:40.926 INFO Waiting for Messages to language server to finish..., module: kak_lsp::thread_worker:19
Apr 23 21:36:40.926 DEBG Received signal to stop language server, closing pipe, module: kak_lsp::language_server_transport:188
Apr 23 21:36:40.926 DEBG Waiting for language server process end, module: kak_lsp::language_server_transport:87
Apr 23 21:36:40.934 DEBG Language server closed pipe, stopping reading, module: kak_lsp::language_server_transport:129
Apr 23 21:36:41.931 INFO ... Messages to language server terminated with ok, module: kak_lsp::thread_worker:21
Apr 23 21:36:41.932 INFO Waiting for Messages from language server to finish..., module: kak_lsp::thread_worker:19
Apr 23 21:36:41.932 INFO ... Messages from language server terminated with ok, module: kak_lsp::thread_worker:21
Apr 23 21:36:41.932 INFO Waiting for Language server errors to finish..., module: kak_lsp::thread_worker:19
Apr 23 21:36:41.932 INFO ... Language server errors terminated with ok, module: kak_lsp::thread_worker:21
Apr 23 21:36:41.932 INFO ... Controller terminated with ok, module: kak_lsp::thread_worker:21
Apr 23 21:36:41.932 INFO Waiting for Messages to editor to finish..., module: kak_lsp::thread_worker:19
Apr 23 21:36:41.932 INFO ... Messages to editor terminated with ok, module: kak_lsp::thread_worker:21

Sorry about the large log. I didn’t have an option to attach a file.

when you enter insert mode, the editor should send a completion request with log entries like the three lines below (here my cursor is just after arr.). If you don’t get them, can you check the *debug* buffer for error messages?

Apr 23 16:20:45.716 DEBG To server: {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":5,"line":5},"textDocument":{"uri":"file:///home/johannes/git/kak-lsp/t/js/test.js"}},"id":1}, module: kak_lsp::language_server_transport:182
Apr 23 16:20:45.774 DEBG From server: {"jsonrpc":"2.0","id":1,"result":{"items":[{"label":"concat","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["concat"]},"insertTextFormat":2},{"label":"copyWithin","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["copyWithin"]},"insertTextFormat":2},{"label":"entries","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["entries"]},"insertTextFormat":2},{"label":"every","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["every"]},"insertTextFormat":2},{"label":"fill","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["fill"]},"insertTextFormat":2},{"label":"filter","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["filter"]},"insertTextFormat":2},{"label":"find","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["find"]},"insertTextFormat":2},{"label":"findIndex","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["findIndex"]},"insertTextFormat":2},{"label":"forEach","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["forEach"]},"insertTextFormat":2},{"label":"includes","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["includes"]},"insertTextFormat":2},{"label":"indexOf","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["indexOf"]},"insertTextFormat":2},{"label":"join","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["join"]},"insertTextFormat":2},{"label":"keys","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["keys"]},"insertTextFormat":2},{"label":"lastIndexOf","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["lastIndexOf"]},"insertTextFormat":2},{"label":"length","kind":5,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["length"]}},{"label":"map","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["map"]},"insertTextFormat":2},{"label":"pop","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["pop"]},"insertTextFormat":2},{"label":"push","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["push"]},"insertTextFormat":2},{"label":"reduce","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["reduce"]},"insertTextFormat":2},{"label":"reduceRight","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["reduceRight"]},"insertTextFormat":2},{"label":"reverse","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["reverse"]},"insertTextFormat":2},{"label":"shift","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["shift"]},"insertTextFormat":2},{"label":"slice","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["slice"]},"insertTextFormat":2},{"label":"some","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["some"]},"insertTextFormat":2},{"label":"sort","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["sort"]},"insertTextFormat":2},{"label":"splice","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["splice"]},"insertTextFormat":2},{"label":"toLocaleString","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["toLocaleString"]},"insertTextFormat":2},{"label":"toString","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["toString"]},"insertTextFormat":2},{"label":"unshift","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["unshift"]},"insertTextFormat":2},{"label":"values","kind":2,"sortText":"11","commitCharacters":[".",",","("],"data":{"file":"/home/johannes/git/kak-lsp/t/js/test.js","line":6,"offset":6,"entryNames":["values"]},"insertTextFormat":2}],"isIncomplete":false}}, module: kak_lsp::language_server_transport:156
Apr 23 16:20:45.777 DEBG To editor `kak-lsp`: evaluate-commands -client client0 -verbatim -- set window lsp_completions 6.6@1 'concat|set-option window lsp_completions_selected_item 0; info -style menu ''''|concat         {MenuInfo}Method' 'copyWithin|set-option window lsp_completions_selected_item 1; info -style menu ''''|copyWithin     {MenuInfo}Method' 'entries|set-option window lsp_completions_selected_item 2; info -style menu ''''|entries        {MenuInfo}Method' 'every|set-option window lsp_completions_selected_item 3; info -style menu ''''|every          {MenuInfo}Method' 'fill|set-option window lsp_completions_selected_item 4; info -style menu ''''|fill           {MenuInfo}Method' 'filter|set-option window lsp_completions_selected_item 5; info -style menu ''''|filter         {MenuInfo}Method' 'find|set-option window lsp_completions_selected_item 6; info -style menu ''''|find           {MenuInfo}Method' 'findIndex|set-option window lsp_completions_selected_item 7; info -style menu ''''|findIndex      {MenuInfo}Method' 'forEach|set-option window lsp_completions_selected_item 8; info -style menu ''''|forEach        {MenuInfo}Method' 'includes|set-option window lsp_completions_selected_item 9; info -style menu ''''|includes       {MenuInfo}Method' 'indexOf|set-option window lsp_completions_selected_item 10; info -style menu ''''|indexOf        {MenuInfo}Method' 'join|set-option window lsp_completions_selected_item 11; info -style menu ''''|join           {MenuInfo}Method' 'keys|set-option window lsp_completions_selected_item 12; info -style menu ''''|keys           {MenuInfo}Method' 'lastIndexOf|set-option window lsp_completions_selected_item 13; info -style menu ''''|lastIndexOf    {MenuInfo}Method' 'length|set-option window lsp_completions_selected_item 14; info -style menu ''''|length         {MenuInfo}Field' 'map|set-option window lsp_completions_selected_item 15; info -style menu ''''|map            {MenuInfo}Method' 'pop|set-option window lsp_completions_selected_item 16; info -style menu ''''|pop            {MenuInfo}Method' 'push|set-option window lsp_completions_selected_item 17; info -style menu ''''|push           {MenuInfo}Method' 'reduce|set-option window lsp_completions_selected_item 18; info -style menu ''''|reduce         {MenuInfo}Method' 'reduceRight|set-option window lsp_completions_selected_item 19; info -style menu ''''|reduceRight    {MenuInfo}Method' 'reverse|set-option window lsp_completions_selected_item 20; info -style menu ''''|reverse        {MenuInfo}Method' 'shift|set-option window lsp_completions_selected_item 21; info -style menu ''''|shift          {MenuInfo}Method' 'slice|set-option window lsp_completions_selected_item 22; info -style menu ''''|slice          {MenuInfo}Method' 'some|set-option window lsp_completions_selected_item 23; info -style menu ''''|some           {MenuInfo}Method' 'sort|set-option window lsp_completions_selected_item 24; info -style menu ''''|sort           {MenuInfo}Method' 'splice|set-option window lsp_completions_selected_item 25; info -style menu ''''|splice         {MenuInfo}Method' 'toLocaleString|set-option window lsp_completions_selected_item 26; info -style menu ''''|toLocaleString {MenuInfo}Method' 'toString|set-option window lsp_completions_selected_item 27; info -style menu ''''|toString       {MenuInfo}Method' 'unshift|set-option window lsp_completions_selected_item 28; info -style menu ''''|unshift        {MenuInfo}Method' 'values|set-option window lsp_completions_selected_item 29; info -style menu ''''|values         {MenuInfo}Method'

Here is the new log:

Apr 23 22:57:42.411 INFO Starting main event loop, module: kak_lsp::session:28
Apr 23 22:58:39.055 DEBG From editor: 
session  = "foobar"
client   = ""
buffile  = ""
filetype = ""
version  = 0
method   = "stop"
[params]
, module: kak_lsp::editor_transport:129
Apr 23 22:58:39.055 INFO Shutting down language servers and exiting, module: kak_lsp::session:171
Apr 23 22:58:39.055 INFO Waiting for Messages to editor to finish..., module: kak_lsp::thread_worker:19
Apr 23 22:58:39.055 INFO ... Messages to editor terminated with ok, module: kak_lsp::thread_worker:21

and here is the message from **debug** buffer.

recursive call of hook InsertChar/', not executing.

recursive call of hook InsertChar/’, not executing.

kak-lsp does not add InsertChar hooks. This is likely some bad InsertChar hook in your config.

It’s often a great idea to try with a minimal config, to isolate root causes.
This shell script should work for you. Since it uses a temporary $HOME, it won’t read your ~/.config/kak/kakrc.

tmp=$(mktemp -d)

echo > "$tmp"/kak-lsp.toml '
[language.javascript]
filetypes = ["javascript"]
roots = ["*.js"]
command = "typescript-language-server"
args = ["--stdio"]
'

echo > "$tmp"/test.js "
function addTwoNums(n) {
	var nums = ('' + n).split('')
	var arr = ['a'];
	arr.
	return 1
}
"

HOME=$tmp kak -e "
    eval %sh{kak-lsp --kakoune -s \$kak_session}
    set global lsp_cmd \"kak-lsp -s %val{session} -vvvv --log /tmp/kak-lsp.log -c $tmp/kak-lsp.toml\"
    lsp-enable" "$tmp/test.js"
2 Likes

Yes!! It was some error in the config stopping rest of the commands from executing properly. Tried commenting a few lines and was finally able to find the section that was causing the issue. One curious question though, it shows the suggestions properly now (methods, vars.. etc), but, is there a way to get an explanation for each like the above screenshot of vs code? For a method, I would like to know what args it accepts and what it returns… signature sort of.

and thank you so much for the helping hand. It would’ve been difficult without you guiding me in the right direction. Having a forum like this is really a boon.

is there a way to get an explanation for each like the above screenshot of vs code?

That was a bug in kak-lsp (sadly LSP allows servers and clients to do many weird things). Fixed as of Support resolving completion items' "detail" and "documentation" fields · kak-lsp/kak-lsp@6bee0a1 · GitHub
Thanks for reporting!
I wonder if we should switch the default language server for javascript from “flow” to typescript-language-server, since that’s what VSCode uses. I rarely use javascript so I dunno

Most of the editors I used and projects I worked on uses the typescript-language-server. I think it’ll be a good idea to change to that for the benefit of new users. If it’s possible to leave the config for flow under a comment, that’d be good too. But, ts-server being default makes sense.