neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.49k stars 958 forks source link

workspace/configuration replies with null for dotted configuration options #4888

Closed lf- closed 9 months ago

lf- commented 9 months ago

Result from CocInfo

## versions

vim version: NVIM v0.10.0-dev-1254+g386bc23e43
node version: v21.6.1
coc.nvim version: 0.0.82-master
coc.nvim directory: /home/jade/dev/coc.nvim
term: alacritty
platform: linux

## Log of coc.nvim

2024-02-05T21:55:08.846 INFO (pid:2939807) [plugin] - coc.nvim initialized with node: v21.6.1 after 1223
2024-02-05T21:55:08.850 INFO (pid:2939807) [services] - LanguageClient haskell state change: stopped => starting
2024-02-05T21:55:08.863 INFO (pid:2939807) [language-client-index] - Language server "languageserver.haskell" started with 2939824
2024-02-05T21:55:08.901 INFO (pid:2939807) [core-watchman] - watchman watching project: /home/jade/.dotfiles/programs/hsutils
2024-02-05T21:55:12.033 INFO (pid:2939807) [services] - LanguageClient haskell state change: starting => running
2024-02-05T21:55:12.039 INFO (pid:2939807) [services] - service languageserver.haskell started

Describe the bug

Might be a regression of https://github.com/neoclide/coc.nvim/issues/3486

With this configuration:

{
  "languageserver": {
    "haskell": {
      "command": "direnv-hls",
      "args": ["--lsp"],
      "rootPatterns": [
        "*.cabal",
        "stack.yaml",
        "cabal.project",
        "package.yaml",
        "hie.yaml"
      ],
      "filetypes": ["haskell", "lhaskell"],
      "settings": {
        "haskell.formattingProvider": "fourmolu"
      },
      "trace.server": "verbose",
      "trace.server.verbosity": "verbose"
    }
  }
}

When the language server sends a workspace/configuration message as follows, it gets a null response:

[Trace - 21:51:39.423] Received request 'workspace/configuration - (0)'.
Params: {
    "items": [
        {
            "section": "haskell"
        }
    ]
}

[Trace - 21:51:39.423] Sending response 'workspace/configuration - (0)'. Processing request took 0ms
Result: [
    null
]

However, if the configuration is specified as nested, it gets a response. That is, with this config:

{
  "languageserver": {
    "haskell": {
      "command": "direnv-hls",
      "args": ["--lsp"],
      "rootPatterns": [
        "*.cabal",
        "stack.yaml",
        "cabal.project",
        "package.yaml",
        "hie.yaml"
      ],
      "filetypes": ["haskell", "lhaskell"],
      "settings": {
        "haskell": {"formattingProvider": "fourmolu" }
      },
      "trace.server": "verbose",
      "trace.server.verbosity": "verbose"
    }
  }
}

It returns the correct response:

[Trace - 21:55:12.040] Received request 'workspace/configuration - (0)'.
Params: {
    "items": [
        {
            "section": "haskell"
        }
    ]
}

[Trace - 21:55:12.041] Sending response 'workspace/configuration - (0)'. Processing request took 1ms
Result: [
    {
        "formattingProvider": "fourmolu"
    }
]
Full trace ``` [Trace - 21:51:36.289] Sending request 'initialize - (0)'. Params: { "processId": 2939232, "rootPath": "/home/jade/.dotfiles/programs/hsutils", "rootUri": "file:///home/jade/.dotfiles/programs/hsutils", "capabilities": { "workspace": { "applyEdit": true, "workspaceEdit": { "documentChanges": true, "resourceOperations": [ "create", "rename", "delete" ], "failureHandling": "undo", "normalizesLineEndings": true, "changeAnnotationSupport": { "groupsOnLabel": false } }, "didChangeConfiguration": { "dynamicRegistration": true }, "didChangeWatchedFiles": { "dynamicRegistration": true, "relativePatternSupport": true }, "codeLens": { "refreshSupport": true }, "executeCommand": { "dynamicRegistration": true }, "configuration": true, "fileOperations": { "dynamicRegistration": true, "didCreate": true, "didRename": true, "didDelete": true, "willCreate": true, "willRename": true, "willDelete": true }, "semanticTokens": { "refreshSupport": true }, "inlayHint": { "refreshSupport": true }, "inlineValue": { "refreshSupport": true }, "diagnostics": { "refreshSupport": 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 ] }, "tagSupport": { "valueSet": [ 1 ] }, "resolveSupport": { "properties": [ "location.range" ] } }, "workspaceFolders": true }, "textDocument": { "publishDiagnostics": { "relatedInformation": true, "versionSupport": true, "tagSupport": { "valueSet": [ 1, 2 ] }, "codeDescriptionSupport": true, "dataSupport": true }, "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, "insertReplaceSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "resolveSupport": { "properties": [ "documentation", "detail", "additionalTextEdits" ] }, "labelDetailsSupport": true, "insertTextModeSupport": { "valueSet": [ 1, 2 ] } }, "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 ] }, "insertTextMode": 2, "completionList": { "itemDefaults": [ "commitCharacters", "editRange", "insertTextFormat", "insertTextMode" ] } }, "hover": { "dynamicRegistration": true, "contentFormat": [ "markdown", "plaintext" ] }, "signatureHelp": { "dynamicRegistration": true, "contextSupport": true, "signatureInformation": { "documentationFormat": [ "markdown", "plaintext" ], "activeParameterSupport": true, "parameterInformation": { "labelOffsetSupport": true } } }, "references": { "dynamicRegistration": true }, "definition": { "dynamicRegistration": true, "linkSupport": 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, "tagSupport": { "valueSet": [ 1 ] }, "labelSupport": true }, "codeAction": { "dynamicRegistration": true, "isPreferredSupport": true, "disabledSupport": true, "dataSupport": true, "honorsChangeAnnotations": false, "resolveSupport": { "properties": [ "edit" ] }, "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, "honorsChangeAnnotations": true, "prepareSupportDefaultBehavior": 1 }, "documentLink": { "dynamicRegistration": true, "tooltipSupport": true }, "typeDefinition": { "dynamicRegistration": true, "linkSupport": true }, "implementation": { "dynamicRegistration": true, "linkSupport": true }, "declaration": { "dynamicRegistration": true, "linkSupport": true }, "colorProvider": { "dynamicRegistration": true }, "foldingRange": { "dynamicRegistration": true, "rangeLimit": 5000, "lineFoldingOnly": true, "foldingRangeKind": { "valueSet": [ "comment", "imports", "region" ] }, "foldingRange": { "collapsedText": false } }, "selectionRange": { "dynamicRegistration": true }, "callHierarchy": { "dynamicRegistration": true }, "linkedEditingRange": { "dynamicRegistration": true }, "semanticTokens": { "dynamicRegistration": true, "tokenTypes": [ "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "decorator", "operator" ], "tokenModifiers": [ "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" ], "formats": [ "relative" ], "requests": { "range": true, "full": { "delta": true } }, "multilineTokenSupport": false, "overlappingTokenSupport": false, "serverCancelSupport": true, "augmentsSyntaxTokens": true }, "inlayHint": { "dynamicRegistration": true, "resolveSupport": { "properties": [ "tooltip", "textEdits", "label.tooltip", "label.location", "label.command" ] } }, "inlineValue": { "dynamicRegistration": true }, "diagnostic": { "dynamicRegistration": true, "relatedDocumentSupport": true }, "typeHierarchy": { "dynamicRegistration": true } }, "window": { "showMessage": { "messageActionItem": { "additionalPropertiesSupport": true } }, "showDocument": { "support": true }, "workDoneProgress": true }, "general": { "regularExpressions": { "engine": "ECMAScript", "version": "ES2020" }, "markdown": { "parser": "marked", "version": "4.0.10" }, "positionEncodings": [ "utf-16" ], "staleRequestSupport": { "cancel": true, "retryOnContentModified": [ "textDocument/inlayHint", "textDocument/semanticTokens/full", "textDocument/semanticTokens/range", "textDocument/semanticTokens/full/delta" ] } } }, "initializationOptions": {}, "trace": "verbose", "workspaceFolders": [ { "uri": "file:///home/jade/.dotfiles/programs/hsutils", "name": "hsutils" } ], "locale": "en_US", "clientInfo": { "name": "coc.nvim", "version": "0.0.82" } } direnv: loading ~/.dotfiles/programs/hsutils/.envrc direnv: using flake direnv: nix-direnv: using cached dev shell 2024-02-06T05:51:38.835561Z | Info | haskell-language-server version: 2.2.0.0 (GHC: 9.4.6) (PATH: /nix/store/3p5n7qndndl0w4ii4n6s7b1q88n21dm6-haskell-language-server-2.2.0.0/bin/.haskell-language-server-9.4.6-unwrapped) 2024-02-06T05:51:38.836556Z | Info | Directory: /home/jade/.dotfiles/programs/hsutils 2024-02-06T05:51:38.836856Z | Info | Starting (haskell-language-server) LSP server... GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsLogLevel = Info, argsLogFile = Nothing, argsLogStderr = True, argsLogClient = False, argsThreads = 0, argsProjectGhcVersion = False} PluginIds: [ pragmas-suggest , pragmas-completion , retrie , ghcide-completions , alternateNumberFormat , ghcide-code-actions-bindings , explicit-fields , ghcide-hover-and-symbols , ghcide-code-actions-type-signatures , floskell , fourmolu , ghcide-extend-import-action , ghcide-code-actions-fill-holes , importLens , LSPRecorderCallback , cabal , qualifyImportedNames , moduleName , splice , stylish-haskell , changeTypeSignature , hlint , class , ormolu , callHierarchy , ghcide-type-lenses , codeRange , cabal-fmt , eval , rename , ghcide-code-actions-imports-exports , gadt , overloaded-record-dot , ghcide-core , explicit-fixity , pragmas-disable ] 2024-02-06T05:51:38.842795Z | Info | Logging heap statistics every 60.00s 2024-02-06T05:51:38.865559Z | Info | Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! PluginIds: [ pragmas-suggest , pragmas-completion , retrie , ghcide-completions , alternateNumberFormat , ghcide-code-actions-bindings , explicit-fields , ghcide-hover-and-symbols , ghcide-code-actions-type-signatures , floskell , fourmolu , ghcide-extend-import-action , ghcide-code-actions-fill-holes , importLens , LSPRecorderCallback , cabal , qualifyImportedNames , moduleName , splice , stylish-haskell , changeTypeSignature , hlint , class , ormolu , callHierarchy , ghcide-type-lenses , codeRange , cabal-fmt , eval , rename , ghcide-code-actions-imports-exports , gadt , overloaded-record-dot , ghcide-core , explicit-fixity , pragmas-disable ] 2024-02-06T05:51:38.866096Z | Info | Starting server 2024-02-06T05:51:38.868100Z | Info | Started LSP server in 0.00s 2024-02-06T05:51:39.416643Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 7241043049818229998 "file:///home/jade/.dotfiles/programs/hsutils"], clientSettings = hashed (Just (Object (fromList [])))} [Trace - 21:51:39.418] Received response 'initialize - (0)' in 3129ms. Result: { "capabilities": { "callHierarchyProvider": true, "codeActionProvider": { "resolveProvider": true }, "codeLensProvider": { "resolveProvider": true, "workDoneProgress": false }, "colorProvider": false, "completionProvider": { "resolveProvider": true, "triggerCharacters": [ "." ] }, "declarationProvider": false, "definitionProvider": true, "documentFormattingProvider": true, "documentHighlightProvider": true, "documentRangeFormattingProvider": true, "documentSymbolProvider": true, "executeCommandProvider": { "commands": [ "2939250:retrie:retrieCommand", "2939250:retrie:retrieInlineThisCommand", "2939250:explicit-fields:codeActionResolve", "2939250:ghcide-extend-import-action:extendImport", "2939250:importLens:ImportLensCommand", "2939250:moduleName:updateModuleName", "2939250:splice:expandTHSpliceInplace", "2939250:hlint:codeActionResolve", "2939250:class:classplugin.codeaction", "2939250:class:classplugin.typelens", "2939250:ghcide-type-lenses:typesignature.add", "2939250:eval:evalCommand", "2939250:gadt:GADT.toGADT" ] }, "foldingRangeProvider": true, "hoverProvider": true, "implementationProvider": false, "referencesProvider": true, "renameProvider": true, "selectionRangeProvider": true, "semanticTokensProvider": { "legend": { "tokenModifiers": [ "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" ], "tokenTypes": [ "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" ] } }, "textDocumentSync": { "change": 2, "openClose": true, "save": {} }, "typeDefinitionProvider": true, "workspace": { "workspaceFolders": { "changeNotifications": true, "supported": true } }, "workspaceSymbolProvider": true } } [Trace - 21:51:39.418] Sending notification 'initialized'. Params: {} [Trace - 21:51:39.422] Sending notification 'workspace/didChangeConfiguration'. Params: { "settings": { "haskell": { "formattingProvider": "fourmolu" } } } [Trace - 21:51:39.422] Sending notification 'textDocument/didOpen'. Params: { "textDocument": { "uri": "file:///home/jade/.dotfiles/programs/hsutils/src/Ghci.hs", "languageId": "haskell", "version": 1, "text": "SNIP" } } [Trace - 21:51:39.423] Received request 'workspace/configuration - (0)'. Params: { "items": [ { "section": "haskell" } ] } [Trace - 21:51:39.423] Sending response 'workspace/configuration - (0)'. Processing request took 0ms Result: [ null ] ```

Reproduce the bug

vimrc:

set nocompatible
set runtimepath^=/home/jade/.local/share/nvim/site/pack/packer/start/coc.nvim
filetype plugin indent on
syntax on
set hidden

and run neovim with nvim --clean -u minimalrc.vim src/Somefile.hs.

n.b. direnv-hls is a direnv wrapper thingy around haskell-language-server and is completely inert otherwise.

Screenshots (optional)

If applicable, add screenshots to help explain your problem.

fannheyward commented 9 months ago

Reproduced.