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

Extension activates when running build tasks #14231

Open
adam-fowler opened this issue Mar 2, 2023 · 14 comments
Open

Extension activates when running build tasks #14231

adam-fowler opened this issue Mar 2, 2023 · 14 comments
Labels
A-vscode vscode plugin issues C-bug Category: bug C-support Category: support questions S-unactionable Issue requires feedback, design decisions or is blocked on other work

Comments

@adam-fowler
Copy link

Open any workspace and regardless of what is in the workspace the rust-analyser extension activates.

rust-analyzer version: 0.3.1418-standalone (4e29820f6 2023-02-26)

@adam-fowler adam-fowler added the C-bug Category: bug label Mar 2, 2023
@lnicola
Copy link
Member

lnicola commented Mar 2, 2023

Our activation events are:

{
     "activationEvents": [
         "onLanguage:rust",
         "onCommand:rust-analyzer.analyzerStatus",
         "onCommand:rust-analyzer.memoryUsage",
         "onCommand:rust-analyzer.reloadWorkspace",
         "onCommand:rust-analyzer.startServer",
         "workspaceContains:*/Cargo.toml",
         "workspaceContains:*/rust-project.json"
     ]
}

I'm not sure it would start in your situation.

@adam-fowler
Copy link
Author

Well whenever I press Cmd+Shift+B. The rust build tasks are available. I also get an error message saying rust-analyzer failed to discover workspace

@lnicola lnicola added the C-support Category: support questions label Mar 2, 2023
@lnicola
Copy link
Member

lnicola commented Mar 2, 2023

That command also activates the CMake extension. It might be that Code activates every extension that exposes a build task.

@adam-fowler
Copy link
Author

adam-fowler commented Mar 2, 2023

The runtime status has

Activation Event: onTaskType:cargo

Ok this might be a vscode issue

@adam-fowler
Copy link
Author

Just found this microsoft/vscode#175821

@lnicola
Copy link
Member

lnicola commented Mar 2, 2023

Yeah, looks like the same issue. I think we can close this one since there's nothing we can do.

@be5invis
Copy link

@lnicola still exists in 1.76.1 (which claims fixed microsoft/vscode#175821). May need further investigation.

@lnicola
Copy link
Member

lnicola commented Apr 5, 2023

Looks like this might have been properly fixed in microsoft/vscode#178679.

@regadas
Copy link

regadas commented May 6, 2023

I believe this is still hapenning with 1.78 and https://github.com/microsoft/vscode/pull/178679 seems to have been reverted microsoft/vscode@558ad31

@arnoson
Copy link

arnoson commented May 29, 2023

This still happens to me (in a platform-io project using c++/arduino code)

@alexandru-dinu
Copy link

alexandru-dinu commented Jun 3, 2023

Still happens.

In my case, I have a simple shell task for code formatting (labelled python-formatting) bound to a keymap. If I run the task via the command palette with Tasks: Run Task > python-formatting, the task runs fine and rust-analyzer does not load. However, if I run the task using the keymap, then rust-analyzer loads and fails with:

rust-analyzer failed to discover workspace

The keymap is defined as:

{
    "key": "ctrl+shift+i",
    "command": "workbench.action.tasks.runTask",
    "args": "python-formatting"
}

which I believe also runs other tasks and not only the one specified in args.

@rafales
Copy link

rafales commented Aug 19, 2023

Will just leave it here:

runTask accepts a type argument which can be used to filter down tasks and avoid activating unnecessary extensions:

          {
            "command": "workbench.action.tasks.runTask",
            "args": {
              "type": "shell",
              "task": "Git Commit"
            }
          }

@lnicola lnicola changed the title Extension activates regardless of whether workspace contains rust Extension activates when running build tasks Aug 23, 2023
@larsch
Copy link

larsch commented Sep 2, 2023

microsoft/vscode#175821 was fixed, closed and then reverted without comment, so the issue remains.

I've created microsoft/vscode#192043, since the original is locked.

@lnicola
Copy link
Member

lnicola commented Aug 26, 2024

microsoft/vscode#192043 is also fixed, does this still happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues C-bug Category: bug C-support Category: support questions S-unactionable Issue requires feedback, design decisions or is blocked on other work
Projects
None yet
Development

No branches or pull requests

9 participants