redhat-developer / redhat-developer/vscode-java

All sources open as java even when they are not.

Open
#1,026 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug highlighting navigation
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

Go to definition opens external sources as a .class file. As far as I can tell a file extension can only belong to a single language. In this case .class is related to java? The actual source file that corresponds to the .class file is not always a .java file. I suspect that if the source was opened as a .java, .scala, .clj etc... vscode would give proper syntax highlighting for the source

Environment
  • Operating System: OSX 10.14.5
  • JDK version: 1.8.0_162
  • Visual Studio Code version: 1.36.1
  • Java extension version: redhat.java@0.47.0
Steps To Reproduce
  1. Include a maven dependency that is not written in java.
  2. Go to definition for a class in that dependency.

Here is a sample project includes a scala kafka client. org.sample.app.App declares a SimpleConsumer, F12 on it.
non-java-dep-sources-sample.zip

Current Result

The source opens as a .class file and attempts to use the java syntax highlighting.
Screen Shot 2019-08-08 at 12 33 04 AM

Expected Result

I would expect the source to not be assumed as java. With the scala extension installed I would expect scala highlighting to work.
Scala extension: https://marketplace.visualstudio.com/items?itemName=scala-lang.scala

Additional Informations

I did see #786 and it said that the .class extension is working as designed. I see this as a short coming. The .class extension makes sense if you are viewing decompiled code, but not once sources are available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Go to definition flow for external sources and reproduce the behavior using the linked non-java-dep-sources-sample.zip project, including its Scala Kafka client. Trace why available sources are opened as .class files, then verify that the source is no longer assumed to be Java and that the installed Scala extension can provide highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, scala, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.