-
Notifications
You must be signed in to change notification settings - Fork 59
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
vim.buf.lsp.hover
don't have any syntax highlight for C file
#1943
Comments
Please attach logs, they will show whether the server is sending markdown or not. |
lsp.log |
lsp.log |
vim.buf.lsp.hover
don't have any syntax highlight for C file
gently ping @HighCommander4 |
I'm sorry, but it's not reasonable to expect a 3-hour turnaround time to questions. I'll take a look when I get a chance. (I often respond within 1 day, but no guarantees.) |
What I'm seeing in the log is:
Therefore, this is an issue on the client side. Please file it in your client's issue tracker. |
wait, if so how can the Lua one working fine, if the problem is the client, the Lua should not work properly too right? |
I'm not sure how the client decides what to put into the client capabilities. Maybe it's reporting different capabilities to different servers? To be more specific about what the client should be doing: the relevant line from the log is this one, which shows the
Formatting the JSON content of that message for readability, it's: {
"id": 1,
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"capabilities": {
"1": {
"textDocument": {
"completion": {
"completionItem": {
"commitCharactersSupport": true,
"deprecatedSupport": true,
"insertReplaceSupport": true,
"insertTextModeSupport": {
"valueSet": [
1,
2
]
},
"labelDetailsSupport": true,
"preselectSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits",
"sortText",
"filterText",
"insertText",
"textEdit",
"insertTextFormat",
"insertTextMode"
]
},
"snippetSupport": true,
"tagSupport": {
"valueSet": [
1
]
}
},
"completionList": {
"itemDefaults": [
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode",
"data"
]
},
"contextSupport": true,
"dynamicRegistration": false,
"insertTextMode": 1
}
}
},
"workspace": {
"configuration": true
}
},
"clientInfo": {
"name": "Neovim",
"version": "0.8.3"
},
"initializationOptions": {},
"processId": 30117,
"rootPath": null,
"rootUri": null,
"trace": "off",
"workspaceFolders": null
}
} Note that under By contrast, here is an example {
"id": 0,
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"capabilities": {
"general": {
"markdown": {
"parser": "marked",
"version": "1.1.0"
},
"positionEncodings": [
"utf-16"
],
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"staleRequestSupport": {
"cancel": true,
"retryOnContentModified": [
"textDocument/semanticTokens/full",
"textDocument/semanticTokens/range",
"textDocument/semanticTokens/full/delta"
]
}
},
"notebookDocument": {
"synchronization": {
"dynamicRegistration": true,
"executionSummarySupport": true
}
},
"textDocument": {
"callHierarchy": {
"dynamicRegistration": true
},
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"dataSupport": true,
"disabledSupport": true,
"dynamicRegistration": true,
"honorsChangeAnnotations": false,
"isPreferredSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
}
},
"codeLens": {
"dynamicRegistration": true
},
"colorProvider": {
"dynamicRegistration": true
},
"completion": {
"completionItem": {
"commitCharactersSupport": true,
"deprecatedSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"insertReplaceSupport": true,
"insertTextModeSupport": {
"valueSet": [
1,
2
]
},
"labelDetailsSupport": true,
"preselectSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"snippetSupport": 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
]
},
"completionList": {
"itemDefaults": [
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode"
]
},
"contextSupport": true,
"dynamicRegistration": true,
"editsNearCursor": true,
"insertTextMode": 2
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"diagnostic": {
"dynamicRegistration": true,
"relatedDocumentSupport": false
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"documentSymbol": {
"dynamicRegistration": true,
"hierarchicalDocumentSymbolSupport": true,
"labelSupport": 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
]
}
},
"foldingRange": {
"dynamicRegistration": true,
"foldingRange": {
"collapsedText": false
},
"foldingRangeKind": {
"valueSet": [
"comment",
"imports",
"region"
]
},
"lineFoldingOnly": true,
"rangeLimit": 5000
},
"formatting": {
"dynamicRegistration": true
},
"hover": {
"contentFormat": [
"markdown",
"plaintext"
],
"dynamicRegistration": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"inactiveRegionsCapabilities": {
"inactiveRegions": true
},
"inlayHint": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"tooltip",
"textEdits",
"label.tooltip",
"label.location",
"label.command"
]
}
},
"inlineValue": {
"dynamicRegistration": true
},
"linkedEditingRange": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"publishDiagnostics": {
"codeDescriptionSupport": true,
"dataSupport": true,
"relatedInformation": true,
"tagSupport": {
"valueSet": [
1,
2
]
},
"versionSupport": false
},
"rangeFormatting": {
"dynamicRegistration": true
},
"references": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"honorsChangeAnnotations": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1
},
"selectionRange": {
"dynamicRegistration": true
},
"semanticTokens": {
"augmentsSyntaxTokens": true,
"dynamicRegistration": true,
"formats": [
"relative"
],
"multilineTokenSupport": false,
"overlappingTokenSupport": false,
"requests": {
"full": {
"delta": true
},
"range": true
},
"serverCancelSupport": true,
"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"
]
},
"signatureHelp": {
"contextSupport": true,
"dynamicRegistration": true,
"signatureInformation": {
"activeParameterSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"synchronization": {
"didSave": true,
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"typeHierarchy": {
"dynamicRegistration": true
}
},
"window": {
"showDocument": {
"support": true
},
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"workDoneProgress": true
},
"workspace": {
"applyEdit": true,
"codeLens": {
"refreshSupport": true
},
"configuration": true,
"diagnostics": {
"refreshSupport": true
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true,
"relativePatternSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"fileOperations": {
"didCreate": true,
"didDelete": true,
"didRename": true,
"dynamicRegistration": true,
"willCreate": true,
"willDelete": true,
"willRename": true
},
"inlayHint": {
"refreshSupport": true
},
"inlineValue": {
"refreshSupport": true
},
"semanticTokens": {
"refreshSupport": true
},
"symbol": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"location.range"
]
},
"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
]
}
},
"workspaceEdit": {
"changeAnnotationSupport": {
"groupsOnLabel": true
},
"documentChanges": true,
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"resourceOperations": [
"create",
"rename",
"delete"
]
},
"workspaceFolders": true
}
},
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.85.2"
},
"initializationOptions": {
"clangdFileStatus": true,
"fallbackFlags": []
},
"locale": "en-us",
"processId": 9881,
"rootPath": "<path>",
"rootUri": "<path>",
"trace": "off",
"workspaceFolders": [
{
"name": "<project>",
"uri": "<path>"
}
]
}
} Notice there is a lot more in there, including this section:
|
Actually, the contents of the {
"id": 1,
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"capabilities": {
"1": {
"textDocument": {
"completion": { What is that |
I'm thinking could all of this problem because I copy paste config from other person, could you take a look at my attach and capabilities set up for the lsp. |
Sorry, I'm not familiar with neovim (I use the VSCode client). You are more likely to find answers about your config in the neovim issue tracker or another neovim-related forum. |
Ah, and I thought I come so close to fix my problem, you don't mind me copy your message to the nvim team to help me fix this issue right? |
Of course, that's fine. This comment should hopefully contain all the detail a client developer needs to understand what the client is doing wrong. |
Thank you, and should I close this issue on this end, or just keep open until I find the solution to this? |
I will say, even without being familiar with the details of neovim's config, this line looks suspicious:
It looks to me like it may be replacing the good/working client capabilities that neovim would normally send, with a custom one that may be broken. Maybe try to remove that line? |
It was this one, every config I see they all use that require, I just being extra so I put it under |
Close this issue, the solution is on the nvim side. |
Please describe the problem.
The
vim.lsp.buf.hover
work nicely with Lua language.However, when using it with C file, the feature doesn't have any syntax coloring and look bad.
I try using
lspsaga
plugin and use the command:Lspsaga hover_doc
, also doesn't work. Of course I also downloadmarkdown, markdown_inline
on treesitter, but still nothing change.Other information
The file that I use to show the problem also have this issue with the
stdio.h
library, maybe or maybe not it the cause or symptom to identify the problem.Logs
lsp.log
System information
Output of
clangd --version
:clangd version 17.0.3 install via zip file since Ubuntu apt don't have the latest version.
Editor/LSP plugin:
NVIM v0.8.3 installed via appimage since Unbuntu apt don't have the latest version.
Operating system:
Ubuntu 22.04.4 LTS.
The text was updated successfully, but these errors were encountered: