-
Notifications
You must be signed in to change notification settings - Fork 260
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
Objective-C: Different behavior for .m and .h files #969
Comments
Debug logs
|
Client-server communication when opening [
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 0,\n \"method\": \"initialize\",\n \"params\": {\n \"processId\": null,\n \"clientInfo\": {\n \"name\": \"Monaco\"\n },\n \"locale\": \"en-US\",\n \"rootPath\": \"/usercode/FILESYSTEM\",\n \"rootUri\": \"file:///usercode/FILESYSTEM\",\n \"capabilities\": {\n \"workspace\": {\n \"applyEdit\": true,\n \"workspaceEdit\": {\n \"documentChanges\": true,\n \"resourceOperations\": [\n \"create\",\n \"rename\",\n \"delete\"\n ],\n \"failureHandling\": \"textOnlyTransactional\",\n \"normalizesLineEndings\": true,\n \"changeAnnotationSupport\": {\n \"groupsOnLabel\": true\n }\n },\n \"didChangeConfiguration\": {\n \"dynamicRegistration\": true\n },\n \"didChangeWatchedFiles\": {\n \"dynamicRegistration\": true\n },\n \"symbol\": {\n \"dynamicRegistration\": true,\n \"symbolKind\": {\n \"valueSet\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26\n ]\n },\n \"tagSupport\": {\n \"valueSet\": [\n 1\n ]\n }\n },\n \"codeLens\": {\n \"refreshSupport\": true\n },\n \"executeCommand\": {\n \"dynamicRegistration\": true\n },\n \"configuration\": true,\n \"workspaceFolders\": true,\n \"semanticTokens\": {\n \"refreshSupport\": true\n }\n },\n \"textDocument\": {\n \"publishDiagnostics\": {\n \"relatedInformation\": true,\n \"versionSupport\": false,\n \"tagSupport\": {\n \"valueSet\": [\n 1,\n 2\n ]\n },\n \"codeDescriptionSupport\": true,\n \"dataSupport\": true\n },\n \"synchronization\": {\n \"dynamicRegistration\": true,\n \"willSave\": true,\n \"willSaveWaitUntil\": true,\n \"didSave\": true\n },\n \"completion\": {\n \"dynamicRegistration\": true,\n \"contextSupport\": true,\n \"completionItem\": {\n \"snippetSupport\": true,\n \"commitCharactersSupport\": true,\n \"documentationFormat\": [\n \"markdown\",\n \"plaintext\"\n ],\n \"deprecatedSupport\": true,\n \"preselectSupport\": true,\n \"tagSupport\": {\n \"valueSet\": [\n 1\n ]\n },\n \"insertReplaceSupport\": true,\n \"resolveSupport\": {\n \"properties\": [\n \"documentation\",\n \"detail\",\n \"additionalTextEdits\"\n ]\n },\n \"insertTextModeSupport\": {\n \"valueSet\": [\n 1,\n 2\n ]\n }\n },\n \"completionItemKind\": {\n \"valueSet\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25\n ]\n }\n },\n \"hover\": {\n \"dynamicRegistration\": true,\n \"contentFormat\": [\n \"markdown\",\n \"plaintext\"\n ]\n },\n \"signatureHelp\": {\n \"dynamicRegistration\": true,\n \"signatureInformation\": {\n \"documentationFormat\": [\n \"markdown\",\n \"plaintext\"\n ],\n \"parameterInformation\": {\n \"labelOffsetSupport\": true\n },\n \"activeParameterSupport\": true\n },\n \"contextSupport\": true\n },\n \"definition\": {\n \"dynamicRegistration\": true,\n \"linkSupport\": true\n },\n \"references\": {\n \"dynamicRegistration\": true\n },\n \"documentHighlight\": {\n \"dynamicRegistration\": true\n },\n \"documentSymbol\": {\n \"dynamicRegistration\": true,\n \"symbolKind\": {\n \"valueSet\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26\n ]\n },\n \"hierarchicalDocumentSymbolSupport\": true,\n \"tagSupport\": {\n \"valueSet\": [\n 1\n ]\n },\n \"labelSupport\": true\n },\n \"codeAction\": {\n \"dynamicRegistration\": true,\n \"isPreferredSupport\": true,\n \"disabledSupport\": true,\n \"dataSupport\": true,\n \"resolveSupport\": {\n \"properties\": [\n \"edit\"\n ]\n },\n \"codeActionLiteralSupport\": {\n \"codeActionKind\": {\n \"valueSet\": [\n \"\",\n \"quickfix\",\n \"refactor\",\n \"refactor.extract\",\n \"refactor.inline\",\n \"refactor.rewrite\",\n \"source\",\n \"source.organizeImports\"\n ]\n }\n },\n \"honorsChangeAnnotations\": false\n },\n \"codeLens\": {\n \"dynamicRegistration\": true\n },\n \"formatting\": {\n \"dynamicRegistration\": true\n },\n \"rangeFormatting\": {\n \"dynamicRegistration\": true\n },\n \"onTypeFormatting\": {\n \"dynamicRegistration\": true\n },\n \"rename\": {\n \"dynamicRegistration\": true,\n \"prepareSupport\": true,\n \"prepareSupportDefaultBehavior\": 1,\n \"honorsChangeAnnotations\": true\n },\n \"documentLink\": {\n \"dynamicRegistration\": true,\n \"tooltipSupport\": true\n },\n \"typeDefinition\": {\n \"dynamicRegistration\": true,\n \"linkSupport\": true\n },\n \"implementation\": {\n \"dynamicRegistration\": true,\n \"linkSupport\": true\n },\n \"colorProvider\": {\n \"dynamicRegistration\": true\n },\n \"foldingRange\": {\n \"dynamicRegistration\": true,\n \"rangeLimit\": 5000,\n \"lineFoldingOnly\": true\n },\n \"declaration\": {\n \"dynamicRegistration\": true,\n \"linkSupport\": true\n },\n \"semanticTokens\": {\n \"dynamicRegistration\": true,\n \"tokenTypes\": [\n \"namespace\",\n \"type\",\n \"class\",\n \"enum\",\n \"interface\",\n \"struct\",\n \"typeParameter\",\n \"parameter\",\n \"variable\",\n \"property\",\n \"enumMember\",\n \"event\",\n \"function\",\n \"method\",\n \"macro\",\n \"keyword\",\n \"modifier\",\n \"comment\",\n \"string\",\n \"number\",\n \"regexp\",\n \"operator\"\n ],\n \"tokenModifiers\": [\n \"declaration\",\n \"definition\",\n \"readonly\",\n \"static\",\n \"deprecated\",\n \"abstract\",\n \"async\",\n \"modification\",\n \"documentation\",\n \"defaultLibrary\"\n ],\n \"formats\": [\n \"relative\"\n ],\n \"requests\": {\n \"range\": true,\n \"full\": {\n \"delta\": true\n }\n },\n \"multilineTokenSupport\": false,\n \"overlappingTokenSupport\": false\n },\n \"callHierarchy\": {\n \"dynamicRegistration\": true\n }\n },\n \"window\": {\n \"showMessage\": {\n \"messageActionItem\": {\n \"additionalPropertiesSupport\": true\n }\n },\n \"showDocument\": {\n \"support\": true\n },\n \"workDoneProgress\": true\n },\n \"general\": {\n \"regularExpressions\": {\n \"engine\": \"ECMAScript\",\n \"version\": \"ES2020\"\n },\n \"markdown\": {\n \"parser\": \"marked\",\n \"version\": \"1.1.0\"\n }\n }\n },\n \"trace\": \"off\",\n \"workspaceFolders\": [\n {\n \"uri\": \"file:///usercode/FILESYSTEM\",\n \"name\": \"file:///usercode/FILESYSTEM\"\n }\n ]\n }\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 0,\n \"result\": {\n \"capabilities\": {\n \"textDocumentSync\": {\n \"openClose\": true,\n \"change\": 2,\n \"willSave\": false,\n \"willSaveWaitUntil\": false,\n \"save\": {\n \"includeText\": false\n }\n },\n \"hoverProvider\": true,\n \"completionProvider\": {\n \"resolveProvider\": false,\n \"triggerCharacters\": [\n \".\",\n \":\",\n \">\",\n \"#\",\n \"<\",\n \"\\\"\",\n \"/\"\n ]\n },\n \"signatureHelpProvider\": {\n \"triggerCharacters\": [\n \"(\",\n \",\"\n ]\n },\n \"declarationProvider\": true,\n \"definitionProvider\": true,\n \"implementationProvider\": true,\n \"typeDefinitionProvider\": true,\n \"referencesProvider\": true,\n \"documentHighlightProvider\": true,\n \"documentSymbolProvider\": true,\n \"workspaceSymbolProvider\": true,\n \"codeActionProvider\": {\n \"codeActionKinds\": [\n \"quickfix\"\n ]\n },\n \"codeLensProvider\": {\n \"resolveProvider\": false\n },\n \"documentFormattingProvider\": true,\n \"documentRangeFormattingProvider\": true,\n \"documentOnTypeFormattingProvider\": {\n \"firstTriggerCharacter\": \"}\",\n \"moreTriggerCharacter\": []\n },\n \"renameProvider\": true,\n \"documentLinkProvider\": {\n \"resolveProvider\": true\n },\n \"foldingRangeProvider\": true,\n \"executeCommandProvider\": {\n \"commands\": [\n \"ccls.xref\"\n ]\n },\n \"workspace\": {\n \"workspaceFolders\": {\n \"supported\": true,\n \"changeNotifications\": true\n }\n }\n }\n }\n}"
}
},
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"initialized\",\n \"params\": {}\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"client/registerCapability\",\n \"id\": 0,\n \"params\": {\n \"registrations\": [\n {\n \"id\": \"didChangeWatchedFiles\",\n \"method\": \"workspace/didChangeWatchedFiles\",\n \"registerOptions\": {\n \"watchers\": [\n {\n \"globPattern\": \"**/*\"\n }\n ]\n }\n }\n ]\n }\n}"
}
},
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"workspace/didChangeWorkspaceFolders\",\n \"params\": {\n \"event\": {\n \"added\": [\n {\n \"uri\": \"file:///usercode/FILESYSTEM\",\n \"name\": \"file:///usercode/FILESYSTEM\"\n }\n ],\n \"removed\": [\n {\n \"uri\": \"file:///usercode/FILESYSTEM\",\n \"name\": \"file:///usercode/FILESYSTEM\"\n }\n ]\n }\n }\n}"
}
},
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 0,\n \"result\": null\n}"
}
},
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"textDocument/didOpen\",\n \"params\": {\n \"textDocument\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\",\n \"languageId\": \"c\",\n \"version\": 1,\n \"text\": \"#import <Foundation/Foundation.h>\\n\\n@interface MyClass : NSObject\\n\\n- (void)sayHello;\\n\\n@end\\n\\n@implementation MyClass\\n\\n- (void)sayHello {\\n NSLog(@\\\"Hello, World!\\\");\\n}\\n\\n@end\\n\"\n }\n }\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"$ccls/publishSkippedRanges\",\n \"params\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\",\n \"skippedRanges\": []\n }\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"$ccls/publishSemanticHighlight\",\n \"params\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\",\n \"symbols\": [\n {\n \"id\": 0,\n \"parentKind\": 0,\n \"kind\": 11,\n \"storage\": 0,\n \"ranges\": [\n {\n \"L\": 56,\n \"R\": 64\n }\n ],\n \"lsRanges\": []\n },\n {\n \"id\": 2,\n \"parentKind\": 11,\n \"kind\": 6,\n \"storage\": 0,\n \"ranges\": [\n {\n \"L\": 74,\n \"R\": 82\n },\n {\n \"L\": 124,\n \"R\": 132\n }\n ],\n \"lsRanges\": []\n },\n {\n \"id\": 1,\n \"parentKind\": 1,\n \"kind\": 11,\n \"storage\": 0,\n \"ranges\": [\n {\n \"L\": 46,\n \"R\": 53\n },\n {\n \"L\": 107,\n \"R\": 114\n }\n ],\n \"lsRanges\": []\n },\n {\n \"id\": 1,\n \"parentKind\": 0,\n \"kind\": 12,\n \"storage\": 0,\n \"ranges\": [\n {\n \"L\": 139,\n \"R\": 144\n }\n ],\n \"lsRanges\": []\n }\n ]\n }\n}"
}
},
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"textDocument/documentLink\",\n \"params\": {\n \"textDocument\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\"\n }\n }\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"result\": [\n {\n \"range\": {\n \"start\": {\n \"line\": 0,\n \"character\": 9\n },\n \"end\": {\n \"line\": 0,\n \"character\": 32\n }\n },\n \"target\": \"file:///usr/GNUstep/Local/Library/Headers/Foundation/Foundation.h\"\n }\n ]\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"textDocument/publishDiagnostics\",\n \"params\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\",\n \"diagnostics\": [\n {\n \"range\": {\n \"start\": {\n \"line\": 2,\n \"character\": 0\n },\n \"end\": {\n \"line\": 2,\n \"character\": 1\n }\n },\n \"severity\": 1,\n \"code\": 4,\n \"source\": \"ccls\",\n \"message\": \"expected identifier or '('\",\n \"relatedInformation\": []\n },\n {\n \"range\": {\n \"start\": {\n \"line\": 6,\n \"character\": 0\n },\n \"end\": {\n \"line\": 6,\n \"character\": 1\n }\n },\n \"severity\": 1,\n \"code\": 4,\n \"source\": \"ccls\",\n \"message\": \"expected identifier or '('\",\n \"relatedInformation\": []\n },\n {\n \"range\": {\n \"start\": {\n \"line\": 14,\n \"character\": 0\n },\n \"end\": {\n \"line\": 14,\n \"character\": 1\n }\n },\n \"severity\": 1,\n \"code\": 4,\n \"source\": \"ccls\",\n \"message\": \"expected identifier or '('\",\n \"relatedInformation\": []\n }\n ]\n }\n}"
}
},
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 2,\n \"method\": \"textDocument/codeLens\",\n \"params\": {\n \"textDocument\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\"\n }\n }\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 2,\n \"result\": [\n {\n \"range\": {\n \"start\": {\n \"line\": 8,\n \"character\": 16\n },\n \"end\": {\n \"line\": 8,\n \"character\": 23\n }\n },\n \"command\": {\n \"title\": \"2 refs\",\n \"command\": \"ccls.xref\",\n \"arguments\": [\n \"{\\\"usr\\\":504677913038942183,\\\"kind\\\":2,\\\"field\\\":\\\"uses\\\"}\"\n ]\n }\n },\n {\n \"range\": {\n \"start\": {\n \"line\": 4,\n \"character\": 8\n },\n \"end\": {\n \"line\": 4,\n \"character\": 16\n }\n },\n \"command\": {\n \"title\": \"1 ref\",\n \"command\": \"ccls.xref\",\n \"arguments\": [\n \"{\\\"usr\\\":12863261884341716873,\\\"kind\\\":3,\\\"field\\\":\\\"uses\\\"}\"\n ]\n }\n },\n {\n \"range\": {\n \"start\": {\n \"line\": 2,\n \"character\": 11\n },\n \"end\": {\n \"line\": 2,\n \"character\": 18\n }\n },\n \"command\": {\n \"title\": \"2 refs\",\n \"command\": \"ccls.xref\",\n \"arguments\": [\n \"{\\\"usr\\\":504677913038942183,\\\"kind\\\":2,\\\"field\\\":\\\"uses\\\"}\"\n ]\n }\n },\n {\n \"range\": {\n \"start\": {\n \"line\": 10,\n \"character\": 8\n },\n \"end\": {\n \"line\": 10,\n \"character\": 16\n }\n },\n \"command\": {\n \"title\": \"1 ref\",\n \"command\": \"ccls.xref\",\n \"arguments\": [\n \"{\\\"usr\\\":12863261884341716873,\\\"kind\\\":3,\\\"field\\\":\\\"uses\\\"}\"\n ]\n }\n }\n ]\n}"
}
},
{
"sender": "client",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 3,\n \"method\": \"textDocument/foldingRange\",\n \"params\": {\n \"textDocument\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\"\n }\n }\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 3,\n \"result\": [\n {\n \"startLine\": 8,\n \"startCharacter\": 0,\n \"endLine\": 14,\n \"endCharacter\": 1,\n \"kind\": \"region\"\n },\n {\n \"startLine\": 4,\n \"startCharacter\": 0,\n \"endLine\": 4,\n \"endCharacter\": 17,\n \"kind\": \"region\"\n },\n {\n \"startLine\": 2,\n \"startCharacter\": 0,\n \"endLine\": 6,\n \"endCharacter\": 4,\n \"kind\": \"region\"\n },\n {\n \"startLine\": 10,\n \"startCharacter\": 0,\n \"endLine\": 12,\n \"endCharacter\": 1,\n \"kind\": \"region\"\n }\n ]\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"$ccls/publishSkippedRanges\",\n \"params\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\",\n \"skippedRanges\": []\n }\n}"
}
},
{
"sender": "server",
"message": {
"message": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"$ccls/publishSemanticHighlight\",\n \"params\": {\n \"uri\": \"file:///usercode/FILESYSTEM/src/MyClass2.h\",\n \"symbols\": []\n }\n}"
}
}
] |
I am unsure if this is an issue on the ccls side, or perhaps, related to my configuration. But at least I'd expect not to get error highlighting if the code can be compiled using the same command. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context
Setting up autocompletion for Objective-C.
Filesystem:
.ccls
src/main.m
src/MyClass.m
src/MyClass2.h
Observed behavior
MyClass.m
andMyClass2.h
have the same content, and there are no custom arguments specified for the.m
and.h
files, but they get different error highlighting.@interface
syntax is highlighted as invalid in.h
files, even though, theFoundation
header is imported and recognized (you can use a go-to definition feature that will respond with the actual path)..ccls
without errors, which means syntax is valid considering the project setup.Expected behavior
.h
and.m
files in the same way for an Objective-C environment.Steps to reproduce
didOpen
notification for the.h
filedidOpen
notification for the.m
file with the same content.ccls
MyClassTest
executable. See that it is successfulSystem information
ccls --version
)10.0.0-4ubuntu1
The text was updated successfully, but these errors were encountered: