Open
Description
Context
Setting up autocompletion for Objective-C.
Filesystem:
.ccls
clang
-I/usr/GNUstep/Local/Library/Headers
-L/usr/GNUstep/Local/Library/Libraries
-lgnustep-base -lobjc
-fobjc-runtime=gnustep-2.0
src/main.m
#import <Foundation/Foundation.h>
#import "MyClass2.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
// Create an instance of MyClass
MyClass *myObject = [[MyClass alloc] init];
// Call the sayHello method
[myObject sayHello];
}
return 0;
}
src/MyClass.m
#import <Foundation/Foundation.h>
@interface MyClass : NSObject
- (void)sayHello;
@end
@implementation MyClass
- (void)sayHello {
NSLog(@"Hello, World!");
}
@end
src/MyClass2.h
#import <Foundation/Foundation.h>
@interface MyClass : NSObject
- (void)sayHello;
@end
@implementation MyClass
- (void)sayHello {
NSLog(@"Hello, World!");
}
@end
Observed behavior
- The
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.- Specifically, the
@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).
- Specifically, the
expected identifier or '('ccls(4)
- Code can be compiled using the command from
.ccls
without errors, which means syntax is valid considering the project setup.
Expected behavior
- Shouldn't be getting error highlighting in diagnostics if the project can be built successfully with the provided command
- The language server should treat the
.h
and.m
files in the same way for an Objective-C environment.
Steps to reproduce
- Use the file structure described in the "Observer behavior section"
- Initialize the language server, and send a
didOpen
notification for the.h
file - See that error diagnostics are being published
- Send a
didOpen
notification for the.m
file with the same content - See that no error diagnostics are published
- To make sure that the syntax is valid considering the project setup, compile the code using the following command, which is identical to the one in
.ccls
clang -I/usr/GNUstep/Local/Library/Headers \
-L/usr/GNUstep/Local/Library/Libraries \
-lgnustep-base -lobjc \
-fobjc-runtime=gnustep-2.0 \
./src/main.m -o MyClassTest
- Run the
MyClassTest
executable. See that it is successful
System information
- ccls version: 0.20190823.6-1~ubuntu1.20.04.1 (result of
ccls --version
) - clang version:
10.0.0-4ubuntu1
- OS: Ubuntu 20
- Editor: Monaco (can be any)
- Language client (and version): Monaco-langaugeClient 0.18.1 (can be any)
Metadata
Metadata
Assignees
Labels
No labels