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
3 changes: 3 additions & 0 deletions snapshots/input/syntax/src/inheritance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export abstract class IntermediateSuperclass extends Superclass {
}
public abstract intermediateOverrideMethod(): string
}
export class ExternalSubclass extends Error {
public override name = 'ExternalSubclass'
}
export class Subclass
extends IntermediateSuperclass
implements IntermediateSuperinterface, Overloader
Expand Down
9 changes: 9 additions & 0 deletions snapshots/output/syntax/src/inheritance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ export abstract class IntermediateSuperclass extends Superclass {
public abstract intermediateOverrideMethod(): string
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#intermediateOverrideMethod().
}
export class ExternalSubclass extends Error {
// ^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/ExternalSubclass#
// relationship implementation typescript 6.0.3 lib/`lib.es5.d.ts`/Error#
// ^^^^^ reference typescript 6.0.3 lib/`lib.es5.d.ts`/Error#
// ^^^^^ reference typescript 6.0.3 lib/`lib.es5.d.ts`/Error.
public override name = 'ExternalSubclass'
// ^^^^ definition syntax 1.0.0 src/`inheritance.ts`/ExternalSubclass#name.
// relationship implementation reference typescript 6.0.3 lib/`lib.es5.d.ts`/Error#name.
}
export class Subclass
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#
// relationship implementation syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
Expand Down
14 changes: 14 additions & 0 deletions src/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,20 @@ for (const snapshotDirectory of snapshotDirectories) {
[],
`${document.relative_path} global occurrences should have SymbolInformation`
)
const missingRelationshipSymbols = document.symbols
.flatMap(symbol => symbol.relationships)
.map(relationship => relationship.symbol)
.filter(
symbol =>
symbol &&
!symbol.startsWith('local ') &&
!availableSymbols.has(symbol)
)
assert.equal(
missingRelationshipSymbols,
[],
`${document.relative_path} relationship targets should have SymbolInformation`
)
const missingInternalSymbols = document.occurrences
.map(occurrence => occurrence.symbol)
.filter(
Expand Down
14 changes: 11 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,24 @@ export function indexCommand(
const output = fs.openSync(options.output, 'w')
let documentCount = 0
const definedSymbols = new Set<string>()
const occurrenceSymbols = new Set<string>()
const referencedSymbols = new Set<string>()
const writeIndex = (index: scip.scip.Index): void => {
documentCount += index.documents.length
for (const document of index.documents) {
for (const symbol of document.symbols) {
definedSymbols.add(symbol.symbol)
for (const relationship of symbol.relationships) {
if (
relationship.symbol &&
!relationship.symbol.startsWith('local ')
) {
referencedSymbols.add(relationship.symbol)
}
}
}
for (const occurrence of document.occurrences) {
if (occurrence.symbol && !occurrence.symbol.startsWith('local ')) {
occurrenceSymbols.add(occurrence.symbol)
referencedSymbols.add(occurrence.symbol)
}
}
}
Expand Down Expand Up @@ -99,7 +107,7 @@ export function indexCommand(
}
writeIndex(
new scip.scip.Index({
external_symbols: [...occurrenceSymbols]
external_symbols: [...referencedSymbols]
.filter(symbol => !definedSymbols.has(symbol))
.map(symbol => new scip.scip.SymbolInformation({ symbol })),
})
Expand Down
Loading