Skip to content

add Unnecessary tag to unused var diagnostics#2387

Merged
Techatrix merged 1 commit intozigtools:masterfrom
The-Briel-Deal:zls_unnecessary_diagnostics
Jul 10, 2025
Merged

add Unnecessary tag to unused var diagnostics#2387
Techatrix merged 1 commit intozigtools:masterfrom
The-Briel-Deal:zls_unnecessary_diagnostics

Conversation

@The-Briel-Deal
Copy link
Contributor

Problem: Currently unused var and const declarations produce a diagnostic error without lsp.types.DiagnosticTag.Unnecessary. This means that editors can't visually display that a variable is unused by dimming the highlight on the variable.

Solution: When ast-check produces a "unused local constant" or "unused local variable" diagnostic, we should add the Unnecessary tag to the LSP diagnostic.

@The-Briel-Deal The-Briel-Deal force-pushed the zls_unnecessary_diagnostics branch from c00063e to 76d60f1 Compare July 2, 2025 18:04
@The-Briel-Deal The-Briel-Deal force-pushed the zls_unnecessary_diagnostics branch 4 times, most recently from d2ed12a to 06646bf Compare July 7, 2025 14:04
@The-Briel-Deal The-Briel-Deal requested a review from Techatrix July 7, 2025 14:05
@The-Briel-Deal The-Briel-Deal force-pushed the zls_unnecessary_diagnostics branch from 06646bf to e5bf19b Compare July 8, 2025 15:05
@The-Briel-Deal The-Briel-Deal requested a review from Techatrix July 8, 2025 15:08
@The-Briel-Deal The-Briel-Deal force-pushed the zls_unnecessary_diagnostics branch from e5bf19b to 843420f Compare July 9, 2025 13:33
@The-Briel-Deal
Copy link
Contributor Author

It looks to me like CI was failing on the last run because I didn't have the version tags on my fork. All tests run from zig build test pass locally.

@Techatrix
Copy link
Member

There has been a recent breaking change in Zig which has caused the CI to fail. This will be addressed soon by #2394.

@The-Briel-Deal
Copy link
Contributor Author

There has been a recent breaking change in Zig which has caused the CI to fail. This will be addressed soon by #2394.

Ok thats good to hear, I just wanted to make sure it wasn't a problem on my side.

Problem: Currently unused var and const declarations produce a
diagnostic error without `lsp.types.DiagnosticTag.Unnecessary`. This
means that editors can't visually display that a variable is unused by
dimming the highlight on the variable.

Solution: When `ast-check` produces a "unused local constant" or "unused
local variable" diagnostic, we should add the Unnecessary tag to the LSP
diagnostic.
@Techatrix Techatrix force-pushed the zls_unnecessary_diagnostics branch from 843420f to 879f347 Compare July 10, 2025 05:42
@Techatrix Techatrix merged commit d87eba9 into zigtools:master Jul 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants