mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
4646bf4b92
The SemanticSyntaxHighlighter uses TokenInfo results from the language server to provide 'semantic' syntax highlighting, which provides more fin-grained text spans results. For example, the SemanticSyntaxHighlighter can color function calls, member fields references and user-defined types in different colors. With the simple lexer-only syntax highlighter, all of these tokens were given the same text highlighting span type. Since we have to provide immediate highlighting feedback to the user after each edit and before we get the result for the language server, we use a heuristic which computes the diff between the current tokens and the last known tokens with compete semantic information (We use LibDiff for this). This heuristic is not very performant, and starts feeling sluggish with bigger (~200 LOC) files. A possible future improvement would be only computing the diff for tokens in text ranges that have changes since the last commit. |
||
---|---|---|
.. | ||
Tests | ||
AST.cpp | ||
AST.h | ||
CMakeLists.txt | ||
Lexer.cpp | ||
Lexer.h | ||
Parser.cpp | ||
Parser.h | ||
Preprocessor.cpp | ||
Preprocessor.h | ||
SemanticSyntaxHighlighter.cpp | ||
SemanticSyntaxHighlighter.h | ||
SyntaxHighlighter.cpp | ||
SyntaxHighlighter.h | ||
Token.cpp | ||
Token.h |