Skip to content

refactor: move WorkspaceContext to language-core with adapter pattern#86

Merged
9romise merged 2 commits intomainfrom
workspace
Mar 21, 2026
Merged

refactor: move WorkspaceContext to language-core with adapter pattern#86
9romise merged 2 commits intomainfrom
workspace

Conversation

@9romise
Copy link
Member

@9romise 9romise commented Mar 21, 2026

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3c0ef7f9-292f-4585-a403-5c791e75da0c

📥 Commits

Reviewing files that changed from the base of the PR and between 0ac72a9 and 811fab4.

📒 Files selected for processing (2)
  • extensions/vscode/src/core/workspace.ts
  • extensions/vscode/src/providers/definition/catalog.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • extensions/vscode/src/providers/definition/catalog.ts

📝 Walkthrough

Walkthrough

This pull request extracts workspace-level context and dependency-resolution logic from the VS Code extension into a new WorkspaceContext implementation in packages/language-core/src/workspace.ts, and exposes it via ./workspace in the package exports. The VS Code extension code now imports and uses the external WorkspaceContext, DependencyInfo, and WorkspaceAdapter types, passes plain path strings (e.g. uri.path or rootPath) into the new API (instead of Uri objects), and adapts extension adapters (e.g. createVscodeAdapter) to satisfy the new WorkspaceAdapter surface. Multiple files update type imports to npmx-language-core/workspace and switch runtime calls to use file paths; cache invalidation and loaders now accept path strings.

Possibly related PRs

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request has no description provided by the author, making it impossible to assess whether the stated intent matches the changeset. Add a pull request description explaining the rationale, motivation, and impact of the refactoring, particularly detailing why moving WorkspaceContext to language-core with an adapter pattern improves the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch workspace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/language-core/src/workspace.ts (1)

110-115: Avoid using any type.

The CacheOptions<any, [string]> uses any which violates the coding guidelines. Consider using a more specific type for the return value.

♻️ Suggested fix
-  `#cacheOptions`: CacheOptions<any, [string]> = {
+  `#cacheOptions`: CacheOptions<unknown, [string]> = {
     getKey: (path) => path,
     maxAge: 0,
     swr: false,
     staleMaxAge: 0,
   }

As per coding guidelines: "Never use any type in TypeScript".


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 63d58f83-fded-458e-87b5-2ddf3d91c0a8

📥 Commits

Reviewing files that changed from the base of the PR and between 9600da9 and 0ac72a9.

📒 Files selected for processing (14)
  • extensions/vscode/src/composables/workspace-context.ts
  • extensions/vscode/src/core/workspace.ts
  • extensions/vscode/src/providers/definition/catalog.ts
  • extensions/vscode/src/providers/diagnostics/index.ts
  • extensions/vscode/src/providers/diagnostics/rules/engine-mismatch.ts
  • extensions/vscode/src/providers/diagnostics/rules/upgrade.test.ts
  • extensions/vscode/src/providers/diagnostics/rules/upgrade.ts
  • extensions/vscode/src/providers/hover/resolve.test.ts
  • extensions/vscode/src/providers/hover/resolve.ts
  • extensions/vscode/src/utils/version.test.ts
  • extensions/vscode/src/utils/version.ts
  • packages/language-core/package.json
  • packages/language-core/src/workspace.ts
  • packages/language-core/tsdown.config.ts

@9romise 9romise added this pull request to the merge queue Mar 21, 2026
Merged via the queue into main with commit f7a9ffc Mar 21, 2026
11 checks passed
@9romise 9romise deleted the workspace branch March 21, 2026 16:47
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