1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:04:57 +00:00
serenity/Userland/Libraries/LibSyntax
Itamar 4646bf4b92 LibCpp: Add SemanticSyntaxHighlighter
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.
2022-02-09 00:51:31 +01:00
..
CMakeLists.txt LibSyntax: Move GUI::Highlighter to Syntax::Highlighter in LibSyntax 2021-02-07 15:15:10 +01:00
Forward.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Highlighter.cpp LibSyntax: Fix bug in matching cursor highlighting 2021-09-03 11:45:50 +02:00
Highlighter.h LibCpp: Add SemanticSyntaxHighlighter 2022-02-09 00:51:31 +01:00
HighlighterClient.h LibSyntax: Add missing headers to HighlighterClient.h 2021-10-06 23:52:40 +01:00