diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-04-20 13:18:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-20 13:18:43 -0700 |
commit | f62018e80f6269149784246fdc6b22539b9c0bb8 (patch) | |
tree | 4d493504949811d239a5573edc3f1332fddda011 | |
parent | c0f40ed81a1c932f804ba62e635249cd43c31273 (diff) |
perf(lsp): Pass code action trigger kind to TSC (#23466)
-rw-r--r-- | cli/lsp/language_server.rs | 1 | ||||
-rw-r--r-- | cli/lsp/tsc.rs | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 2529df6f7..fdd497bba 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -1879,6 +1879,7 @@ impl Inner { &self.config, &specifier, )), + params.context.trigger_kind, only, ) .await?; 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, ]), }; |