Skip to content

feat: Typescript ignore type imports setting#119

Merged
magic5644 merged 5 commits into
magic5644:mainfrom
oscar30gt:feature/typescript-ignore-type-imports
Jul 3, 2026
Merged

feat: Typescript ignore type imports setting#119
magic5644 merged 5 commits into
magic5644:mainfrom
oscar30gt:feature/typescript-ignore-type-imports

Conversation

@oscar30gt

@oscar30gt oscar30gt commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

React and Typescript developer here. I use this extension on my projects to check and fix circular dependencies in my codebase. Sometimes i just want to import a type, thing that many bundlers like vite ignore. I don't want a "cycle" error to show up in that cases. This feature adds a new boolean configuration item (graph-it-live.ignoreTypeImports) that defaults to false. When toggled on, type imports and exports are completely ignored on the graph, giving a cleaner view which closer to what bundlers see when packaging.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Build/packaging
  • Documentation
  • Tests

Validation evidence

Every test passed.
The only error I'm getting:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  tests/integration/BuildVerification.test.ts > Build Verification > .vsix package WASM files
Error: spawnSync npx.cmd EINVAL
 ❯ tests/integration/BuildVerification.test.ts:122:24
    120|       // --no-dependencies skips @types/vscode vs engines.vscode …
    121|       try {
    122|         const output = execFileSync(
       |                        ^
    123|           process.platform === 'win32' ? 'npx.cmd' : 'npx',
    124|           ['vsce', 'ls', '--no-dependencies'],

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

I think it is related with Windows rather than the implementation of the feature.

Quality

  • npm run lint
  • npm run check:types
  • npm test (Only 1 error: related with windows, it existed with a clean clone)
  • Sonar clean on modified files (no new issues)

VSIX / Packaging (required when build config or deps changed)

  • npm run package:verify✅ No .map files in package
  • npx vsce ls graph-it-live-*.vsix | grep "\.wasm$" shows required WASM files (windows doesnt have grep command, I couldn't test it)
  • ls -lh graph-it-live-*.vsix size checked (target ≤ 16 MB, warn above)

E2E

  • npm run test:vscode:vsix (required for user-facing changes)

Checklist

  • Tests added/updated for changed behavior
  • Docs updated (if needed)
  • Cross-platform impact considered (Windows/Linux/macOS)
  • No vscode import added under src/analyzer/** or src/mcp/**

Note

Sometimes, i need to restart the extension for the changes to apply. It also happens to me with the exclude node modules setting.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-in setting to ignore TypeScript type-only imports/exports when building the dependency graph, aligning cycle detection more closely with what common bundlers include at runtime.

Changes:

  • Introduces graph-it-live.ignoreTypeImports configuration and plumbs it through extension config → SpiderBuilder → worker/analyzer services.
  • Updates TypeScript analyzer caching to differentiate parsers based on the ignore-types setting.
  • Adds/updates tests covering config snapshot + builder chaining + analyzer caching + basic type-only import/export parsing.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/extension/ProviderStateManager.test.ts Verifies ignoreTypeImports is captured in the provider config snapshot.
tests/analyzer/SpiderBuilder.test.ts Extends fluent API chaining test to include withIgnoreTypeImports.
tests/analyzer/parser-type-imports.test.ts Adds parser tests for ignoring type-only imports/exports (needs expansion for TS 5+ syntax).
tests/analyzer/LanguageService.test.ts Ensures analyzer cache separates instances when ignoreTypeImports differs.
src/extension/services/ProviderStateManager.ts Adds ignoreTypeImports to the extension’s configuration snapshot.
src/extension/services/graphProviderServiceContainer.ts Wires snapshot value into SpiderBuilder.withIgnoreTypeImports(...).
src/analyzer/types.ts Adds ignoreTypeImports to SpiderConfig.
src/analyzer/SpiderBuilder.ts Stores/configures ignoreTypeImports and passes it to LanguageService.
src/analyzer/spider/SpiderWorkerManager.ts Passes ignoreTypeImports through worker build options.
src/analyzer/spider/SpiderIndexingService.ts Includes ignoreTypeImports in worker startup config.
src/analyzer/Parser.ts Implements initial skipping of type-only imports/exports (currently incomplete for TS 5+ specifier syntax).
src/analyzer/LanguageService.ts Adds ignore-types flag to TS parser cache key and passes it into Parser.
src/analyzer/IndexerWorkerHost.ts Extends worker config shape to include ignoreTypeImports.
src/analyzer/IndexerWorker.ts Constructs LanguageService with ignoreTypeImports in the worker.
package.json Adds graph-it-live.ignoreTypeImports setting declaration.
package-lock.json Lockfile update (removes some libc metadata entries).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/analyzer/Parser.ts
Comment thread tests/analyzer/parser-type-imports.test.ts
oscar30gt and others added 5 commits July 3, 2026 09:23
Old version was only ignoring "import type" and "export type" clauses. Now import/export { type foo, type bar} from ... is also recognized as a type import/export

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@magic5644 magic5644 force-pushed the feature/typescript-ignore-type-imports branch from ef03b68 to 1c289aa Compare July 3, 2026 07:28

@magic5644 magic5644 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

OK, I made some adjustments on tests, this PR is LGTM

@magic5644 magic5644 merged commit 86ac7d6 into magic5644:main Jul 3, 2026
8 checks passed
@oscar30gt oscar30gt deleted the feature/typescript-ignore-type-imports branch July 3, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants