-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Maintain order of DiagnosticRelatedInformation objects in Diagnostic.relatedInformation #63710
Comments
@vector-of-bool Can you please provide us an example for related informations from different files and what is the expected order to be? |
Here's an example: Here's the relevant code snippet which generates this information: const diags = vscode.languages.createDiagnosticCollection('repro-with-related');
const diag = new vscode.Diagnostic(new vscode.Range(0, 0, 999, 999), 'I am an example diagnostic');
diag.relatedInformation = [];
const files = ['file1', 'file2', 'file3'];
for (const i of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) {
const related = new vscode.DiagnosticRelatedInformation(
new vscode.Location(
vscode.Uri.file(files[i % files.length]),
new vscode.Position(10, 40),
),
`Message number ${i}`,
);
diag.relatedInformation.push(related);
}
diags.set(vscode.Uri.file('file.txt'), [diag]); Looking at it, it appears to sort them first lexicographically by filename, then by original insertion order. Calling My intuition is that the original order of the I am also seeing that sometimes a large amount of Also, here's a minimal extension that will reproduce this: |
Should the source of these diagnostics give this information in the correct order? Since it is related info, the source has more context to provide the right order. |
In my real use case, I'm generating the |
Hi, First I just wanted to say thank you for creating this project and it's excellent extension support. Now, onto the topic of my response, I'm facing the same issue as well. I'm trying to use the Here are some screenshots of what I'm working on to maybe better illustrate my use case: |
Yes, I can repro it. Problems view is changing the order. Fixed. |
I thank you kindly for the prompt fix! |
Hello! Thank you for all your hard work!
This is a request regarding the diagnostics API. I was watching closely for #10271, and this may relate to some usages of #1927.
I'm not sure if this is "by design" or just incidental to the way it was implemented, but the ordering of items in the
relatedInformation
array property ofvscode.Diagnostic
objects seems to be ignored when VSCode displays this information in the problems panel.It seems that the ordering within a single file is honored, but related information objects from different files are not ordered relative to each other.
On a barely related note: Is there any push for arbitrary hierarchies of diagnostics?
The text was updated successfully, but these errors were encountered: