Improve forward compatibility with TypeScript Compiler API#230
Conversation
|
There was a problem hiding this comment.
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
...argspattern 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), |
There was a problem hiding this comment.
[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.
| createPreferencesForCompletion(options ?? {}, config), | |
| const [fileName, position, , ...rest] = args; | |
| const prior = languageService.getCompletionsAtPosition( | |
| fileName, | |
| position, | |
| createPreferencesForCompletion(args[2] ?? {}, config), |
ref: #228