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

Make publishing range-less diagnostics valid #1328

Closed
radeksimko opened this issue Aug 2, 2021 · 1 comment
Closed

Make publishing range-less diagnostics valid #1328

radeksimko opened this issue Aug 2, 2021 · 1 comment
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@radeksimko
Copy link
Contributor

It is possible today to publish a diagnostic related to a directory (in many languages representing a module/package/...), rather than a particular file.

The spec however still treats range as mandatory, which means that server always has to pass an "empty" 0,0-0,0 range just to satisfy the protocol.

Would it make sense to make range optional in the spec?

https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnostic

export interface Diagnostic {
	/**
	 * The range at which the message applies.
	 */
	range: Range;

	/**
	 * The diagnostic's severity. Can be omitted. If omitted it is up to the
	 * client to interpret diagnostics as error, warning, info or hint.
	 */
	severity?: DiagnosticSeverity;

	/**
	 * The diagnostic's code, which might appear in the user interface.
	 */
	code?: integer | string;

	/**
	 * An optional property to describe the error code.
	 *
	 * @since 3.16.0
	 */
	codeDescription?: CodeDescription;

	/**
	 * A human-readable string describing the source of this
	 * diagnostic, e.g. 'typescript' or 'super lint'.
	 */
	source?: string;

	/**
	 * The diagnostic's message.
	 */
	message: string;

	/**
	 * Additional metadata about the diagnostic.
	 *
	 * @since 3.15.0
	 */
	tags?: DiagnosticTag[];

	/**
	 * An array of related diagnostic information, e.g. when symbol-names within
	 * a scope collide all definitions can be marked via this property.
	 */
	relatedInformation?: DiagnosticRelatedInformation[];

	/**
	 * A data entry field that is preserved between a
	 * `textDocument/publishDiagnostics` notification and
	 * `textDocument/codeAction` request.
	 *
	 * @since 3.16.0
	 */
	data?: unknown;
}
@dbaeumer
Copy link
Member

dbaeumer commented Aug 9, 2021

Agree. Dups #256

@dbaeumer dbaeumer closed this as completed Aug 9, 2021
@dbaeumer dbaeumer added the *duplicate Issue identified as a duplicate of another issue(s) label Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

2 participants