mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:28:11 +00:00
LibGUI+HackStudio: Add TokenInfo struct for language-server IPC
The TokenInfo struct contains the token's position and a "semantic type". The semantic type is a more fine-grained token type than what's in Cpp::Token::Type. For example, the semantic token type differentiates between a reference to a variable and to a function parameter. In the normal Token::Type, both would be Token::Type::Identifier.
This commit is contained in:
parent
605becb28b
commit
a54d0cc805
2 changed files with 53 additions and 0 deletions
|
@ -69,6 +69,32 @@ public:
|
|||
|
||||
virtual void provide_completions(Function<void(Vector<Entry>)>) = 0;
|
||||
|
||||
struct TokenInfo {
|
||||
enum class SemanticType : u32 {
|
||||
Unknown,
|
||||
Regular,
|
||||
Keyword,
|
||||
Type,
|
||||
Identifier,
|
||||
String,
|
||||
Number,
|
||||
IncludePath,
|
||||
PreprocessorStatement,
|
||||
Comment,
|
||||
Whitespace,
|
||||
Function,
|
||||
Variable,
|
||||
CustomType,
|
||||
Namespace,
|
||||
Member,
|
||||
Parameter,
|
||||
} type { SemanticType::Unknown };
|
||||
size_t start_line { 0 };
|
||||
size_t start_column { 0 };
|
||||
size_t end_line { 0 };
|
||||
size_t end_column { 0 };
|
||||
};
|
||||
|
||||
void attach(TextEditor& editor)
|
||||
{
|
||||
VERIFY(!m_editor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue