redhat-developer / redhat-developer/vscode-java

Imports are not included in the document symbols returned from "getDocumentSymbols" API

Open
#1,658 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API help wanted
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

Hi

I am writing a vscode extension and I want to get the symbols of a JAVA file.

Environment
Operating System: windows 10
Visual Studio Code version: 1.50.0

Steps To Reproduce
If I run this sample code :

`const vscodeCDSExtension = extensions.getExtension("redhat.java");
const javaDocParams : DocumentSymbolParams = {
textDocument: {
uri: Uri.file(filePath).toString()
}
};

if (vscodeCDSExtension && vscodeCDSExtension.isActive) {
const symbols = await vscodeCDSExtension.exports.getDocumentSymbols(javaDocParams);
console.log(symbols.length);
}`

Current Result
The "imports" of the file are not included in the returned symbols (only "package", classes and methods are returned)

Expected Result
The "imports" also should be included in the result

The JAVA file is attached

CatalogServiceHandler.zip

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 by reproducing the getDocumentSymbols API call from the issue with the attached CatalogServiceHandler.zip Java file. Trace how package, classes, and methods are returned, then verify that import declarations are included in the symbols result and add or update coverage if the repository provides a matching test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.