Skip to content

feat: migrate diagnostics & quick-fix actions to language-service#92

Merged
9romise merged 13 commits intomainfrom
diagnostics
Mar 31, 2026
Merged

feat: migrate diagnostics & quick-fix actions to language-service#92
9romise merged 13 commits intomainfrom
diagnostics

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

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: 4aff7620-2745-4303-b633-0847d49ebbc0

📥 Commits

Reviewing files that changed from the base of the PR and between 3660687 and 777cb1c.

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

📝 Walkthrough

Walkthrough

This PR removes the VS Code extension diagnostics and quick‑fix providers and implements diagnostics and code‑action generation inside a new Volar language‑service plugin. Diagnostic rules were refactored to accept explicit ignore lists and emit simplified payloads; a strategy‑based action builder system and version utilities (including formatUpgradeVersion) were added. Shared command and configuration constants were introduced, tests and Vitest config files were updated, and several package/dependency and bundling entries were adjusted.

Possibly related PRs

  • npmx-dev/vscode-npmx PR 68 — Refactors diagnostics and provider wiring (range/code utilities and types) that overlap the new diagnostics types and utils.
  • npmx-dev/vscode-npmx PR 84 — Modifies the same VS Code command/import surface for the add‑to‑ignore command used by the extension.
  • npmx-dev/vscode-npmx PR 87 — Changes the language‑service plugin factory; relates to adding the new diagnostics plugin into the plugin list.
🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author; the description field is empty. Add a descriptive pull request summary explaining the changes made, particularly clarifying the migration of diagnostics and quick-fix actions from the VS Code extension to the language-service package.

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

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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/language-service/src/plugins/diagnostics/rules/dist-tag.ts (1)

2-21: ⚠️ Potential issue | 🟠 Major

checkDistTag does not honour the ignore list.

Despite using the DiagnosticRule contract, this rule never applies ignore filtering, so ignored dist-tag findings will still be emitted. Please handle ignoreList here the same way as the other diagnostics rules.

🧹 Nitpick comments (2)
packages/language-service/src/utils/version.ts (1)

32-33: Accept a smaller input contract here.

This helper only reads rawName, rawSpec, resolvedName, resolvedSpec, and protocol, but taking full DependencyInfo is what forces the assertion in packages/language-service/src/utils/version.test.ts Line 22. A dedicated interface keeps the helper testable without type assertions.

Suggested refactor
 import type { DependencyInfo } from 'npmx-language-core/workspace'
 import { formatPackageId } from 'npmx-language-core/utils'
 
+interface UpgradeVersionInput {
+  rawName: string
+  rawSpec: string
+  resolvedName: string
+  resolvedSpec: string
+  protocol: DependencyInfo['protocol']
+}
+
 const RANGE_PREFIXES = ['>=', '<=', '=', '>', '<']
@@
-export function formatUpgradeVersion(dep: DependencyInfo, target: string): string {
+export function formatUpgradeVersion(dep: UpgradeVersionInput, target: string): string {

As per coding guidelines, "Use interface over type for defining object shapes in TypeScript" and "Avoid as casts—validate instead of using type assertions".

packages/language-service/src/plugins/diagnostics/actions.ts (1)

102-107: The replacement pattern is overly permissive.

The pattern /^"(?<packageName>\S+)"/ only captures the package name at the start. This could match unrelated diagnostics that happen to start with a quoted string. Consider adding more specificity to avoid false matches.

♻️ Suggested pattern refinement

Based on the replacement diagnostic message format from Context snippet 4 ("${resolvedName}" ${message}), you could tighten the pattern:

   replacement: {
-    pattern: /^"(?<packageName>\S+)"/,
+    pattern: /^"(?<packageName>\S+)" (?:is deprecated|has been replaced|should be replaced)/,
     actionBuilders: [
       ignore((g) => g.packageName),
     ],
   },

Alternatively, verify the exact message formats produced by getReplacementInfo to craft an appropriate pattern.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 61adb5d5-3df0-44f3-bfe1-76de07c73da7

📥 Commits

Reviewing files that changed from the base of the PR and between ec7124e and bbf3b7b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (39)
  • .gitignore
  • extensions/vscode/package.json
  • extensions/vscode/src/commands/add-to-ignore.ts
  • extensions/vscode/src/index.ts
  • extensions/vscode/src/providers/code-actions/index.ts
  • extensions/vscode/src/providers/code-actions/quick-fix.test.ts
  • extensions/vscode/src/providers/code-actions/quick-fix.ts
  • extensions/vscode/src/providers/diagnostics/index.ts
  • extensions/vscode/src/state.ts
  • extensions/vscode/tests/__setup__/index.ts
  • extensions/vscode/tsdown.config.ts
  • packages/language-server/package.json
  • packages/language-server/tsdown.config.ts
  • packages/language-service/package.json
  • packages/language-service/src/index.ts
  • packages/language-service/src/plugins/diagnostics/actions.ts
  • packages/language-service/src/plugins/diagnostics/index.ts
  • packages/language-service/src/plugins/diagnostics/rules/__tests__/utils.ts
  • packages/language-service/src/plugins/diagnostics/rules/deprecation.test.ts
  • packages/language-service/src/plugins/diagnostics/rules/deprecation.ts
  • packages/language-service/src/plugins/diagnostics/rules/dist-tag.test.ts
  • packages/language-service/src/plugins/diagnostics/rules/dist-tag.ts
  • packages/language-service/src/plugins/diagnostics/rules/engine-mismatch.test.ts
  • packages/language-service/src/plugins/diagnostics/rules/engine-mismatch.ts
  • packages/language-service/src/plugins/diagnostics/rules/replacement.test.ts
  • packages/language-service/src/plugins/diagnostics/rules/replacement.ts
  • packages/language-service/src/plugins/diagnostics/rules/upgrade.test.ts
  • packages/language-service/src/plugins/diagnostics/rules/upgrade.ts
  • packages/language-service/src/plugins/diagnostics/rules/vulnerability.test.ts
  • packages/language-service/src/plugins/diagnostics/rules/vulnerability.ts
  • packages/language-service/src/plugins/diagnostics/types.ts
  • packages/language-service/src/plugins/diagnostics/utils.ts
  • packages/language-service/src/utils/version.test.ts
  • packages/language-service/src/utils/version.ts
  • packages/language-service/tests/__setup__/msw.ts
  • packages/language-service/vitest.config.ts
  • pnpm-workspace.yaml
  • shared/commands.ts
  • shared/constants.ts
💤 Files with no reviewable changes (9)
  • extensions/vscode/package.json
  • pnpm-workspace.yaml
  • extensions/vscode/src/state.ts
  • extensions/vscode/tsdown.config.ts
  • extensions/vscode/tests/setup/index.ts
  • extensions/vscode/src/providers/code-actions/index.ts
  • extensions/vscode/src/providers/code-actions/quick-fix.test.ts
  • extensions/vscode/src/providers/code-actions/quick-fix.ts
  • extensions/vscode/src/providers/diagnostics/index.ts

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

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