Skip to content

feat: selective imports and auto-import improvements#3

Merged
klaidliadon merged 10 commits into
masterfrom
feat/selective-imports
Mar 30, 2026
Merged

feat: selective imports and auto-import improvements#3
klaidliadon merged 10 commits into
masterfrom
feat/selective-imports

Conversation

@klaidliadon
Copy link
Copy Markdown
Collaborator

Summary

  • Auto-import prefers defining files over re-exporters — when multiple workspace files expose the same type, the LSP now suggests importing from the file that defines it locally, not one that re-exports it
  • Narrowing diagnostics — warns when a full import brings in more types than are used, with a quick fix to convert to inline selective import syntax (import path.ridl + - Member)
  • Unused import diagnostics — warns when an import contributes zero used types, with a quick fix to remove it
  • Transitive re-import diagnostics — warns when a selective import pulls a type from a file that didn't define it, with a quick fix to import from the original source

Test plan

  • Verify auto-import suggests the defining file when a type is re-exported by another file
  • Verify narrowing warning appears for full imports where only a subset of types is used
  • Verify no warning when all exported types are used
  • Verify unused import warning when zero types from an import are referenced
  • Verify narrowing quick fix converts block-form import to valid inline selective import
  • Verify transitive re-import warning when selective import pulls from wrong source
  • Verify transitive quick fix moves member to correct source file
  • Run full test suite: go test ./...

Emit Warning diagnostics when a full import (no member list) only uses
a subset of exported types, suggesting the used names. When zero types
are used, emit an "unused import" warning instead.
Offer a quick fix to rewrite full imports as selective imports with only
the used names. For unused imports, offer removal instead.
Type aliases were parsed into the schema but excluded from all LSP
navigation handlers. Add alias support to findTypeDefinitionToken,
definitionAt, hoverAt, referenceTargetAt, referenceLocations,
locallyDefinedNames, unresolvedSymbols, and referencedNames.
feat(lsp): type alias navigation and references
@klaidliadon klaidliadon merged commit a91429e into master Mar 30, 2026
1 check 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.

1 participant