Adding quickfix.biome
to editor.codeActionsOnSave
slows down saving of *.ts
files
#232480
Labels
bug
Issue identified by VS Code Team member as probable bug
editor-code-actions
Editor inplace actions (Ctrl + .)
perf
typescript
Typescript support issues
transferred from: microsoft/vscode-discussions#1664
ref: biomejs/biome-vscode#229
Does this issue occur when all extensions are disabled?: No. This issue occurs when
typescript-language-features
is enabled.Background
The Biome VS Code extension guides users to add
quickfix.biome
toeditor.codeActionsOnSave
to fix issues when saving files.However, enabling this setting causes saving
*.ts
files to be delayed by about 500ms.368225325-56415cd5-d02e-4fd8-acc2-a5dcffb04932.mov
Surprisingly, this delay occurs even if the Biome extension is not installed. Additionally, disabling the built-in VS Code extension
typescript-language-features
eliminates the delay. For details of the issue and reproduction steps, please see the following comment:Cause of the delay
As a result of my investigation, I found that the delay is caused by the following code in
typescript-language-features
:vscode/extensions/typescript-language-features/src/languageFeatures/quickFix.ts
Lines 254 to 256 in 684f9d4
When
typescript-language-features
receives aquickfix
code action, it attempts to automatically fix some diagnostics. The execution process is as follows:quickfix
code action.The 500ms wait is because the diagnostics obtained in step 2 might be outdated. If this wait time is removed, code fixes might be performed based on old diagnostics. To prevent this,
typescript-language-features
waits for 500ms.Furthermore,
typescript-language-features
does not only respond to thequickfix
code action. It responds to all code actions that start withquickfix
, such asquickfix.biome
andquickfix.some-name
. Therefore, addingquickfix.biome
toeditor.codeActionsOnSave
slows down the saving of*.ts
files.As an experiment, I commented out the line that waits for 500ms and rebuilt vscode, and the saving of
*.ts
files became faster.2024-09-22.16.24.20.mov
Questions
I have several questions regarding this delay issue.
Q1. Is it acceptable to add
quickfix
orquickfix.biome
toeditor.codeActionsOnSave
?In the first place, does VS Code intend for
quickfix
orquickfix.biome
to be added toeditor.codeActionsOnSave
? Neitherquickfix
norquickfix.biome
are included among the completion items foreditor.codeActionsOnSave
.Is this because adding
quickfix
orquickfix.biome
toeditor.codeActionsOnSave
is not intended? Should the Biome extension usesource.fixAll.biome
instead ofquickfix.biome
?Q2. Is it okey for
typescript-language-features
to react toquickfix.biome
?This delay occurs because
typescript-language-features
is reacting toquickfix.biome
. I feel thattypescript-language-features
is overly sensitive to code actions. Is this the intended behavior?Should
typescript-language-features
be modified to react only toquickfix
andquickfix.ts
?Q3. Is it okay that the
source.fixAll.ts
code action does not wait for 500ms?In the
quickfix
code action, there is a 500ms wait, but in thesource.fixAll.ts
code action, this does not occur.vscode/extensions/typescript-language-features/src/languageFeatures/fixAll.ts
Lines 211 to 220 in 684f9d4
Therefore, in the
source.fixAll.ts
code action, there is a possibility that code fixes are performed based on old diagnostics. Is this the intended behavior?The text was updated successfully, but these errors were encountered: