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

Read files without triggering onDidOpenTextDocument. #584

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

rgrunber
Copy link
Member

@rgrunber rgrunber commented Feb 7, 2023

  • vscode.workspace.openTextDocument(..) will trigger the vscode.workspace.onDidOpenTextDocument(..) callback
  • Some extensions (eg. vscode-java) may relay on this (particularly for pom files) in order to activate other functionality generating a false positive (ie. pom file was "opened")

Signed-off-by: Roland Grunberg rgrunber@redhat.com

I was able to reproduce this by having vscode-quarkus + vscode-pde installed (with all associated dependencies), and then opening eclipse.jdt.ls as a project, and ensuring that some Java source file is opened. Once the project is loaded, you should see a flurry of notifications opening and disappearing very quickly. They all appear to be from the vscode-java dependency analytics prompt.

dep-analytics-popup

@rgrunber rgrunber added the bug Something isn't working label Feb 7, 2023
@rgrunber rgrunber added this to the 1.13.0 milestone Feb 7, 2023
src/extension.ts Outdated Show resolved Hide resolved
@datho7561
Copy link
Contributor

I don't think I see popups, but I do see something on the left of the bottom bar. Is this what you are mentioning? If so, then this PR does prevent that from happening.

src/extension.ts Outdated
@@ -157,14 +158,21 @@ async function isQuarkusProject(): Promise<boolean> {
if (!workspace.workspaceFolders) {
return false;
}
for (const ws of workspace.workspaceFolders) {
Promise.all(workspace.workspaceFolders.map(async ws => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to return the value of this promise

- vscode.workspace.openTextDocument(..) will trigger the
  vscode.workspace.onDidOpenTextDocument(..) callback
- Some extensions (eg. vscode-java) may relay on this (particularly for
  pom files) in order to activate other functionality generating a false
  positive (ie. pom file was "opened")

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works well. Thanks, Roland!

@datho7561 datho7561 merged commit 42d4690 into redhat-developer:master Feb 8, 2023
@rgrunber rgrunber deleted the use-fs-reads branch February 8, 2023 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants