1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

perf(lsp): Pass code action trigger kind to TSC (#23466)

This commit is contained in:
Nathan Whitaker 2024-04-20 13:18:43 -07:00 committed by GitHub
parent c0f40ed81a
commit f62018e80f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -1879,6 +1879,7 @@ impl Inner {
&self.config,
&specifier,
)),
params.context.trigger_kind,
only,
)
.await?;

View file

@ -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,
]),
};