★ wanayoo — archive 1999 https://github.com/microsoft/vscode-java-debug/issues/438Nouvelle recherche | Portail wanayoo
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

Code lenses for Run/Debug links on main methods don't show up immediately #438

Closed
fbricon opened this issue Sep 19, 2018 · 3 comments
Closed
Assignees
Labels
bug
Milestone

Comments

@fbricon
Copy link
Collaborator

@fbricon fbricon commented Sep 19, 2018 •

Code lenses for Run/Debug links on main methods don't show up immediately

Environment
  • Operating System: macOS 10.13
  • JDK version: 1.8
  • Visual Studio Code version: 1.27.2
  • Java extension version: 0.31.0
  • Java Debugger extension version: 0.13.0
Steps To Reproduce
  1. Create a simple java class
  2. Copy and paste this main method into the class
	public static void main(String[] args) {
		System.out.print("hello");
	}
  1. Run/Debug code lenses don't show up
  2. Save file or type any character in the file
  3. Run/Debug code lenses show up
Current Result

Run/Debug code lenses don't show up immediately

Expected Result

Run/Debug code lenses should show up immediately after the public static main method is added

@Eskibear
Copy link
Member

@Eskibear Eskibear commented Sep 20, 2018

Same behavior for the "main" snippet, it takes about 6 seconds to show up if you don't save or type any character.

@testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Sep 20, 2018 •

When the user is editing the textDocument, there are two events happening in the Language Server Protocol level.

  • vscode will call provideCodeLenses interface registered by java-debug to update CodeLens.
  • vscode will send document/didChange to jdt.ls about the changed text.

The implementation of these two handlers both will operate the CompilationUnit object of the current file. java-debug will read CompilationUnit to resolve main method. On the other hand, vscode-java will update the CompilationUnit with the new changed text. It's a resource contention problem.

In the bug description, what java-debug got is an old CompilationUnit so that the user feels like a delay.

@testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Oct 9, 2018

Add logic to wait the DocumentLifeCycleHandler to finish updating.

@sallyur sallyur mentioned this issue Oct 10, 2018
10 of 11 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.