Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on startup using Kakoune and kak-lsp #464

Closed
raiguard opened this issue Mar 24, 2021 · 6 comments
Closed

Error on startup using Kakoune and kak-lsp #464

raiguard opened this issue Mar 24, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@raiguard
Copy link

raiguard commented Mar 24, 2021

I have not yet determined if this bug is the server's fault or the fault of kak-lsp, but I'm trying here first.

Describe the bug
I am using this language server with Kakoune and kak-lsp, and am experiencing an error and disconnect on startup. This error is not shown by kak-lsp, but is only observable in the log file.

Here is the complete log file:

Log file
[10:41:20.508][info] [#0:main:51]: Lua Lsp startup, root: 	/home/rai/dev/langservers/sumneko-lua
[10:41:20.508][debug][#0:main:52]: ROOT:	/home/rai/dev/langservers/sumneko-lua
[10:41:20.508][debug][#0:main:53]: LOGPATH:	/home/rai/dev/langservers/sumneko-lua/log
[10:41:20.508][debug][#0:main:54]: METAPATH:	/home/rai/dev/langservers/sumneko-lua/meta
[10:41:20.513][info] [#0:script.service.telemetry:16]: Telemetry Token:	4C128984A723FF59
[10:41:20.542][info] [#0:script.pub.pub:48]: Create brave:	1
[10:41:20.542][info] [#0:script.pub.pub:48]: Create brave:	2
[10:41:20.542][info] [#0:script.pub.pub:48]: Create brave:	3
[10:41:20.542][info] [#0:script.pub.pub:48]: Create brave:	4
[10:41:20.542][debug][#0:script.service.service:136]: 
========= Medical Examination Report =========
    --------------- Memory ---------------
        Total: 1.753 MB
        # 00 : 1.753 MB
        # 01 : 0.000 MB
        # 02 : 0.000 MB
        # 03 : 0.000 MB
        # 04 : 0.000 MB
    --------------- Coroutine ---------------
        Total:     0
        Running:   0
        Suspended: 0
        Normal:    0
        Dead:      0
    --------------- Cache ---------------
        Total: 1
        Dead:  0
    --------------- Proto ---------------
        Holdon:   0
        Waiting:  0
==============================================
[10:41:20.573][debug][#0:script.provider.client:32]: Client init	{
    capabilities = {
        textDocument = {
            codeAction = {
                codeActionLiteralSupport = {
                    codeActionKind = {
                        valueSet = {
                            [1] = "quickfix",
                            [2] = "refactor",
                            [3] = "refactor.extract",
                            [4] = "refactor.inline",
                            [5] = "refactor.rewrite",
                            [6] = "source",
                            [7] = "source.organizeImports",
                        },
                    },
                },
                dynamicRegistration = false,
                isPreferredSupport = false,
            },
            codeLens = {
                dynamicRegistration = false,
            },
            colorProvider = {
                dynamicRegistration = false,
            },
            completion = {
                completionItem = {
                    commitCharactersSupport = false,
                    deprecatedSupport = false,
                    documentationFormat = {
                        [1] = "plaintext",
                    },
                    preselectSupport = false,
                    snippetSupport = true,
                },
                completionItemKind = {
                    valueSet = {
                        [01] = 1,
                        [02] = 2,
                        [03] = 3,
                        [04] = 4,
                        [05] = 5,
                        [06] = 6,
                        [07] = 7,
                        [08] = 8,
                        [09] = 9,
                        [10] = 10,
                        [11] = 11,
                        [12] = 12,
                        [13] = 13,
                        [14] = 14,
                        [15] = 15,
                        [16] = 16,
                        [17] = 17,
                        [18] = 18,
                        [19] = 19,
                        [20] = 20,
                        [21] = 21,
                        [22] = 22,
                        [23] = 23,
                        [24] = 24,
                        [25] = 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,
            },
            formatting = {
                dynamicRegistration = false,
            },
            hover = {
                contentFormat = {
                    [1] = "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,
            },
            semanticHighlightingCapabilities = {
                semanticHighlighting = true,
            },
            semanticTokens = {
                dynamicRegistration = false,
                formats = {
                    [1] = "relative",
                },
                requests = {
                    full = true,
                    range = false,
                },
                tokenModifiers = {
                    [1] = "documentation",
                    [2] = "readonly",
                },
                tokenTypes = {
                    [01] = "string",
                    [02] = "variable",
                    [03] = "comment",
                    [04] = "type",
                    [05] = "enumMember",
                    [06] = "macro",
                    [07] = "namespace",
                    [08] = "parameter",
                    [09] = "function",
                    [10] = "keyword",
                    [11] = "lifetime",
                    [12] = "enum",
                    [13] = "operator",
                },
            },
            signatureHelp = {
                contextSupport = false,
                dynamicRegistration = false,
                signatureInformation = {
                    documentationFormat = {
                        [1] = "plaintext",
                    },
                    parameterInformation = {
                        labelOffsetSupport = false,
                    },
                },
            },
            synchronization = {
                didSave = true,
                dynamicRegistration = false,
                willSave = false,
                willSaveWaitUntil = false,
            },
            typeDefinition = {
                dynamicRegistration = false,
                linkSupport = false,
            },
        },
        window = {
            workDoneProgress = false,
        },
        workspace = {
            applyEdit = false,
            configuration = false,
            didChangeConfiguration = {
                dynamicRegistration = false,
            },
            executeCommand = {
                dynamicRegistration = false,
            },
            symbol = {
                dynamicRegistration = false,
                symbolKind = {
                    valueSet = {
                        [01] = 1,
                        [02] = 2,
                        [03] = 3,
                        [04] = 4,
                        [05] = 5,
                        [06] = 6,
                        [07] = 7,
                        [08] = 8,
                        [09] = 9,
                        [10] = 10,
                        [11] = 11,
                        [12] = 12,
                        [13] = 13,
                        [14] = 14,
                        [15] = 15,
                        [16] = 16,
                        [17] = 17,
                        [18] = 18,
                        [19] = 19,
                        [20] = 20,
                        [21] = 21,
                        [22] = 22,
                        [23] = 23,
                        [24] = 24,
                        [25] = 25,
                        [26] = 26,
                    },
                },
            },
            workspaceEdit = {
                changeAnnotationSupport = {
                },
                documentChanges = true,
                failureHandling = "abort",
                normalizesLineEndings = false,
                resourceOperations = {
                    [1] = "create",
                    [2] = "delete",
                    [3] = "rename",
                },
            },
            workspaceFolders = false,
        },
    },
    clientInfo = {
        name = "kak-lsp",
        version = "9.0.0-snapshot",
    },
    processId = 20736,
    rootPath = "/home/rai/dev/projects/personal/Factorio-RecipeBook",
    rootUri = "file:///home/rai/dev/projects/personal/Factorio-RecipeBook",
    trace = "off",
}
[10:41:20.573][info] [#0:script.language:135]: VSC language: nil
[10:41:20.573][info] [#0:script.language:136]: LS  language: en-us
[10:41:20.584][info] [#0:script.workspace.workspace:31]: Workspace inited: 	file:///home/rai/dev/projects/personal/Factorio-RecipeBook
[10:41:20.584][info] [#0:script.workspace.workspace:38]: Log path: 	/home/rai/dev/langservers/sumneko-lua/log/file_home_rai_dev_projects_personal_Factorio-RecipeBook.log
[10:41:20.585][warn] [#0:script.pub.report:24]: Load proto error:	Disconnected!

To Reproduce
Steps to reproduce the behavior:

  1. Install Kakoune and kak-lsp via the links above
  2. Set up kak-lsp.toml like so (change paths accordingly):
[language.lua]
filetypes = ["lua"]
roots = [".git/"]
command = "/home/rai/dev/langservers/sumneko-lua/bin/lua-language-server"
args = ["-E", "/home/rai/dev/langservers/sumneko-lua/main.lua"]
  1. Open a Lua file in Kakoune and enable the language server with :lsp-enable-window
  2. Observe that nothing happens
  3. Open the log file and observe the error there

Expected behavior
The language server would start up and provide diagnostics.

Screenshots
There should be a syntax error here, but nothing happens:

image

Environment

  • OS: Zorin OS 15 (Ubuntu 18.04)
  • Client: Kakoune with kak-lsp
@sumneko
Copy link
Collaborator

sumneko commented Mar 25, 2021

LSP requires the client to open the standard input and standard output of the server for data exchange. From the log, the standard input was closed for some reason. The server recorded this exception, indicating that the server did not crash at least, so I tended to be a client-side problem.

@sumneko sumneko added the Info Needed More information is required label Mar 25, 2021
@raiguard
Copy link
Author

Alright, thanks, I'll open an issue with kak-lsp. I'll keep this issue open just in case action is needed on this end.

@raiguard
Copy link
Author

raiguard commented Apr 2, 2021

See here. I looked into it myself and came to the same conclusion: the language server is returning a value that is out-of-spec, which is causing kak-lsp to panic. It does the same thing with the args set correctly, as in my first post.

@raiguard
Copy link
Author

raiguard commented Apr 9, 2021

So, any idea why the server would be providing an out-of-spec workspace object?

@raiguard
Copy link
Author

raiguard commented Apr 10, 2021

I looked into it deeper, and it appears that the server is providing an empty array for the workspace field in the ServerCapabilities object. That field should be an object instead, or if it's empty, shouldn't be provided at all. This is why kak-lsp is crashing, because it's simply the incorrect type.

Here is the spec from the LSP page:

/**
 * Workspace specific server capabilities
 */
workspace?: {
    /**
     * The server supports workspace folder.
     *
     * @since 3.6.0
     */
    workspaceFolders?: WorkspaceFoldersServerCapabilities;

    /**
     * The server is interested in file notifications/requests.
     *
     * @since 3.16.0
     */
    fileOperations?: {
        // snip
    }
}

And here is what kak-lsp is receiving:

"workspace": Array([]),

@sumneko sumneko added bug Something isn't working and removed Info Needed More information is required labels Apr 13, 2021
@raiguard
Copy link
Author

Thank you for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants