microsoft / microsoft/TypeScript
[tsserverlibrary] Allow reporting helpful links and error-names
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
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:
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the tsserverlibrary diagnostic and language-service API types, then compare their Diagnostic code shape with the linked vscode-languageserver-node definition. Done means preserving numeric diagnostic codes while allowing the proposed string and helpful-link forms for plugin-reported diagnostics; the payload names no tests or implementation files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100