apache / apache/netbeans

Wrong code completion when importing $ classes in VSCode

Open
#6,232 0 comments 0 reactions 1 assignee Claimed by @dbalek 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 18

### What happened

We are importing scala classes and innerclasses in our project and have to do it with `$` (not `.`) syntax. Code completion seems to be fine with that:

![code completion alternatives](https://github.com/apache/netbeans/assets/1842422/b2268d07-0a5f-440b-9bd1-eeb226084cef)

however when I press Enter on any of the items, it is improperly inserted:

![result after pressing enter](https://github.com/apache/netbeans/assets/1842422/d529f13d-0e11-418a-a1f1-55302f839d90)

probably the `$` in the class name confuses the system.

### How to reproduce

Here are [the instructions](https://github.com/enso-org/enso/tree/develop/tools/enso4igv#building-vscode-extension) to build the _Enso VSCode Extension_ and open the Enso sources. But I assume this problem is going to appear with any `$` based import (from Scala) of deeply nested classes.

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

No, the behavior was always broken.

### Operating System

Linux

### JDK

JDK-11

### Apache NetBeans packaging

Apache VSNetBeans for VSCode

### Anything else

If you want to know why we are using the `$` and not `.` variant, you may want to take a look at https://github.com/enso-org/enso/issues/7017 - TL;DR: clearly Scala and Java don't agree on the way they perceive (deeply nested) inner classes. The good aspect is that NetBeans is way better in treating these _nuances_ than [competion](https://user-images.githubusercontent.com/292128/245184766-0850ec83-1dc9-41f6-a108-5c2c0bc33669.png).

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

Yes, if I get some guidance, I can create a PR.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.