Skip to content

feat: migrate completion to language-service#93

Merged
9romise merged 3 commits intomainfrom
completion
Mar 31, 2026
Merged

feat: migrate completion to language-service#93
9romise merged 3 commits intomainfrom
completion

Conversation

@9romise
Copy link
Copy Markdown
Member

@9romise 9romise commented Mar 31, 2026

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

The PR migrates version completion functionality from the VS Code extension layer to the language service layer. It removes the extension's VersionCompletionItemProvider class, completion-item setup function, and version-formatting utilities from extensions/vscode/. In parallel, it introduces a new npmx-version-completion language service plugin in packages/language-service/src/plugins/version-completion.ts that provides equivalent version completion capabilities, including filtering deprecated and prerelease versions, restricting to npm-protocol dependencies, and applying provenance filters when configured. The new plugin is registered within the language service plugin factory function.

Possibly related PRs

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request has no author-provided description, making it impossible to assess whether the stated intent aligns with the changeset. Add a pull request description that explains the migration from VS Code extension-based completion to language-service-based completion, including rationale and any breaking changes.

✏️ 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 completion

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


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
Copy Markdown
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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a62aa3e3-3726-4ffe-815a-e27e5fee3fd0

📥 Commits

Reviewing files that changed from the base of the PR and between abc9331 and 682df0c.

📒 Files selected for processing (7)
  • extensions/vscode/src/index.ts
  • extensions/vscode/src/providers/completion-item/index.ts
  • extensions/vscode/src/providers/completion-item/version.ts
  • extensions/vscode/src/utils/version.test.ts
  • extensions/vscode/src/utils/version.ts
  • packages/language-service/src/index.ts
  • packages/language-service/src/plugins/completion.ts
💤 Files with no reviewable changes (5)
  • extensions/vscode/src/index.ts
  • extensions/vscode/src/providers/completion-item/index.ts
  • extensions/vscode/src/utils/version.test.ts
  • extensions/vscode/src/utils/version.ts
  • extensions/vscode/src/providers/completion-item/version.ts

Copy link
Copy Markdown
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.

🧹 Nitpick comments (2)
packages/language-service/src/plugins/version-completion.ts (2)

46-57: Consider defensive access instead of non-null assertion.

The non-null assertion on line 47 is safe because we're iterating over the object's own keys, but a defensive check would be more robust against future refactoring.

Optional defensive pattern
          for (const version in pkg.versionsMeta) {
-            const meta = pkg.versionsMeta[version]!
+            const meta = pkg.versionsMeta[version]
+            if (!meta)
+              continue

62-67: Prefer using CompletionItemKind.Value directly instead of magic number.

The magic number 12 with satisfies provides type safety but reduces readability. Import CompletionItemKind as a value to use it directly.

Proposed refactor

Update the import at line 1:

-import type { CompletionItemKind, CompletionList, LanguageServicePlugin, LanguageServicePluginInstance } from '@volar/language-service'
+import { CompletionItemKind } from '@volar/language-service'
+import type { CompletionList, LanguageServicePlugin, LanguageServicePluginInstance } from '@volar/language-service'

Then update line 64:

            items.push({
              label: text,
-              kind: 12 satisfies typeof CompletionItemKind.Value,
+              kind: CompletionItemKind.Value,
              insertText: text,
              detail: tag,
            })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef76a433-ef5b-41f6-9fc6-2dcfaba3cfb3

📥 Commits

Reviewing files that changed from the base of the PR and between 682df0c and b113ca0.

📒 Files selected for processing (2)
  • packages/language-service/src/index.ts
  • packages/language-service/src/plugins/version-completion.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/language-service/src/index.ts

@9romise 9romise added this pull request to the merge queue Mar 31, 2026
Merged via the queue into main with commit e3a9a92 Mar 31, 2026
11 checks passed
@9romise 9romise deleted the completion branch March 31, 2026 09:58
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