diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-10 18:52:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-10 18:52:54 -0400 |
| commit | a370e788e009fc3170f77a14281e83f8793397fc (patch) | |
| tree | 39fea39eec51b58e6302c31b5b56c6ec9dfc31d1 | |
| parent | c38a228ad96efd1b2cf9f5f1c6a3b9489fd34b70 (diff) | |
| parent | c5c68889a3d1984e00d9637d6cf7195f6039ec81 (diff) | |
Merge pull request #992 from BradLewis/fix/check-symbol-before-code-action
Check if name is referring to a known symbol before adding to the import code action
| -rw-r--r-- | src/server/action.odin | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server/action.odin b/src/server/action.odin index 4a337a3..0c3c74a 100644 --- a/src/server/action.odin +++ b/src/server/action.odin @@ -80,6 +80,10 @@ add_missing_imports :: proc( actions: ^[dynamic]CodeAction, ) { if name, ok := selector.expr.derived.(^ast.Ident); ok { + // If we already know what the name is referring to, don't prompt anything + if _, ok := resolve_type_identifier(ast_context, name^); ok { + return + } for collection, pkgs in build_cache.pkg_aliases { for pkg in pkgs { fullpath := path.join({config.collections[collection], pkg}) @@ -97,7 +101,6 @@ add_missing_imports :: proc( if pkg == name.name { pkg_decl := ast_context.file.pkg_decl - log.error(pkg_decl.end.line) import_edit := TextEdit { range = { start = {line = pkg_decl.end.line + 1, character = 0}, |