Skip to content

Failed to initialize lsp server in vscode #2068

Closed
haskell/vscode-haskell
#424
@berberman

Description

@berberman

Your environment

HLS master, lsp 1.2.0.1

Which OS do you use:

NixOS

Which lsp-client do you use:

vscode 1.58.2

Describe your project (alternative: link to the project):

HLS

Actual behaviour

The server failed immediately because the field InitializeParams.capabilities.textDocument.semanticTokens.requests in initialize message was missing.

ghcide version: 1.4.1.0 (GHC: 8.10) (PATH: /home/berberman/.cabal/store/ghc-8.10.4/ghcide-1.4.1.0-e-ghcide-1f4fb458a9e7a7dd7b14385ee9c32f5bd3b0d484100205ce3cbeb2ffd99c7ebb/bin/ghcide)
 Starting LSP server...
If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
Got error while decoding initialize:
Error in $.params.capabilities.textDocument.semanticTokens: When parsing the record SemanticTokensClientCapabilities of type Language.LSP.Types.SemanticTokens.SemanticTokensClientCapabilities the key requests was not present.
 exiting 1 ...

Include debug information

The initialize request sent from my vscode client:

{
   "jsonrpc":"2.0",
   "id":0,
   "method":"initialize",
   "params":{
      "processId":111250,
      "clientInfo":{
         "name":"vscode",
         "version":"1.58.2"
      },
      "rootPath":"/home/berberman/Desktop/haskell/haskell-language-server",
      "rootUri":"file:///home/berberman/Desktop/haskell/haskell-language-server",
      "capabilities":{
         "workspace":{
            "applyEdit":true,
            "workspaceEdit":{
               "documentChanges":true,
               "resourceOperations":[
                  "create",
                  "rename",
                  "delete"
               ],
               "failureHandling":"textOnlyTransactional"
            },
            "didChangeConfiguration":{
               "dynamicRegistration":true
            },
            "didChangeWatchedFiles":{
               "dynamicRegistration":true
            },
            "symbol":{
               "dynamicRegistration":true,
               "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
                  ]
               }
            },
            "executeCommand":{
               "dynamicRegistration":true
            },
            "configuration":true,
            "workspaceFolders":true
         },
         "textDocument":{
            "publishDiagnostics":{
               "relatedInformation":true,
               "versionSupport":false,
               "tagSupport":{
                  "valueSet":[
                     1,
                     2
                  ]
               }
            },
            "synchronization":{
               "dynamicRegistration":true,
               "willSave":true,
               "willSaveWaitUntil":true,
               "didSave":true
            },
            "completion":{
               "dynamicRegistration":true,
               "contextSupport":true,
               "completionItem":{
                  "snippetSupport":true,
                  "commitCharactersSupport":true,
                  "documentationFormat":[
                     "markdown",
                     "plaintext"
                  ],
                  "deprecatedSupport":true,
                  "preselectSupport":true,
                  "tagSupport":{
                     "valueSet":[
                        1
                     ]
                  }
               },
               "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
                  ]
               }
            },
            "hover":{
               "dynamicRegistration":true,
               "contentFormat":[
                  "markdown",
                  "plaintext"
               ]
            },
            "signatureHelp":{
               "dynamicRegistration":true,
               "signatureInformation":{
                  "documentationFormat":[
                     "markdown",
                     "plaintext"
                  ],
                  "parameterInformation":{
                     "labelOffsetSupport":true
                  }
               },
               "contextSupport":true
            },
            "definition":{
               "dynamicRegistration":true,
               "linkSupport":true
            },
            "references":{
               "dynamicRegistration":true
            },
            "documentHighlight":{
               "dynamicRegistration":true
            },
            "documentSymbol":{
               "dynamicRegistration":true,
               "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
                  ]
               },
               "hierarchicalDocumentSymbolSupport":true
            },
            "codeAction":{
               "dynamicRegistration":true,
               "isPreferredSupport":true,
               "codeActionLiteralSupport":{
                  "codeActionKind":{
                     "valueSet":[
                        "",
                        "quickfix",
                        "refactor",
                        "refactor.extract",
                        "refactor.inline",
                        "refactor.rewrite",
                        "source",
                        "source.organizeImports"
                     ]
                  }
               }
            },
            "codeLens":{
               "dynamicRegistration":true
            },
            "formatting":{
               "dynamicRegistration":true
            },
            "rangeFormatting":{
               "dynamicRegistration":true
            },
            "onTypeFormatting":{
               "dynamicRegistration":true
            },
            "rename":{
               "dynamicRegistration":true,
               "prepareSupport":true
            },
            "documentLink":{
               "dynamicRegistration":true,
               "tooltipSupport":true
            },
            "typeDefinition":{
               "dynamicRegistration":true,
               "linkSupport":true
            },
            "implementation":{
               "dynamicRegistration":true,
               "linkSupport":true
            },
            "colorProvider":{
               "dynamicRegistration":true
            },
            "foldingRange":{
               "dynamicRegistration":true,
               "rangeLimit":5000,
               "lineFoldingOnly":true
            },
            "declaration":{
               "dynamicRegistration":true,
               "linkSupport":true
            },
            "selectionRange":{
               "dynamicRegistration":true
            },
            "callHierarchy":{
               "dynamicRegistration":true
            },
            "semanticTokens":{
               "dynamicRegistration":true,
               "tokenTypes":[
                  "comment",
                  "keyword",
                  "number",
                  "regexp",
                  "operator",
                  "namespace",
                  "type",
                  "struct",
                  "class",
                  "interface",
                  "enum",
                  "typeParameter",
                  "function",
                  "member",
                  "macro",
                  "variable",
                  "parameter",
                  "property",
                  "label"
               ],
               "tokenModifiers":[
                  "declaration",
                  "documentation",
                  "static",
                  "abstract",
                  "deprecated",
                  "async",
                  "readonly"
               ]
            }
         },
         "window":{
            "workDoneProgress":true
         }
      },
      "trace":"off",
      "workspaceFolders":[
         {
            "uri":"file:///home/berberman/Desktop/haskell/haskell-language-server",
            "name":"haskell-language-server"
         }
      ]
   }
}

According to the lsp specification (https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#semanticTokensClientCapabilities), this field is not optional, but it's clear that vscode didn't send this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: lspstatus: needs infoNot actionable, because there's missing informationtype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions