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

Long diagnostic message field #1461

Open
ratmice opened this issue May 2, 2022 · 2 comments
Open

Long diagnostic message field #1461

ratmice opened this issue May 2, 2022 · 2 comments
Labels
diagnostics feature-request Request for new features or functionality
Milestone

Comments

@ratmice
Copy link

ratmice commented May 2, 2022

In the bug I filed yesterday #1458 discusses tranfsering documents from server to client.
The impetus for that request though was dealing with long diagnostic messages.

Thinking through it a different solution than #1458 might be instead adding an long_message?: string field to diagnostic. This would appear to be a much simpler fix for the problem that I am dealing with, having less weirdness involving uri for the lsp server, and new request types.

@RobbyCBennett
Copy link

RobbyCBennett commented Oct 12, 2023

For a long description, the LSP should support both dynamic and static descriptions. Here's an idea of how this could be implemented.

In CodeDescription add dynamicDescription as an optional string. Make href optional.

export interface CodeDescription {
	/**
	 * An URI to open with general information about the diagnostic error (e.g.
	 * paragraphs of a description, code examples, exceptions, links to sources).
	 * The URI can start with "file:", "https:", or other.
	 */
	href?: URI;

	/**
	 * A string with unique information about this particular instance of the
	 * diagnostic error (e.g. a warning that mentions your variable name
	 * specifcally and the function it was defined in).
	 */
	dynamicDescription?: string;
}

Add a textDocument/publishDiagnosticLongDescriptions method, as a notification from the server to the client. This is to avoid repetition of the long descriptions.

interface PublishDiagnosticLongDescriptionParams extends WorkDoneProgressParams {
	/**
	 * An array of long descriptions for each diagnostic
	 */
	diagnosticLongDescriptions: DiagnosticLongDescription[];
}
interface DiagnosticLongDescription {
	/**
	 * The diagnostic's code, which might appear in the user interface.
	 */
	code: integer | string;

	/**
	 * The static long description of a diagnostic (e.g. paragraphs of a
	 * description, code examples, exceptions, links to sources).
	 */
	longDescription: string;
}

@RobbyCBennett
Copy link

This is a highly requested feature with VS Code, specifically for long dynamic diagnostic descriptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostics feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants