Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running code actions on save is very slow and breaks imports #214

Open
1 of 3 tasks
OliverJAsh opened this issue May 9, 2024 · 0 comments
Open
1 of 3 tasks

Running code actions on save is very slow and breaks imports #214

OliverJAsh opened this issue May 9, 2024 · 0 comments
Labels

Comments

@OliverJAsh
Copy link

OliverJAsh commented May 9, 2024

VS Code version

1.89.0

Extension version

2.2.2

Biome version

1.7.3

Operating system

  • Windows
  • macOS
  • Linux

Description

When noUnusedImports is enabled, running code actions on save (source.organizeImports.biome + quickfix.biome) is slow and breaks the imports.

Steps to reproduce

Full reduced test case: https://github.com/OliverJAsh/biome-vscode-quickfix-import-issue/compare/1.7.3. Contents inlined below.

Given:

biome.json:

{
    "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
    "linter": {
      "enabled": true,
      "rules": {
        "correctness": {
          "noUnusedImports": "warn"
        }
      }
    }
  }
  

.vscode/settings.json:

{
  "editor.codeActionsOnSave": {
    "source.organizeImports.biome": "explicit",
    "quickfix.biome": "explicit"
  }
}

index.ts:

// @ts-nocheck

import * as APIClientError from 'app/services/api/APIClientError';
import { TPhotoSlug, Codec } from 'app/services/api/Photo/types/PhotoSlug';

APIClientError;
export type F = TPhotoSlug;

// edit this comment and save the file

When I save index.ts and "code actions on save" runs, I notice two things. Firstly, it feels much slower than I would expect it to be. It adds about 500ms-1s to the save operation (see screen recording below). Secondly, I end up with broken imports—this is similar to #179 although note here I'm using the latest version of Biome which—I understand from https://github.com/biomejs/biome/issues/688—is supposed to include the fix.

// @ts-nocheck

import * as APIClientError from 'app/services/api/APIClientError';
import { TPhotoStype lug } from 'app/services/api/Photo/types/PhotoSlug';

APIClientError;
export type F = TPhotoSlug;

// edit this comment and save the file
Screen.Recording.2024-05-09.at.09.51.16.mov

Expected behavior

Save is fast + imports are not broken.

Does this issue occur when using the CLI directly?

Not sure / Not applicable

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant