Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
lsp_semantic_tokens.c File Reference

LSP textDocument/semanticTokens/full implementation for Luma. More...

#include "lsp.h"
#include <string.h>
Include dependency graph for lsp_semantic_tokens.c:

Classes

struct  TokenClass
 

Enumerations

enum  SemanticTokenType {
  ST_NAMESPACE = 0 , ST_TYPE = 1 , ST_TYPE_PARAMETER = 2 , ST_FUNCTION = 3 ,
  ST_METHOD = 4 , ST_PROPERTY = 5 , ST_VARIABLE = 6 , ST_PARAMETER = 7 ,
  ST_KEYWORD = 8 , ST_MODIFIER = 9 , ST_COMMENT = 10 , ST_STRING = 11 ,
  ST_NUMBER = 12 , ST_OPERATOR = 13 , ST_STRUCT = 14 , ST_ENUM = 15 ,
  ST_ENUM_MEMBER = 16 , ST_COUNT = 17
}
 
enum  SemanticTokenMod {
  SM_DECLARATION = (1 << 0) , SM_DEFINITION = (1 << 1) , SM_READONLY = (1 << 2) , SM_STATIC = (1 << 3) ,
  SM_DEFAULT_LIB = (1 << 4)
}
 

Functions

char * lsp_semantic_tokens_full (LSPDocument *doc, ArenaAllocator *arena)
 
const char * lsp_semantic_tokens_capabilities (void)
 

Detailed Description

LSP textDocument/semanticTokens/full implementation for Luma.

We classify every token the lexer produced and encode them in the LSP delta-encoded wire format (5 integers per token).

Token type legend (indices MUST match the "tokenTypes" array sent in the capabilities response — see lsp_message.c):

Index Name


0 namespace 1 type 2 typeParameter 3 function 4 method 5 property 6 variable 7 parameter 8 keyword 9 modifier 10 comment 11 string 12 number 13 operator 14 struct 15 enum 16 enumMember

Token modifier bitmask (indices MUST match "tokenModifiers"): Bit 0 declaration Bit 1 definition Bit 2 readonly Bit 3 static Bit 4 defaultLibrary

Enumeration Type Documentation

◆ SemanticTokenMod

Enumerator
SM_DECLARATION 
SM_DEFINITION 
SM_READONLY 
SM_STATIC 
SM_DEFAULT_LIB 

◆ SemanticTokenType

Enumerator
ST_NAMESPACE 
ST_TYPE 
ST_TYPE_PARAMETER 
ST_FUNCTION 
ST_METHOD 
ST_PROPERTY 
ST_VARIABLE 
ST_PARAMETER 
ST_KEYWORD 
ST_MODIFIER 
ST_COMMENT 
ST_STRING 
ST_NUMBER 
ST_OPERATOR 
ST_STRUCT 
ST_ENUM 
ST_ENUM_MEMBER 
ST_COUNT 

Function Documentation

◆ lsp_semantic_tokens_capabilities()

const char * lsp_semantic_tokens_capabilities ( void  )

◆ lsp_semantic_tokens_full()

char * lsp_semantic_tokens_full ( LSPDocument doc,
ArenaAllocator arena 
)