Skip to content

Autocompletion not working in and after try/catch block in main method #740

Closed

Description

@Pa3kc123

output

Environment
  • Operating System: Windows 7 x64
  • JDK version: 1.8.0_192
  • Visual Studio Code version: 1.29.1
  • Java extension version: 0.35.0
Steps To Reproduce
  1. Make a main method and put try/catch into it
  2. Try autocomplete any variable in, or after try/catch block
Current Result

Autocompletion only shows word completions (only used words)

Expected Result

List of all variables, that are available at current cursor position

Additional Information

Java extension server does not show any error.

Activity

  1. fbricon commented on Dec 10, 2018

    @fbricon
    Collaborator

    can you enable server tracing ("java.trace.server":"verbose") and collect the logs from the output view (Java Language server)?
    also try:

    • wait for a few seconds between the moment the completions show up and when you hit enter/tab
    • restart vscode
  2. Pa3kc123 commented on Dec 10, 2018

    @Pa3kc123
    Author

    Already tried both of your recommendations. Didn't do anything.
    And here is the log:
    output.log
    Everything in log is generated by steps written in 'Steps to reproduce'. If you need more, just tell

  3. Pa3kc123 commented on Jan 15, 2019

    @Pa3kc123
    Author

    I've found out, that when you wrap for-each loop after line "else if (directory.isDirectory() == true)" to '{' and '}', then IntelliSense works, as it should be.

  4. robstryker commented on Oct 29, 2026

    @robstryker
    Contributor

    I'm not able to replicate this anymore. Used following code:

    public class MyFile {
        int x = Integer.MAX_VALUE;
        int y = Mytest5.VAL;
    
        public static void main(String[] args ) {
            String zzz = "hello";
            zzz.indexOf("h"); // one
            try {
                zzz.charAt(0); // two
            } catch(RuntimeException re) {
                re.getStackTrace(); // three
            }
            zzz.indexOf("h"); // four
        }
    }
    
    

    Autocomplete works at all of one, two, three, and four.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions