-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add full support for Diagnostic.code #11765
Conversation
}); | ||
it('should convert a "code" of type "{ value: number, target: Uri }"', () => { | ||
const uri = types.URI.parse('foo://example.com:8042/over/there?name=ferret#nose'); | ||
assert.strictEqual(Converter.convertCode({ value: 'string', target: uri }), 'string'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there's loss of information here. Is there a reason we don't want to include the target
field in the code
when we convert it? I notice that the corresponding code in VSCode does preserve the target
:
Though when they're reconstructing a Diagonstic from the DTO, they ignore the target
. Not very clear (to me) why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colin-grant-work I believe it was done this way due to the conversion of vst.Diagnostic
(vscode-languageserver-types
) which did not support the new type:
theia/packages/plugin-ext/src/main/browser/languages-main.ts
Lines 1072 to 1080 in e96bb5b
function reviveMarker(marker: MarkerData): vst.Diagnostic { | |
const monacoMarker: vst.Diagnostic = { | |
code: marker.code, | |
severity: reviveSeverity(marker.severity), | |
range: reviveRange(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn), | |
message: marker.message, | |
source: marker.source, | |
relatedInformation: undefined | |
}; |
/**
* Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
* are only valid in the scope of a resource.
*/
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 usually appear in the user interface.
*/
code?: number | string;
/**
* A human-readable string describing the source of this
* diagnostic, e.g. 'typescript' or 'super lint'. It usually
* appears in the user interface.
*/
source?: string;
/**
* The diagnostic's message. It usually appears in the user interface
*/
message: string;
/**
* Additional metadata about the diagnostic.
*/
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[];
}
We could from the types-converter
convert fully, and only when it comes time to reviveMarker
we update to ensure the types match.
@EstFoisy Do you plan to look at the review comments? |
Hi @JonasHelming , |
@vince-fugnitto @EstFoisy : Maybe we could get this into the January release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
What it does
Closes #11659.
Add full support for
Diagnostic.code
according to the VS Code API.How to test
CI should pass
Review checklist
Reminder for reviewers