Skip to content

Commit

Permalink
fix: make type-driven completions publically available with typescrip…
Browse files Browse the repository at this point in the history
…t@next
zardoy committed Feb 17, 2023
1 parent 19c0a03 commit cf8e348
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/configurationType.ts
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ export type Configuration = {
'suggestions.keywordsInsertText': 'none' | 'space'
/**
* Will be `format-short` by default in future as super useful!
* Requires symbol patch
* Requires TypeScript 5.0+
* @default disable
*/
'suggestions.displayImportedInfo': 'disable' | 'short-format' | 'long-format'
@@ -439,7 +439,7 @@ export type Configuration = {
'objectLiteralCompletions.keepOriginal': 'below' | 'above' | 'remove'
/**
* Wether to exclude non-JSX components completions in JSX component locations
* Requires `completion-symbol` patch
* Requires TypeScript 5.0+
* @default false
*/
'experiments.excludeNonJsxCompletions': boolean
@@ -487,7 +487,7 @@ export type Configuration = {
/**
* Enable to display additional information about source declaration in completion's documentation
* For now only displays function's body
* Requires symbol patch
* Requires TypeScript 5.0+
* @default false
*/
displayAdditionalInfoInCompletions: boolean
11 changes: 10 additions & 1 deletion typescript/src/completionsAtPosition.ts
Original file line number Diff line number Diff line change
@@ -83,7 +83,16 @@ export const getCompletionsAtPosition = (
const unpatch = patchBuiltinMethods(c, languageService, isCheckedFile)
const getPrior = () => {
try {
return languageService.getCompletionsAtPosition(fileName, position, options, formatOptions)
return languageService.getCompletionsAtPosition(
fileName,
position,
{
...options,
//@ts-expect-error remove when updated to ts5.0
includeSymbol: true,
},
formatOptions,
)
} finally {
unpatch?.()
}

0 comments on commit cf8e348

Please sign in to comment.