mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-19 02:35:00 +00:00
feat: consider context free requests
This commit is contained in:
parent
85cc29f884
commit
788792f202
5 changed files with 83 additions and 26 deletions
|
@ -42,6 +42,14 @@ mod polymorphic {
|
|||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum FoldRequestFeature {
|
||||
PinnedFirst,
|
||||
Unique,
|
||||
Mergable,
|
||||
ContextFreeUnique,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum CompilerQueryRequest {
|
||||
OnSaveExport(OnSaveExportRequest),
|
||||
|
@ -57,7 +65,26 @@ mod polymorphic {
|
|||
FoldingRange(FoldingRangeRequest),
|
||||
SelectionRange(SelectionRangeRequest),
|
||||
}
|
||||
|
||||
impl CompilerQueryRequest {
|
||||
pub fn fold_feature(&self) -> FoldRequestFeature {
|
||||
use FoldRequestFeature::*;
|
||||
match self {
|
||||
CompilerQueryRequest::OnSaveExport(..) => Mergable,
|
||||
CompilerQueryRequest::Hover(..) => PinnedFirst,
|
||||
CompilerQueryRequest::GotoDefinition(..) => PinnedFirst,
|
||||
CompilerQueryRequest::InlayHint(..) => Unique,
|
||||
CompilerQueryRequest::Completion(..) => Mergable,
|
||||
CompilerQueryRequest::SignatureHelp(..) => PinnedFirst,
|
||||
CompilerQueryRequest::DocumentSymbol(..) => ContextFreeUnique,
|
||||
CompilerQueryRequest::Symbol(..) => Mergable,
|
||||
CompilerQueryRequest::SemanticTokensFull(..) => ContextFreeUnique,
|
||||
CompilerQueryRequest::SemanticTokensDelta(..) => ContextFreeUnique,
|
||||
CompilerQueryRequest::FoldingRange(..) => ContextFreeUnique,
|
||||
CompilerQueryRequest::SelectionRange(..) => ContextFreeUnique,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn associated_path(&self) -> Option<&Path> {
|
||||
Some(match self {
|
||||
CompilerQueryRequest::OnSaveExport(req) => &req.path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue