fix: source switch on primary node

This commit is contained in:
Myriad-Dreamin 2024-03-08 17:06:08 +08:00
parent efe07c7b4a
commit f6d473f320
3 changed files with 61 additions and 8 deletions

View file

@ -57,6 +57,24 @@ mod polymorphic {
FoldingRange(FoldingRangeRequest),
SelectionRange(SelectionRangeRequest),
}
impl CompilerQueryRequest {
pub fn associated_path(&self) -> Option<&Path> {
Some(match self {
CompilerQueryRequest::OnSaveExport(req) => &req.path,
CompilerQueryRequest::Hover(req) => &req.path,
CompilerQueryRequest::GotoDefinition(req) => &req.path,
CompilerQueryRequest::InlayHint(req) => &req.path,
CompilerQueryRequest::Completion(req) => &req.path,
CompilerQueryRequest::SignatureHelp(req) => &req.path,
CompilerQueryRequest::DocumentSymbol(req) => &req.path,
CompilerQueryRequest::Symbol(..) => return None,
CompilerQueryRequest::SemanticTokensFull(req) => &req.path,
CompilerQueryRequest::SemanticTokensDelta(req) => &req.path,
CompilerQueryRequest::FoldingRange(req) => &req.path,
CompilerQueryRequest::SelectionRange(req) => &req.path,
})
}
}
#[derive(Debug, Clone)]
pub enum CompilerQueryResponse {