microsoft / microsoft/TypeScript

[tsserverlibrary] Allow reporting helpful links and error-names

Aperta
#39,009 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con i tipi Diagnostic e della language-service API di tsserverlibrary, quindi confronta la forma del loro codice Diagnostic con la definizione collegata di vscode-languageserver-node. Il lavoro è completato quando i codici Diagnostic numerici vengono preservati consentendo al contempo le forme proposte string e helpful-link per i diagnostics segnalati dai plugin; il payload non nomina file di test o di implementazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers, devtools
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.