redhat-developer / redhat-developer/vscode-java

Use a naming convention to ignore the unused variable warning

Open
#2,388 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

For example :

        for (String i : arrayName)
            ArrayListName.add(someIntVariable++);

I need the length of arrayName, but I need not i. Obviously, the language server will prompt the warning of The value of the local variable i is not used.

I can suppress the warning through add @SuppressWarnings("unused") before the method/class. But IntelliJ has a better solution: you can rename i to ignored to suppress this warning. Could we provide a similar function?

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 from the Java language-server handling of the unused local-variable warning described in the issue, and review how IntelliJ treats the name ignored. Determine the supported naming convention and its scope, then verify that renaming i to ignored suppresses the warning without suppressing other unused-variable diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
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.