mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 21:03:11 +00:00
[ty] First cut at semantic token provider (#19108)
This PR implements a basic semantic token provider for ty's language server. This allows for more accurate semantic highlighting / coloring within editors that support this LSP functionality. Here are screen shots that show how code appears in VS Code using the "rainbow" theme both before and after this change.   The token types and modifier tags in this implementation largely mirror those used in Microsoft's default language server for Python. The implementation supports two LSP interfaces. The first provides semantic tokens for an entire document, and the second returns semantic tokens for a requested range within a document. The PR includes unit tests. It also includes comments that document known limitations and areas for future improvements. --------- Co-authored-by: UnboundVariable <unbound@gmail.com>
This commit is contained in:
parent
4dd2c03144
commit
278f93022a
13 changed files with 2221 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ mod goto;
|
|||
mod hover;
|
||||
mod inlay_hints;
|
||||
mod markup;
|
||||
mod semantic_tokens;
|
||||
|
||||
pub use completion::completion;
|
||||
pub use db::Db;
|
||||
|
|
@ -12,6 +13,9 @@ pub use goto::goto_type_definition;
|
|||
pub use hover::hover;
|
||||
pub use inlay_hints::inlay_hints;
|
||||
pub use markup::MarkupKind;
|
||||
pub use semantic_tokens::{
|
||||
SemanticToken, SemanticTokenModifier, SemanticTokenType, SemanticTokens, semantic_tokens,
|
||||
};
|
||||
|
||||
use ruff_db::files::{File, FileRange};
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue