mirror of
https://github.com/denoland/deno
synced 2024-10-12 11:02:29 +00:00
perf(lsp): Pass code action trigger kind to TSC (#23466)
This commit is contained in:
parent
c0f40ed81a
commit
f62018e80f
|
@ -1879,6 +1879,7 @@ impl Inner {
|
||||||
&self.config,
|
&self.config,
|
||||||
&specifier,
|
&specifier,
|
||||||
)),
|
)),
|
||||||
|
params.context.trigger_kind,
|
||||||
only,
|
only,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
@ -490,8 +490,14 @@ impl TsServer {
|
||||||
specifier: ModuleSpecifier,
|
specifier: ModuleSpecifier,
|
||||||
range: Range<u32>,
|
range: Range<u32>,
|
||||||
preferences: Option<UserPreferences>,
|
preferences: Option<UserPreferences>,
|
||||||
|
trigger_kind: Option<lsp::CodeActionTriggerKind>,
|
||||||
only: String,
|
only: String,
|
||||||
) -> Result<Vec<ApplicableRefactorInfo>, LspError> {
|
) -> 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 {
|
let req = TscRequest {
|
||||||
method: "getApplicableRefactors",
|
method: "getApplicableRefactors",
|
||||||
// https://github.com/denoland/deno/blob/v1.37.1/cli/tsc/dts/typescript.d.ts#L6274
|
// 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),
|
self.specifier_map.denormalize(&specifier),
|
||||||
{ "pos": range.start, "end": range.end },
|
{ "pos": range.start, "end": range.end },
|
||||||
preferences.unwrap_or_default(),
|
preferences.unwrap_or_default(),
|
||||||
json!(null),
|
trigger_kind,
|
||||||
only,
|
only,
|
||||||
]),
|
]),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue