microsoft / microsoft/TypeScript

[tsserverlibrary] Allow reporting helpful links and error-names

Abierto
#39,009 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

Search Terms

Support Links
Helpful Links
Diagnostic

Suggestion

VSCode now accepts either strings or numbers alongside with a support-link as the code-property of a Diagnostic, which provides the comfort to easily open up a website showing more details about the error:

https://github.com/microsoft/vscode-languageserver-node/blob/9466bf38aef41849b3d48a882e399a34e3127eb2/types/src/main.ts#L581-L624

It would be very awesome if TypeScript language services had the same option to not only pass a number as error-code but also strings and, most importantly, a link containing helpful info.

Use Cases

Basically whenever you use a plugin which reports errors especially when they're a tiny bit too complex to describe them in a few sentences.

Examples

        interceptor.AddMethod(
            "getSemanticDiagnostics",
            (target, delegate, fileName) =>
            {
                let diagnostics = delegate(fileName);
                diagnostics.push(
                    {
                        file: this.Program.getSourceFile(fileName),
                        start: 1,
                        length: 1,
                        messageText: "The member-ordering is incorrect.",
                        category: ts.DiagnosticCategory.Warning,
                        source: "eslint",
                        code: {
                            value: "import/order",
                            target: "https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md"
                        }
                    }
                return diagnostics;
            });

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con los tipos de Diagnostic y de la language-service API de tsserverlibrary y, a continuación, compara la forma de su código Diagnostic con la definición enlazada de vscode-languageserver-node. Se considera terminado cuando se conservan los códigos Diagnostic numéricos y, al mismo tiempo, se permiten las formas propuestas string y helpful-link para los diagnostics informados por plugins; el payload no menciona archivos de pruebas ni de implementación.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
compilers, devtools
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
30/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.