Skip to content

Improve forward compatibility with TypeScript Compiler API#230

Merged
mizdra merged 1 commit into
mainfrom
refactor-language-service
Aug 8, 2025
Merged

Improve forward compatibility with TypeScript Compiler API#230
mizdra merged 1 commit into
mainfrom
refactor-language-service

Conversation

@mizdra
Copy link
Copy Markdown
Owner

@mizdra mizdra commented Aug 8, 2025

ref: #228

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Aug 8, 2025

⚠️ No Changeset found

Latest commit: 5a6fb07

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mizdra mizdra marked this pull request as ready for review August 8, 2025 15:52
@mizdra mizdra requested a review from Copilot August 8, 2025 15:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves forward compatibility with the TypeScript Compiler API by updating function signatures to use rest parameters instead of explicit parameter lists. This change makes the code more resilient to future API changes where additional parameters might be added to TypeScript's language service methods.

  • Updates function signatures to use ...args pattern for better forward compatibility
  • Removes explicit parameter destructuring in favor of array destructuring from rest parameters
  • Eliminates ESLint max-params violations by using rest parameters

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
syntactic-diagnostic.ts Updates getSyntacticDiagnostics to use rest parameters
semantic-diagnostic.ts Updates getSemanticDiagnostics to use rest parameters
refactor.ts Updates getEditsForRefactor to use rest parameters
completion.ts Updates completion functions to use rest parameters
code-fix.ts Updates getCodeFixesAtPosition to use rest parameters

const prior = languageService.getCompletionsAtPosition(
fileName,
position,
createPreferencesForCompletion(options ?? {}, config),
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The destructuring pattern extracts options but then doesn't use it in the getCompletionsAtPosition call on line 12-17. Instead, options is processed through createPreferencesForCompletion and the rest parameters are spread. Consider making this more explicit by extracting only what's needed.

Suggested change
createPreferencesForCompletion(options ?? {}, config),
const [fileName, position, , ...rest] = args;
const prior = languageService.getCompletionsAtPosition(
fileName,
position,
createPreferencesForCompletion(args[2] ?? {}, config),

Copilot uses AI. Check for mistakes.
@mizdra mizdra changed the title improve forward compatibility with TypeScript Compiler API Improve forward compatibility with TypeScript Compiler API Aug 8, 2025
@mizdra mizdra merged commit c937d4a into main Aug 8, 2025
10 checks passed
@mizdra mizdra deleted the refactor-language-service branch August 8, 2025 16:00
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.

2 participants