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

This is a blocking extension on startup for every project #214

Closed
robole opened this issue Aug 13, 2021 · 0 comments · Fixed by #257
Closed

This is a blocking extension on startup for every project #214

robole opened this issue Aug 13, 2021 · 0 comments · Fixed by #257
Assignees
Labels
type: refactor an improvement to the code structure

Comments

@robole
Copy link

robole commented Aug 13, 2021

Clearly describe the bug

The extension is loaded on startup for every project. This is due to the activationEvents set to * in the package.json. Extensions with this activation event effectively delay VS Code from becoming active.

The VS Code docs gives the following advice on *:

To ensure a great end user experience, please use this activation event in your extension only when no other activation events combination works in your use-case.

Since, there are other activation event combination open, I would consider this a bug. As a comparsion, ESLint uses onStartUpFinished.

What code is needed to reproduce this issue?

Open any project. You can see stylelint is loaded by running the command Developer: Show Running Extensions.

What vscode-stylelint configuration is needed to reproduce the bug?

No config required.

Is this issue related to autofix? (editor.codeActionsOnSave)

No

Which version of vscode-stylelint are you using?

0.86.0

Which version of stylelint are you using?

Latest version.

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

It is a global issue, it is not tied to a specific syntax.

What did you expect to happen?

I would expect stylelint to be loaded only when a file with CSS-like syntax is open.

What actually happened (e.g. what warnings or errors you are getting)?

The extension is always loaded.

While I realise that stylelint targets many different file types and it is hard to target all of these with onLanguage activation events. Maybe, this would be adequate:

"activationEvents": [
    "onLanguage:css",
    "onLanguage:html",
    "onLanguage:javascript",
    "onLanguage:javascriptreact",
    "onLanguage:less",
    "onLanguage:markdown",
    "onLanguage:postcss",
    "onLanguage:sass",
    "onLanguage:scss",
    "onLanguage:source.css.styled",
    "onLanguage:source.markdown.math",
    "onLanguage:styled-css",
    "onLanguage:sugarss",
    "onLanguage:svelte",
    "onLanguage:typescript",
    "onLanguage:typescriptreact",
    "onLanguage:vue",
    "onLanguage:vue-html",
    "onLanguage:vue-postcss",
    "onLanguage:xml",
    "onLanguage:xsl"
  ],

I suggest at the very least, you can change the activation event to onStartUpFinished to ensure it does not delay startup of VS Code.

@robole robole changed the title Remove stylelint as a blocking extension on startup Stylelint is a blocking extension on startup Aug 13, 2021
@robole robole changed the title Stylelint is a blocking extension on startup This is a blocking extension on startup Aug 13, 2021
@robole robole changed the title This is a blocking extension on startup This is a blocking extension on startup for every project Aug 13, 2021
@adalinesimonian adalinesimonian added status: ready to implement is ready to be worked on by someone type: refactor an improvement to the code structure labels Oct 8, 2021
@adalinesimonian adalinesimonian self-assigned this Oct 8, 2021
adalinesimonian added a commit that referenced this issue Oct 8, 2021
Closes #214

Stops this extension from slowing VS Code during startup.
@adalinesimonian adalinesimonian added status: wip is being worked on by someone status: blocked is blocked by another issue or pr and removed status: ready to implement is ready to be worked on by someone status: wip is being worked on by someone status: blocked is blocked by another issue or pr labels Oct 22, 2021
adalinesimonian added a commit that referenced this issue Oct 27, 2021
* refactor: Activate on `onStartupFinished`

Closes #214

Stops this extension from slowing VS Code during startup.

* feat: add API, formatter registration notification

Added so that formatter test can wait until formatter is registered
since VS Code has no API to check if a formatter with a given ID exists.

See microsoft/vscode#135674

* docs: add entry to changelog
@adalinesimonian adalinesimonian added Fixed and removed status: wip is being worked on by someone labels Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: refactor an improvement to the code structure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants