Conversation
📝 WalkthroughWalkthroughThe PR migrates version completion functionality from the VS Code extension layer to the language service layer. It removes the extension's Possibly related PRs
🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsTimed 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a62aa3e3-3726-4ffe-815a-e27e5fee3fd0
📒 Files selected for processing (7)
extensions/vscode/src/index.tsextensions/vscode/src/providers/completion-item/index.tsextensions/vscode/src/providers/completion-item/version.tsextensions/vscode/src/utils/version.test.tsextensions/vscode/src/utils/version.tspackages/language-service/src/index.tspackages/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
There was a problem hiding this comment.
🧹 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 usingCompletionItemKind.Valuedirectly instead of magic number.The magic number
12withsatisfiesprovides type safety but reduces readability. ImportCompletionItemKindas 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
📒 Files selected for processing (2)
packages/language-service/src/index.tspackages/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
No description provided.