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

Dart extension activates for large workspaces that do not contain Dart projects #3304

Closed
yemikudaisi opened this issue Apr 26, 2021 · 5 comments

Comments

@yemikudaisi
Copy link

image

Any time I try to rename a file from vs code file explorer, I get the message dialog shown above. The thing is, I'm working on a python project without any dart file and I wonder why dart should subscribe when I try to to rename files (not just .py files) in a python project. Regardless of the option I pick from the dialog though, the rename operation ends up successful, reloading does not help I eventually had to disable dart extension. it's even worse for a Java project I attempted with, get's stock at 'running file move participant.....'
Is this a bug ? See dart log below

!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.21.1
Flutter extension: 3.21.0 (not activated)

App: Visual Studio Code
Version: 1.55.2
Platform: win

Workspace type: Unknown (Flutter SDK)
Analyzer type: DAS
Multi-root?: false

Dart SDK:
    Loc: C:\path\to\dart-sdk
    Ver: 2.12.2
Flutter SDK:
    Loc: C:\path\to\flutter
    Ver: 2.0.4

HTTP_PROXY: undefined
NO_PROXY: undefined

Logging Categories:
    General, Analyzer, CommandProcesses, VmService, DevTools, FlutterDaemon, FlutterRun, FlutterTest, PubTest, WebDaemon

Mon Apr 26 2021 [23:42:28 GMT+0100 (West Africa Standard Time)] Log file started
[11:42:47 PM] [Analyzer] [Info] ==> {"id":"8","method":"edit.getRefactoring","params":{"file":"C:\\path\to\\symmetricds_manager\\sdmanager\\core\\utils.py","kind":"MOVE_FILE","length":0,"offset":0,"options":{"newFile":"C:\\path\to\\symmetricds_manager\\sdmanager\\core\\sjdk.py"},"validateOnly":false},"clientRequestTime":1619476967005}
[11:42:47 PM] [Analyzer] [Info] <== {"id":"8","result":{"initialProblems":[{"severity":"FATAL","message":"Unable to create a refactoring"}],"optionsProblems":[],"finalProblems":[]}}
Mon Apr 26 2021 [23:42:52 GMT+0100 (West Africa Standard Time)] Log file ended

@DanTup
Copy link
Member

DanTup commented Apr 28, 2021

There are two problems triggering this:

  1. A bug in Dart-Code - this has been recently fixed in Renames that produce no edits should not trigger VS Code refactor prompt #3253 and will be included in the next release
  2. The Dart extension is active for your Python project and should not be

When the fix for (1) ships this issue will go away, however I'm curious about (2). The Dart extension should only activate when you have Dart files or pubspec.yaml in your workspace. Have you opened a folder that contains them?

There are a few situations where VS Code may activate the Dart extension incorrectly (for example if you open a very large workspace and it times out trying to check for Dart files), but there's unfortunately nothing we can do about that. If it's not that, it would be good to track down though - as activating the Dart extension will result in running the Dart language server unneecessarily.

@DanTup DanTup added awaiting info Requires more information from the customer to progress duplicate labels Apr 28, 2021
@Melvin-Abraham
Copy link

Melvin-Abraham commented May 7, 2021

  1. The Dart extension is active for your Python project and should not be

The 2nd problem is definitely an issue in my case. The Dart extension starts up in most of the workspaces (in my case) no matter whether it has any dart files or not and becomes really annoying when I have to disable the extension on a per workspace basis.

There are a few situations where VS Code may activate the Dart extension incorrectly (for example if you open a very large workspace and it times out trying to check for Dart files)

I do work for the most part with workspaces having JavaScript/TypeScript. In this case, it would probably time out while checking for the files (especially in node_modules) but if it's possible somehow, maybe the extension can skip checking the node_modules directory if that's what is causing the issue. I am not sure about Python workspaces though.

@DanTup
Copy link
Member

DanTup commented May 7, 2021

if it's possible somehow, maybe the extension can skip checking the node_modules directory if that's what is causing the issue.

Unfortunately it's not, as the search is done by VS Code itself. If it takes longer than 7 seconds it gives up, and just activates everything. While it's possible Dart-Code could re-scan the workspace, that would result in it taking longer than if VS Code had finished it, so seems like a bad idea.

I opened an issue with VS Code asking for improvements in this area, you can 👍 it here:

microsoft/vscode#73656

Although I just noticed this interesting workaround in the Rust issue tracker:

rust-lang/rust-analyzer#7268 (comment)

Doing this we could limit the search to fewer levels which would reduce the chance of it happening - I think I might do that.

As for the Python workspaces, you could check what the activationEvent is in the "Log (Extension Host)" output window. Search for the Dart-Code extension and see the reason. If it's something like "workspaceContainsTimeout" then it's likely the same. Otherwise, let me know what it shows.

Screenshot 2021-05-07 at 17 28 13

@DanTup DanTup changed the title Visual Studio Code - Extension 'Dart' wants to make refactoring changes with this file move. Dart extension activates for large workspaces that do not contain Dart projects May 7, 2021
@DanTup
Copy link
Member

DanTup commented May 7, 2021

(I'll re-purpose this issue for the timeout case and implementing the workaround above)

@DanTup DanTup added is enhancement and removed awaiting info Requires more information from the customer to progress duplicate labels May 7, 2021
@DanTup DanTup added this to the v3.23.0 milestone May 7, 2021
@Melvin-Abraham
Copy link

@DanTup Thank you for looking into this. I hope this feature request gets addressed soon from VSCode's team thereby allowing some ways to tackle this issue. Also, if the workaround works out as expected that would be great 😃. I'll look forward to this...

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

No branches or pull requests

3 participants