Opaque type support

This commit is contained in:
Alexandros Naskos 2020-10-10 12:25:50 +03:00
parent c1d7f0ffa7
commit 162f1b2fbe
3 changed files with 8 additions and 1 deletions

View File

@ -914,6 +914,10 @@ pub const TypeWithHandle = struct {
return self.isContainer(.Keyword_union); return self.isContainer(.Keyword_union);
} }
pub fn isOpaqueType(self: TypeWithHandle) bool {
return self.isContainer(.Keyword_opaque);
}
pub fn isTypeFunc(self: TypeWithHandle) bool { pub fn isTypeFunc(self: TypeWithHandle) bool {
switch (self.type.data) { switch (self.type.data) {
.other => |n| { .other => |n| {

View File

@ -92,7 +92,7 @@ var client_capabilities = ClientCapabilities{};
var offset_encoding = offsets.Encoding.utf16; var offset_encoding = offsets.Encoding.utf16;
const initialize_capabilities = const initialize_capabilities =
\\"capabilities": {"signatureHelpProvider": {"triggerCharacters": ["(",","]},"textDocumentSync": 1,"renameProvider":true,"completionProvider": {"resolveProvider": false,"triggerCharacters": [".",":","@"]},"documentHighlightProvider": false,"hoverProvider": true,"codeActionProvider": false,"declarationProvider": true,"definitionProvider": true,"typeDefinitionProvider": true,"implementationProvider": false,"referencesProvider": true,"documentSymbolProvider": true,"colorProvider": false,"documentFormattingProvider": true,"documentRangeFormattingProvider": false,"foldingRangeProvider": false,"selectionRangeProvider": false,"workspaceSymbolProvider": false,"rangeProvider": false,"documentProvider": true,"workspace": {"workspaceFolders": {"supported": true,"changeNotifications": true}},"semanticTokensProvider": {"documentProvider": true,"legend": {"tokenTypes": ["namespace","type","struct","enum","union","parameter","variable","tagField","field","errorTag","function","keyword","comment","string","number","operator","builtin","label","keywordLiteral"],"tokenModifiers": ["definition","async","documentation", "generic"]}}}}} \\"capabilities": {"signatureHelpProvider": {"triggerCharacters": ["(",","]},"textDocumentSync": 1,"renameProvider":true,"completionProvider": {"resolveProvider": false,"triggerCharacters": [".",":","@"]},"documentHighlightProvider": false,"hoverProvider": true,"codeActionProvider": false,"declarationProvider": true,"definitionProvider": true,"typeDefinitionProvider": true,"implementationProvider": false,"referencesProvider": true,"documentSymbolProvider": true,"colorProvider": false,"documentFormattingProvider": true,"documentRangeFormattingProvider": false,"foldingRangeProvider": false,"selectionRangeProvider": false,"workspaceSymbolProvider": false,"rangeProvider": false,"documentProvider": true,"workspace": {"workspaceFolders": {"supported": true,"changeNotifications": true}},"semanticTokensProvider": {"documentProvider": true,"legend": {"tokenTypes": ["namespace","type","struct","enum","union","opaque","parameter","variable","tagField","field","errorTag","function","keyword","comment","string","number","operator","builtin","label","keywordLiteral"],"tokenModifiers": ["definition","async","documentation", "generic"]}}}}}
; ;
const initialize_response = ",\"result\": {" ++ initialize_capabilities; const initialize_response = ",\"result\": {" ++ initialize_capabilities;

View File

@ -10,6 +10,7 @@ const TokenType = enum(u32) {
@"struct", @"struct",
@"enum", @"enum",
@"union", @"union",
@"opaque",
parameter, parameter,
variable, variable,
tagField, tagField,
@ -195,6 +196,8 @@ fn colorIdentifierBasedOnType(builder: *Builder, type_node: analysis.TypeWithHan
.@"enum" .@"enum"
else if (type_node.isUnionType()) else if (type_node.isUnionType())
.@"union" .@"union"
else if (type_node.isOpaqueType())
.@"opaque"
else else
TokenType.type; TokenType.type;