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

Explicitly set diagnosticCollectionName #1548

Merged
merged 1 commit into from
Jul 28, 2023
Merged

Conversation

jpogran
Copy link
Contributor

@jpogran jpogran commented Jul 25, 2023

In general VS Code is supposed to allow multiple extensions to provide diagnositics for a file without collision. There are reported cases where multiple extensions that claim support for the same language overwrite diagnositics. To avoid this, we can set diagnosticCollectionName explicitly and create our own collection.

While we haven't specifically seen this happen for us, it may have happened and we are not the only ones to set it explicitly.

Reference: https://github.com/microsoft/vscode-languageserver-node/blob/f2ff7d55464a1f58f978cb6635bd8865f050553c/client/src/common/client.ts#L1080-L1084

In general VS Code is supposed to allow multiple extensions to provide diagnositics for a file without collision. There are [reported cases](sourcery-ai/sourcery-vscode#121) where multiple extensions that claim support for the same language overwrite diagnositics. To avoid this, we can set diagnosticCollectionName explicitly and create our own collection.

While we haven't specifically seen this happen for us, it may have happened and we are not the only ones to set it explicitly.

Reference: https://github.com/microsoft/vscode-languageserver-node/blob/f2ff7d55464a1f58f978cb6635bd8865f050553c/client/src/common/client.ts#L1080-L1084
@jpogran jpogran self-assigned this Jul 25, 2023
@jpogran
Copy link
Contributor Author

jpogran commented Jul 25, 2023

Repointed to main from experimental #1541

@radeksimko radeksimko marked this pull request as ready for review July 26, 2023 15:05
@radeksimko radeksimko requested a review from a team as a code owner July 26, 2023 15:05
@@ -75,6 +75,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
vscode.workspace.createFileSystemWatcher('**/*.tfvars'),
],
},
diagnosticCollectionName: 'HashiCorpTerraform',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there isn't any conventions for the name. Some extensions choose to reflect the fact that diagnostics come from the LS and some don't, some use spaces, some camelCase. So ... TL;DR LGTM

On a separate note, I would have hoped that VS Code separates out diagnostics produced by different extensions "out of the box" but I suppose I have to adjust my expectations. 😄

@jpogran jpogran merged commit b59a665 into main Jul 28, 2023
@jpogran jpogran deleted the set_diagnostic_collection_name branch July 28, 2023 15:36
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants