Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tsserverlibrary] Allow reporting helpful links and error-names #39009

Open
5 tasks done
manuth opened this issue Jun 10, 2020 · 1 comment
Open
5 tasks done

[tsserverlibrary] Allow reporting helpful links and error-names #39009

manuth opened this issue Jun 10, 2020 · 1 comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@manuth
Copy link
Contributor

manuth commented Jun 10, 2020

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.
@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Jun 16, 2020
@manuth
Copy link
Contributor Author

manuth commented Sep 21, 2020

@RyanCavanaugh is there anything I need to provide in order to start working on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants