redhat-developer / redhat-developer/vscode-java
If there's a syntax error inside an arrow function, the entire function is highlighted as an error in the editor
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 546
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
When an arrow function is assigned to a variable with a generic type parameter, and there is a syntax error inside the arrow function, VSCode highlights the entire arrow function as an error. This obscures the location of the syntax error and makes the code difficult to read.
Environment
Version: 1.54.3 (user setup)
Commit: 2b9aebd5354a3629c3aba0a5f5df49f43d6689f8
Date: 2021-03-15T10:55:45.459Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.18362
Steps To Reproduce
Repository: https://github.com/AnthonyWeston/java-test
- Add an arrow function with an undefined variable name inside it, and assign the function to a variable with a generic type parameter:
List<Integer> test = Stream.of("1", "2", "3")
.map(s -> {
int result = Integer.parseInt(s);
return oops;
})
.collect(Collectors.toList());
});
Current Result
VSCode highlights the entire arrow function as an error, obscuring the location of the undefined variable and making the code difficult to read. The error message is "Cannot infer type argument(s) for map(Function<? super T,? extends R>)"

Expected Result
Only the variable assignment is highlighted as an error, and the undefined variable is highlighted as an error and clearly visible.
Additional Information
Logs: https://github.com/AnthonyWeston/java-test/blob/main/log.log
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Usa il repository java-test collegato e l’esempio di arrow-function fornito per riprodurre l’evidenziazione diagnostica in VS Code. Confronta le diagnosi attuali e quelle previste, inclusa la variabile non definita all’interno della arrow function; il lavoro è completo quando l’errore di sintassi viene localizzato invece di evidenziare l’intera funzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, vscode
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100