fix: statically register formatting and semantic tokens capabilities (#814)

* fix: statically register formatting and semantic tokens capabilities

* fix: inline variables and remove comment

* dev: inline variables

* fix: not working on vscode

* test: update snapshot

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
This commit is contained in:
MrLego8_9 2024-11-15 14:28:51 +00:00 committed by GitHub
parent 434f222855
commit d618430f6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 20 deletions

View file

@ -147,25 +147,11 @@ impl Initializer for SuperInit {
return (service, Err(err));
}
// Respond to the host (LSP client)
// Register these capabilities statically if the client does not support dynamic
// registration
let semantic_tokens_provider = match service.config.semantic_tokens {
SemanticTokensMode::Enable if !const_config.tokens_dynamic_registration => {
Some(SemanticTokensServerCapabilities::SemanticTokensOptions(
get_semantic_tokens_options(),
))
}
_ => None,
};
let document_formatting_provider = match service.config.formatter_mode {
FormatterMode::Typstyle | FormatterMode::Typstfmt
if !const_config.doc_fmt_dynamic_registration =>
{
Some(OneOf::Left(true))
}
_ => None,
};
let semantic_tokens_provider = (!const_config.tokens_dynamic_registration).then(|| {
SemanticTokensServerCapabilities::SemanticTokensOptions(get_semantic_tokens_options())
});
let document_formatting_provider =
(!const_config.doc_fmt_dynamic_registration).then_some(OneOf::Left(true));
let file_operations = const_config.notify_will_rename_files.then(|| {
WorkspaceFileOperationsServerCapabilities {

View file

@ -374,7 +374,7 @@ fn e2e() {
});
let hash = replay_log(&tinymist_binary, &root.join("neovim"));
insta::assert_snapshot!(hash, @"siphash128_13:37db2c66ca1b5a0cdec20f531c15d5");
insta::assert_snapshot!(hash, @"siphash128_13:fbb7e6bec2bd8b4d14f29b9d36066d20");
}
{