Skip to main content

Mountain/RPC/EchoAction/
ResolveMethodPriority.rs

1#![allow(non_snake_case)]
2
3//! Map a Cocoon→Mountain wire method name to an Echo priority lane.
4//!
5//! | Wire method                             | Lane   | Reason                              |
6//! | --------------------------------------- | ------ | ----------------------------------- |
7//! | `FileSystem.ReadFile` / `WriteFile`     | High   | extension UI waits on it            |
8//! | `ShowInformationMessage` / `ShowError…` | High   | user-visible                        |
9//! | `ExecuteContributedCommand`             | High   | user action                         |
10//! | `RegisterCommand` + Register* providers | Normal | activation path                     |
11//! | `Configuration.Inspect`                 | Normal | common, not critical                |
12//! | `FindFiles` / `FindTextInFiles`         | Low    | long-running                        |
13//! | `GitExec`                               | Low    | spawns subprocess                   |
14//! | everything else                         | Normal | safe default                        |
15
16use Echo::Task::Priority::Priority as EchoPriority;
17
18pub fn Fn(Method:&str) -> EchoPriority {
19	match Method {
20		"FileSystem.ReadFile"
21		| "FileSystem.WriteFile"
22		| "FileSystem.Stat"
23		| "ShowInformationMessage"
24		| "ShowWarningMessage"
25		| "ShowErrorMessage"
26		| "ExecuteContributedCommand"
27		| "ShowTextDocument" => EchoPriority::High,
28		"FindFiles" | "FindTextInFiles" | "GitExec" | "WatchFile" => EchoPriority::Low,
29		_ => EchoPriority::Normal,
30	}
31}