feat: prepare for parallelizing lsp requests (#342)

* feat: migrate steal_sync to snapshot_sync

* feat: correctly make world/analysis snapshot

* very rayon

* dev: recover async lsp request

* gg

* dev: pin

* fix: make server stable

* dev: disable concurrent server by default

* dev: very sync
This commit is contained in:
Myriad-Dreamin 2024-06-26 10:37:57 +08:00 committed by GitHub
parent 5e4e1e9877
commit 6fcad1c1c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 1736 additions and 1318 deletions

View file

@ -333,6 +333,40 @@ mod polymorphic {
DocumentMetrics(Option<DocumentMetricsResponse>),
ServerInfo(Option<HashMap<String, ServerInfoResponse>>),
}
impl CompilerQueryResponse {
pub fn to_untyped(self) -> serde_json::Result<JsonValue> {
match self {
Self::OnExport(res) => serde_json::to_value(res),
Self::OnSaveExport(res) => serde_json::to_value(res),
Self::Hover(res) => serde_json::to_value(res),
Self::GotoDefinition(res) => serde_json::to_value(res),
Self::GotoDeclaration(res) => serde_json::to_value(res),
Self::References(res) => serde_json::to_value(res),
Self::InlayHint(res) => serde_json::to_value(res),
Self::DocumentColor(res) => serde_json::to_value(res),
Self::DocumentHighlight(res) => serde_json::to_value(res),
Self::ColorPresentation(res) => serde_json::to_value(res),
Self::CodeAction(res) => serde_json::to_value(res),
Self::CodeLens(res) => serde_json::to_value(res),
Self::Completion(res) => serde_json::to_value(res),
Self::SignatureHelp(res) => serde_json::to_value(res),
Self::PrepareRename(res) => serde_json::to_value(res),
Self::Rename(res) => serde_json::to_value(res),
Self::DocumentSymbol(res) => serde_json::to_value(res),
Self::Symbol(res) => serde_json::to_value(res),
Self::SemanticTokensFull(res) => serde_json::to_value(res),
Self::SemanticTokensDelta(res) => serde_json::to_value(res),
Self::Formatting(res) => serde_json::to_value(res),
Self::FoldingRange(res) => serde_json::to_value(res),
Self::SelectionRange(res) => serde_json::to_value(res),
Self::InteractCodeContext(res) => serde_json::to_value(res),
Self::OnEnter(res) => serde_json::to_value(res),
Self::DocumentMetrics(res) => serde_json::to_value(res),
Self::ServerInfo(res) => serde_json::to_value(res),
}
}
}
}
pub use polymorphic::*;