Skip to content

Commit ccbdca7

Browse files
committed
fix: ban method snippets for export {...}
1 parent 5e2c192 commit ccbdca7

File tree

3 files changed

+8
-211
lines changed

3 files changed

+8
-211
lines changed

pnpm-lock.yaml

Lines changed: 6 additions & 211 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typescript/src/completions/isGoodPositionMethodCompletion.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const isGoodPositionBuiltinMethodCompletion = (ts: typeof tslib, sourceFi
1212
// type A = typeof obj["|"]
1313
if (ts.isStringLiteralLike(currentNode)) return false
1414
if (ts.isIdentifier(currentNode)) currentNode = currentNode.parent
15+
if (ts.isExportSpecifier(currentNode)) return false
1516
if (ts.isJsxSelfClosingElement(currentNode) || ts.isJsxOpeningElement(currentNode)) return false
1617
if (ts.isBindingElement(currentNode) || ts.isShorthandPropertyAssignment(currentNode)) currentNode = currentNode.parent
1718
if (ts.isObjectBindingPattern(currentNode) || ts.isObjectLiteralExpression(currentNode)) return false

typescript/test/completions.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ test('Banned positions', () => {
115115
test('Banned positions for all method snippets', () => {
116116
const cursorPositions = newFileContents(/* tsx */ `
117117
import {/*|*/} from 'test'
118+
export {/*|*/} from 'test'
118119
const obj = { m$1e$2thod() {}, arrow: () => {} }
119120
type A = typeof obj["/*|*/"];
120121
a(({ a/*|*/ }) => {})

0 commit comments

Comments
 (0)