Skip to content

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

Closed

Description

@fbricon

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

Activity

  1. Eskibear commented on Sep 20, 2018

    @Eskibear
    Member

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

  2. testforstephen commented on Sep 20, 2018

    @testforstephen
    Contributor

    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.

  3. testforstephen commented on Oct 9, 2018

    @testforstephen
    Contributor

    Add logic to wait the DocumentLifeCycleHandler to finish updating.

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions