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
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.3k
- Forks
- 546
- Merge medio
- 20 h 1 min
- PR fusionados (30 d)
- 11
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Usa el repositorio java-test enlazado y el ejemplo de arrow-function proporcionado para reproducir el resaltado de diagnósticos en VS Code. Compara los diagnósticos actuales y esperados, incluida la variable no definida dentro de la arrow function; se considera hecho cuando el error de sintaxis se localiza en lugar de resaltarse toda la función.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java, vscode
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 35/100