Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ export function handleShorthand() {
//^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`object-literals-call-signatures.ts`/consumesInterface().
interfaceMethod,
// ^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Superinterface#interfaceMethod().
// ^^^^^^^^^^^^^^^ reference local 26
property,
// ^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Superinterface#property.
// ^^^^^^^^ reference local 23
})
}

21 changes: 21 additions & 0 deletions src/FileIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,27 @@ export class FileIndexer {
break
}
}
// Shorthand properties in typed contexts: also emit local variable reference.
// When getDeclarationsForPropertyAssignment finds type-side declarations,
// isDefinitionNode is false, so handleShorthandPropertyDefinition is never
// called. This block emits the missing local variable reference.
if (
declarations.length > 0 &&
ts.isShorthandPropertyAssignment(node.parent)
) {
const valueSymbol =
this.checker.getShorthandAssignmentValueSymbol(node.parent)
if (valueSymbol) {
for (const decl of valueSymbol.declarations || []) {
const scipSymbol = this.scipSymbol(decl)
if (!scipSymbol.isEmpty()) {
this.pushOccurrence(
new scip.scip.Occurrence({ range, symbol: scipSymbol.value })
)
}
}
}
}
}

/**
Expand Down
Loading