summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-10-06 06:31:50 -0400
committerGitHub <noreply@github.com>2025-10-06 06:31:50 -0400
commite03b24e88a0930912fc4936c4088568173f357cf (patch)
treec2ff4ab4a1342c74192d58617befaf25f88fcba3
parent7916a277e4597e869262a7685bc0b51b5af7916f (diff)
parent1d5ab38b50b4655dd1b83be94316f62fb21d0870 (diff)
Merge pull request #1079 from BradLewis/fix/run-check-unused-on-refresh
Run check unused imports on document refresh
-rw-r--r--src/server/documents.odin2
-rw-r--r--src/server/imports.odin2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/server/documents.odin b/src/server/documents.odin
index a23fdf2..cec42cb 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -321,6 +321,8 @@ document_refresh :: proc(document: ^Document, config: ^common.Config, writer: ^W
remove_diagnostics(.Syntax, document.uri.uri)
remove_diagnostics(.Check, document.uri.uri)
+ check_unused_imports(document, config)
+
if writer != nil && !config.disable_parser_errors {
document.diagnosed_errors = true
diff --git a/src/server/imports.odin b/src/server/imports.odin
index 498af33..256295b 100644
--- a/src/server/imports.odin
+++ b/src/server/imports.odin
@@ -26,7 +26,7 @@ find_unused_imports :: proc(document: ^Document, allocator := context.temp_alloc
unused := make([dynamic]Package, allocator)
for imp in document.imports {
- if imp.name not_in pkgs {
+ if imp.base != "_" && imp.name not_in pkgs {
append(&unused, imp)
}
}