Latest dart-sdk breaks integration with coc-flutter
christopherfujino opened this issue · comments
I don't have time to do a full bisect, but coc-flutter works fine with the Dart SDK from Flutter commit 5acf7e98f1
:
Flutter 2.4.0-5.0.pre.122 • channel flutter-2.4-candidate.7 • git@github.com:flutter/flutter.git
Framework • revision 5acf7e98f1 (3 days ago) • 2021-07-20 19:58:58 -0700
Engine • revision 9b270621e4
Tools • Dart 2.14.0 (build 2.14.0-338.0.dev)
But does not work as of Flutter commit deee99578395497ec0b46db6c6043e6ce81520f5
:
Flutter 2.4.0-5.0.pre.169 • channel master • git@github.com:flutter/flutter.git
Framework • revision aeaadc5691 (2 hours ago) • 2021-07-23 15:28:05 -0400
Engine • revision deee995783
Tools • Dart 2.14.0 (build 2.14.0-346.0.dev)
Here is my :CocInfo
:
undefined## versions
vim version: NVIM v0.4.4
node version: v12.21.0
coc.nvim version: 0.0.80-73861dc2ae
coc.nvim directory: /home/fujino/.config/nvim/plugged/coc.nvim
term: xterm-256color
platform: linux
## Log of coc.nvim
2021-07-23T14:19:42.760 INFO (pid:1040614) [services] - registered service "languageserver.bash"
2021-07-23T14:19:42.761 INFO (pid:1040614) [services] - registered service "languageserver.python"
2021-07-23T14:19:42.761 INFO (pid:1040614) [services] - registered service "languageserver.clangd"
2021-07-23T14:19:42.761 INFO (pid:1040614) [services] - registered service "languageserver.golang"
2021-07-23T14:19:42.761 INFO (pid:1040614) [services] - registered service "languageserver.tsserver"
2021-07-23T14:19:42.762 INFO (pid:1040614) [services] - registered service "languageserver.haskell"
2021-07-23T14:19:42.764 INFO (pid:1040614) [plugin] - coc.nvim 0.0.80-73861dc2ae initialized with node: v12.21.0 after 58ms
2021-07-23T14:19:58.875 INFO (pid:1040614) [services] - registered service "flutter"
2021-07-23T14:19:58.876 INFO (pid:1040614) [services] - flutter analysis server state change: stopped => starting
2021-07-23T14:19:58.882 INFO (pid:1040614) [language-client-index] - Language server "flutter" started with 1040988
2021-07-23T14:19:59.341 INFO (pid:1040614) [services] - flutter analysis server state change: starting => running
2021-07-23T14:19:59.345 INFO (pid:1040614) [services] - service flutter started
2021-07-23T14:20:05.809 INFO (pid:1040614) [attach] - receive notification: showInfo []
2021-07-23T14:20:05.925 INFO (pid:1040614) [attach] - receive notification: doAutocmd [ 1 ]
2021-07-23T14:20:11.149 INFO (pid:1040614) [attach] - receive notification: doAutocmd [ 1 ]
2021-07-23T14:20:16.033 INFO (pid:1040614) [attach] - receive notification: jumpDefinition []
2021-07-23T14:20:16.039 ERROR (pid:1040614) [attach] - Notification error: jumpDefinition [] Error: definition provider not found for current buffer, your language server doesn't support it.
at _D.checkProvier (/home/fujino/.config/nvim/plugged/coc.nvim/build/index.js:253:29464)
at dD.request (/home/fujino/.config/nvim/plugged/coc.nvim/build/index.js:245:1632)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async dD.gotoDefinition (/home/fujino/.config/nvim/plugged/coc.nvim/build/index.js:245:3041)
at async TD.cocAction (/home/fujino/.config/nvim/plugged/coc.nvim/build/index.js:253:42180)
at async _N.<anonymous> (/home/fujino/.config/nvim/plugged/coc.nvim/build/index.js:253:43786)
2021-07-23T14:20:19.808 INFO (pid:1040614) [attach] - receive notification: showInfo []
I am guessing that a change to the Dart LSP server broke this.
I believe the dart diffs between these two commits is: https://github.com/dart-lang/sdk/compare/d65b397fe..5e2a41b0088c0 which has a big diff on the //pkg/analysis_server/lib/src/lsp/client_configuration.dart file
Looks like this diff: dart-lang/sdk@c881935
Could you provide the info requested in the template and define what exactly doesn’t work.
From what you’ve shared so far it looks like the problem is at the dart sdk side. Can you test if you have the same problems in vscode with lsp enabled there.
I'm having the same problem. Most of the lsp functionality does not work, things like hover, go to definition etc.
Commands still work, like flutter.run
etc.
Flutter 2.5.0-5.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 19c61fed0d (35 hours ago) • 2021-08-18 17:10:31 -0700
Engine • revision 7a4c4505f6
Tools • Dart 2.14.0 (build 2.14.0-377.7.beta)
- ✓ coc-flutter Current version 1.9.4 is up to date.
## versions
vim version: NVIM v0.6.0-dev+163-g599af7451
node version: v16.6.2
coc.nvim version: 0.0.80-6b774412d1
coc.nvim directory: /home/nohac/.config/nvim/plug.vim/coc.nvim
term: xterm-kitty
platform: linux
## Log of coc.nvim
2021-08-20T13:12:08.491 INFO (pid:156043) [extensions] - Skipped load vim plugin from "/home/nohac/.config/nvim/plug.vim/coc-tsserver", "coc-tsserver" already global extension.
2021-08-20T13:12:08.493 INFO (pid:156043) [extensions] - Skipped load vim plugin from "/home/nohac/.config/nvim/plug.vim/coc-marketplace", "coc-marketplace" already global extension.
2021-08-20T13:12:08.545 INFO (pid:156043) [services] - registered service "languageserver.clangd"
2021-08-20T13:12:08.545 INFO (pid:156043) [services] - registered service "languageserver.godot"
2021-08-20T13:12:08.568 INFO (pid:156043) [services] - registered service "diagnostic-languageserver"
2021-08-20T13:12:08.703 INFO (pid:156043) [plugin] - coc.nvim 0.0.80-6b774412d1 initialized with node: v16.6.2 after 244ms
2021-08-20T13:12:08.871 INFO (pid:156043) [watchman] - watchman watching project: /home/nohac/Dev/Flutter/testproject
2021-08-20T13:12:11.563 WARN (pid:156043) [completion] - Document not attached, suggest disabled.
2021-08-20T13:12:11.730 WARN (pid:156043) [completion] - Document not attached, suggest disabled.
2021-08-20T13:12:12.318 INFO (pid:156043) [services] - registered service "flutter"
2021-08-20T13:12:12.319 INFO (pid:156043) [services] - flutter analysis server state change: stopped => starting
2021-08-20T13:12:12.324 INFO (pid:156043) [language-client-index] - Language server "flutter" started with 156093
2021-08-20T13:12:12.675 INFO (pid:156043) [services] - flutter analysis server state change: starting => running
2021-08-20T13:12:12.678 INFO (pid:156043) [services] - service flutter started
2021-08-20T13:12:12.874 INFO (pid:156043) [attach] - receive notification: doAutocmd [ 1 ]
2021-08-20T13:12:17.994 INFO (pid:156043) [attach] - receive notification: highlight []
2021-08-20T13:12:18.787 INFO (pid:156043) [attach] - receive notification: doHover []
2021-08-20T13:12:18.791 ERROR (pid:156043) [attach] - Notification error: doHover [] Error: hover provider not found for current buffer, your language server doesn't support it.
at Nx.checkProvier (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:38243)
at bx.onHover (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:252:724)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async qx.cocAction (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:51172)
at async kN.<anonymous> (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:52778)
2021-08-20T13:12:19.093 INFO (pid:156043) [attach] - receive notification: highlight []
2021-08-20T13:12:21.559 INFO (pid:156043) [attach] - receive notification: showInfo []
I tested vscode and it works as expected.
I'm pretty sure vscode is fine, because the commit I bisected this to was authored by the maintainer of the dart-code vscode plugin.
I didn't follow up here because while trying to debug it, the plugin started working for me, and I couldn't reproduce the bug :/
@Nohac could you provide the flutter output:
- Set
"flutter.trace.server": "verbose"
- Restart coc using
:CocRestart
- Reproduce the issue
:CocCommand workspace.showOutput
open output list and selectflutter
@christopherfujino Strange, this is only an issue for me on my laptop, it works fine on my desktop (last I checked). I might try to reinstall coc and flutter completely and see if that helps.
[dev-command]: register dev command
[sdk]: No local fvm sdk
[sdk]: which flutter command => /usr/bin/flutter
[sdk]: /opt/flutter/version => 2.5.0-5.2.pre
[sdk]: searchPaths: ~/snap/flutter/common/flutter
[sdk]: flutter command path => /opt/flutter/bin/flutter
[sdk]: dart sdk home => /opt/flutter/bin/cache/dart-sdk
[sdk]: analyzer path => /opt/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot
[sdk]: dart command path => /opt/flutter/bin/cache/dart-sdk/bin/dart
[fs]: executing command /opt/flutter/bin/cache/dart-sdk/bin/dart --version
[sdk]: dart version: v2.14.0
[lsp-server]: rightVersion true
[lsp-server]: analysis server ready!
[lsp-closing-labels]: register closing labels
[daemon]: got message: {
"event": "daemon.connected",
"params": {
"version": "0.6.1",
"pid": 175204
}
}
[daemon]: got message: {
"event": "daemon.logMessage",
"params": {
"level": "status",
"message": "Starting device daemon..."
}
}
[daemon]: got message: {
"id": 1
}
[daemon]: Message without event
[daemon]: got message: {
"event": "device.added",
"params": {
"id": "linux",
"name": "Linux",
"platform": "linux-x64",
"emulator": false,
"category": "desktop",
"platformType": "linux",
"ephemeral": false,
"emulatorId": null
}
}
[daemon]: New device: Linux
Is there any update on this? I have the same issue with Dart SDK version 2.13.4 (stable) and flutter 2.5.0-6.0.pre (dev) under linux as well as windows.
I'm having the same problem here. Reinstalling coc and coc-flutter (using vim-plug) didn't help.
oh, apparently this didn't fix itself, it looks like I just bypassed coc-flutter and directly added the analysis_server to my coc-settings.json
.
When I was chatting with Danny Tuppeny (author of dart-lang/sdk@c881935), he suggested:
If you run the server with
--instrumentation-log-file=/foo/log.txt
it will capture all of the LSP traffic, although I'm not sure if that'll give the answers if this is something happening on the client.
If someone can reproduce it with that log file that may help us figure out what's going wrong.
I managed to capture some lsp log, not sure if this is what you're after because I don't know where to add lsp flags, I just turned on lsp debug mode by setting flutter.lsp.debug: true
in CocConfig
.
LSP debug log
[Trace - 10:27:31 PM] Sending request 'initialize - (0)'.
Params: {
"processId": 233984,
"rootPath": "/home/nohac/Dev/Flutter/testproject",
"rootUri": "file:///home/nohac/Dev/Flutter/testproject",
"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
]
},
"tagSupport": {
"valueSet": [
1
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": 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,
"insertReplaceSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"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
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"contextSupport": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"activeParameterSupport": true,
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"definition": {
"dynamicRegistration": 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,
"tagSupport": {
"valueSet": [
1
]
}
},
"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
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true
},
"implementation": {
"dynamicRegistration": true
},
"declaration": {
"dynamicRegistration": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"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",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": false
}
},
"showDocument": {
"support": false
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
}
}
},
"initializationOptions": {
"onlyAnalyzeProjectsWithOpenFiles": true,
"suggestFromUnimportedLibraries": true,
"closingLabels": true
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/nohac/Dev/Flutter/testproject",
"name": "testproject"
}
],
"locale": "en_US",
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.80"
}
}
[Trace - 10:27:32 PM] Received response 'initialize - (0)' in 475ms.
Result: {
"capabilities": {
"executeCommandProvider": {
"commands": [
"edit.sortMembers",
"edit.organizeImports",
"edit.fixAll",
"edit.sendWorkspaceEdit",
"refactor.perform"
],
"workDoneProgress": true
},
"workspaceSymbolProvider": true,
"workspace": {
"workspaceFolders": {
"supported": true,
"changeNotifications": true
}
}
},
"serverInfo": {
"name": "Dart SDK LSP Analysis Server",
"version": "2.14.0-377.4.beta"
}
}
[Trace - 10:27:32 PM] Sending notification 'initialized'.
Params: {}
One thing I noticed in the log is that the initialization
response is very short and lacks a lot of the capabilities that was requested, which I assume coc uses to enable different features (if I'm understanding this correctly).
I managed to capture some lsp log, not sure if this is what you're after because I don't know where to add lsp flags, I just turned on lsp debug mode by setting
flutter.lsp.debug: true
inCocConfig
.LSP debug log
[Trace - 10:27:31 PM] Sending request 'initialize - (0)'. Params: { "processId": 233984, "rootPath": "/home/nohac/Dev/Flutter/testproject", "rootUri": "file:///home/nohac/Dev/Flutter/testproject", "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 ] }, "tagSupport": { "valueSet": [ 1 ] } }, "codeLens": { "refreshSupport": true }, "executeCommand": { "dynamicRegistration": true }, "configuration": true, "semanticTokens": { "refreshSupport": true }, "fileOperations": { "dynamicRegistration": true, "didCreate": true, "didRename": true, "didDelete": true, "willCreate": true, "willRename": true, "willDelete": 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, "insertReplaceSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "resolveSupport": { "properties": [ "documentation", "detail", "additionalTextEdits" ] }, "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 ] } }, "hover": { "dynamicRegistration": true, "contentFormat": [ "markdown", "plaintext" ] }, "signatureHelp": { "dynamicRegistration": true, "contextSupport": true, "signatureInformation": { "documentationFormat": [ "markdown", "plaintext" ], "activeParameterSupport": true, "parameterInformation": { "labelOffsetSupport": true } } }, "definition": { "dynamicRegistration": 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, "tagSupport": { "valueSet": [ 1 ] } }, "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 }, "documentLink": { "dynamicRegistration": true, "tooltipSupport": true }, "typeDefinition": { "dynamicRegistration": true }, "implementation": { "dynamicRegistration": true }, "declaration": { "dynamicRegistration": true }, "colorProvider": { "dynamicRegistration": true }, "foldingRange": { "dynamicRegistration": true, "rangeLimit": 5000, "lineFoldingOnly": true }, "selectionRange": { "dynamicRegistration": true }, "callHierarchy": { "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", "operator" ], "tokenModifiers": [ "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" ], "formats": [ "relative" ], "requests": { "range": true, "full": { "delta": true } }, "multilineTokenSupport": false, "overlappingTokenSupport": false }, "linkedEditingRange": { "dynamicRegistration": true } }, "window": { "showMessage": { "messageActionItem": { "additionalPropertiesSupport": false } }, "showDocument": { "support": false }, "workDoneProgress": true }, "general": { "regularExpressions": { "engine": "ECMAScript", "version": "ES2020" }, "markdown": { "parser": "marked", "version": "1.1.0" } } }, "initializationOptions": { "onlyAnalyzeProjectsWithOpenFiles": true, "suggestFromUnimportedLibraries": true, "closingLabels": true }, "trace": "verbose", "workspaceFolders": [ { "uri": "file:///home/nohac/Dev/Flutter/testproject", "name": "testproject" } ], "locale": "en_US", "clientInfo": { "name": "coc.nvim", "version": "0.0.80" } } [Trace - 10:27:32 PM] Received response 'initialize - (0)' in 475ms. Result: { "capabilities": { "executeCommandProvider": { "commands": [ "edit.sortMembers", "edit.organizeImports", "edit.fixAll", "edit.sendWorkspaceEdit", "refactor.perform" ], "workDoneProgress": true }, "workspaceSymbolProvider": true, "workspace": { "workspaceFolders": { "supported": true, "changeNotifications": true } } }, "serverInfo": { "name": "Dart SDK LSP Analysis Server", "version": "2.14.0-377.4.beta" } } [Trace - 10:27:32 PM] Sending notification 'initialized'. Params: {}
One thing I noticed in the log is that the
initialization
response is very short and lacks a lot of the capabilities that was requested, which I assume coc uses to enable different features (if I'm understanding this correctly).
can you get the logs when you actually hit the error?
That is the log where I get the error. I believe the issue is that the lsp server does not report back hover capabilities (or any other capability), so when I try to activate hover to get some documentation, nothing gets sent to the server because coc believes that the server does not support it and responds with this error:
2021-08-27T22:27:44.228 ERROR (pid:233984) [attach] - Notification error: doHover [] Error: hover provider not found for current buffer, your language server doesn't support it.
at Nx.checkProvier (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:38243)
at bx.onHover (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:252:724)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async qx.cocAction (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:51172)
at async kN.<anonymous> (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:52778)
I could also be totally wrong, of course.
That is the log where I get the error. I believe the issue is that the lsp server does not report back hover capabilities (or any other capability), so when I try to activate hover to get some documentation, nothing gets sent to the server because coc believes that the server does not support it and responds with this error:
2021-08-27T22:27:44.228 ERROR (pid:233984) [attach] - Notification error: doHover [] Error: hover provider not found for current buffer, your language server doesn't support it. at Nx.checkProvier (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:38243) at bx.onHover (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:252:724) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async qx.cocAction (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:51172) at async kN.<anonymous> (/home/nohac/.config/nvim/plug.vim/coc.nvim/build/index.js:262:52778)
I could also be totally wrong, of course.
ahh, I see
@christopherfujino could you please post your coc-settings.json?
@christopherfujino could you please post your coc-settings.json?
Here's the relevant part of coc-settings.json (to clarify, this is my setup that circumvents coc-flutter and works):
"dart": {
"command": "dart-analysis-server.sh",
"filetypes": ["dart"]
},
and then dart-analysis-server.sh is:
#!/bin/bash
# I explicitly set $DART_SDK to point inside my flutter checkout
if [ -z "$DART_SDK" ]; then
echo "Env var \$DART_SDK is not set!"
exit 1
fi
"$DART_SDK/bin/dart" "$DART_SDK/bin/snapshots/analysis_server.dart.snapshot" --lsp
I believe I stumbled on this issue yesterday, when I updated to the latest flutter beta channel (2.5.0-5.2.pre) most of the integration stop working. I still get some information on the status line about the line I have the cursor, but that is it, autocomplete, code actions, nothing else works.
This is my vim config file: https://github.com/erickzanardo/dotfiles/blob/master/init.vim, I don't have any custom coc config.
@christopherfujino could you please post your coc-settings.json?
Here's the relevant part of coc-settings.json (to clarify, this is my setup that circumvents coc-flutter and works):
"dart": { "command": "dart-analysis-server.sh", "filetypes": ["dart"] },
and then dart-analysis-server.sh is:
#!/bin/bash # I explicitly set $DART_SDK to point inside my flutter checkout if [ -z "$DART_SDK" ]; then echo "Env var \$DART_SDK is not set!" exit 1 fi "$DART_SDK/bin/dart" "$DART_SDK/bin/snapshots/analysis_server.dart.snapshot" --lsp
It works as a charm. I've spent my whole day figuring out what's happened after upgraded the flutter sdk yesterday.
By reading through services.ts#L430, you could find that when defining lsp server within lanuageserver
section of coc-settings.json
, coc.nvim
would generate client options without any initialization settings.
Then I continued to test all initialization options that coc-flutter
supports currently. It turns out that the flutter.lsp.initialization.onlyAnalyzeProjectsWithOpenFiles
causes the integration broken. Hence set this option to false
in your coc-settings.json
should address the issue.
In short, here is my solution for this. In you coc-settings.json
:
"flutter.lsp.initialization.onlyAnalyzeProjectsWithOpenFiles": false,
BTW, The coc-flutter
set onlyAnalyzeProjectsWithOpenFiles
default to true
which is opposite to the default value of the analysis_server#initialization-options.
This seems to be happening again on the latest beta channel. I am unsure if the cause is the same, but the symptoms are, is anyone facing this too?
Flutter 2.8.0-3.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 2901cd7208 (5 days ago) • 2021-11-18 11:15:09 -0800
Engine • revision bcc2b7f12c
Tools • Dart 2.15.0 (build 2.15.0-268.18.beta)