apache / apache/netbeans

[VSCode extension] Typing dot autocompletes in unintuitive ways

Open
#5,130 7 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage VSCode Extension
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 16

### What happened

Consider the following code:

```java
class Bar {

static void bar() {
class Foo { static void foo() {} }
// cursor here
}
}
```

Now type `Foo`. At this point NetBeans provides suggestions:

![image](https://user-images.githubusercontent.com/15714253/208899877-c3fc1825-24cd-46ee-a517-250a23d14f53.png)

Then type a dot. Now NetBeans autocompletes `Foo.` to `ForLoopTree.` and gives suggestions for it.

What I expected to happen, is for NetBeans to just add the dot, and give suggestions for the class `Foo` defined in the line above:

![image](https://user-images.githubusercontent.com/15714253/208900562-33ec3e84-1442-47ca-b2c7-bc6a7080b20e.png)

In other words: when what's before the dot is valid in the current context, typing a dot should never (unless there's sensible exceptions I'm missing) autocomplete. When I want to autocomplete to a type, I can easily press Tab or Enter to autocomplete first, and then type the dot.

### How to reproduce

As described in `What happened`.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 11

### JDK

openjdk full version "20-ea+22-1594"

### Apache NetBeans packaging

Apache VSNetBeans for VSCode

### Anything else

_No response_

### Are you willing to submit a pull request?

Yes

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Reproduce the completion behavior in Apache NetBeans 16 using the Java snippet and the Apache VSNetBeans for VSCode packaging. Start by tracing the Java completion path that handles typing a dot after Foo; done means the dot is inserted without replacing a valid Foo reference and suggestions remain scoped to Foo.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.