CoC 不向语言服务器发送自动完成请求消息
CoC not sending autocomplete request message to language server
我的 nvim 自动完成 window 在编辑 C++ 代码时没有出现。
我一直在尝试遵循这个 debugging guideline 但我没有取得太大的成功。我正在使用 coc-settings.json
:
中配置如下的 Kythe 语言服务器
{
"languageserver": {
"kythe": {
"command": "/full/path/omitted/kythe_languageserver",
"filetypes": ["python", "go", "java", "cpp", "cc", "c++", "proto"],
"trace.server" : "verbose"
}
}
}
打开C++文件时运行:CocList services
,可以看到语言服务器已经启动:
languageserver.kythe [running] python, go, java, cpp, cc, c++, proto
确实在 :CocCommand workspace.showOutput
中,有消息表明初始化成功:
[Trace - 4:45:05 PM] Received response 'initialize - (0)' in 264ms.
Result: {
"capabilities": {
"textDocumentSync": 1,
"hoverProvider": true,
"definitionProvider": true,
"referencesProvider": true
}
}
一个想法,这里是否缺少自动完成所需的功能?在任何情况下,当我编辑文件并尝试输入 std::
期望该命名空间的某种形式的自动完成时,没有任何反应,发送到语言服务器的唯一消息似乎如下:
[Trace - 4:45:47 PM] Sending notification 'textDocument/didChange'.
Params: {
"textDocument": {
"uri": "[redacted]",
"version": 4
},
"contentChanges": [
{
"text": "[redacted]"
}
]
}
以我有限的知识,我很确定自动完成也需要将不同的消息类型发送到语言服务器,不是吗? textDocument/didChange
好像只能更新状态。
编辑: nvim 请求的全套功能:
"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
]
}
},
"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
},
"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
}
}
},
"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,
"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
}
},
"window": {
"workDoneProgress": true
}
},
Kythe 语言服务器目前还不支持自动完成功能。
我的 nvim 自动完成 window 在编辑 C++ 代码时没有出现。
我一直在尝试遵循这个 debugging guideline 但我没有取得太大的成功。我正在使用 coc-settings.json
:
{
"languageserver": {
"kythe": {
"command": "/full/path/omitted/kythe_languageserver",
"filetypes": ["python", "go", "java", "cpp", "cc", "c++", "proto"],
"trace.server" : "verbose"
}
}
}
打开C++文件时运行:CocList services
,可以看到语言服务器已经启动:
languageserver.kythe [running] python, go, java, cpp, cc, c++, proto
确实在 :CocCommand workspace.showOutput
中,有消息表明初始化成功:
[Trace - 4:45:05 PM] Received response 'initialize - (0)' in 264ms.
Result: {
"capabilities": {
"textDocumentSync": 1,
"hoverProvider": true,
"definitionProvider": true,
"referencesProvider": true
}
}
一个想法,这里是否缺少自动完成所需的功能?在任何情况下,当我编辑文件并尝试输入 std::
期望该命名空间的某种形式的自动完成时,没有任何反应,发送到语言服务器的唯一消息似乎如下:
[Trace - 4:45:47 PM] Sending notification 'textDocument/didChange'.
Params: {
"textDocument": {
"uri": "[redacted]",
"version": 4
},
"contentChanges": [
{
"text": "[redacted]"
}
]
}
以我有限的知识,我很确定自动完成也需要将不同的消息类型发送到语言服务器,不是吗? textDocument/didChange
好像只能更新状态。
编辑: nvim 请求的全套功能:
"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
]
}
},
"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
},
"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
}
}
},
"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,
"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
}
},
"window": {
"workDoneProgress": true
}
},
Kythe 语言服务器目前还不支持自动完成功能。