summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-04-20 13:18:43 -0700
committerGitHub <noreply@github.com>2024-04-20 13:18:43 -0700
commitf62018e80f6269149784246fdc6b22539b9c0bb8 (patch)
tree4d493504949811d239a5573edc3f1332fddda011 /cli/lsp/tsc.rs
parentc0f40ed81a1c932f804ba62e635249cd43c31273 (diff)
perf(lsp): Pass code action trigger kind to TSC (#23466)
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 16cca30e1..2873ba703 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -490,8 +490,14 @@ impl TsServer {
specifier: ModuleSpecifier,
range: Range<u32>,
preferences: Option<UserPreferences>,
+ trigger_kind: Option<lsp::CodeActionTriggerKind>,
only: String,
) -> Result<Vec<ApplicableRefactorInfo>, LspError> {
+ let trigger_kind: Option<&str> = trigger_kind.map(|reason| match reason {
+ lsp::CodeActionTriggerKind::INVOKED => "invoked",
+ lsp::CodeActionTriggerKind::AUTOMATIC => "implicit",
+ _ => unreachable!(),
+ });
let req = TscRequest {
method: "getApplicableRefactors",
// https://github.com/denoland/deno/blob/v1.37.1/cli/tsc/dts/typescript.d.ts#L6274
@@ -499,7 +505,7 @@ impl TsServer {
self.specifier_map.denormalize(&specifier),
{ "pos": range.start, "end": range.end },
preferences.unwrap_or_default(),
- json!(null),
+ trigger_kind,
only,
]),
};