File tree Expand file tree Collapse file tree
input/multi-project/packages Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33export function a ( ) : string {
44 return ''
55}
6+
7+ export function localResult ( ) {
8+ interface LocalResult {
9+ value : string
10+ }
11+ return { value : '' } as LocalResult
12+ }
Original file line number Diff line number Diff line change 1- import { a } from '@example/a/src'
1+ import { a , localResult } from '@example/a/src'
22
33export function b ( ) {
4+ localResult ( ) . value
45 return a ( )
56}
Original file line number Diff line number Diff line change @@ -14,3 +14,24 @@ export function a(): string {
1414 return ''
1515}
1616
17+ export function localResult ( ) {
18+ // ^^^^^^^^^^^ definition @example/a 1.0.0 src/`index.ts`/localResult().
19+ // documentation ```ts
20+ // > function localResult(): LocalResult
21+ // > ```
22+ interface LocalResult {
23+ // ^^^^^^^^^^^ definition local 0
24+ // documentation ```ts
25+ // > interface LocalResult
26+ // > ```
27+ value : string
28+ // ^^^^^ definition local 1
29+ // documentation ```ts
30+ // > (property) value: string
31+ // > ```
32+ }
33+ return { value : '' } as LocalResult
34+ // ^^^^^ reference local 1
35+ // ^^^^^^^^^^^ reference local 0
36+ }
37+
Original file line number Diff line number Diff line change 11// language TypeScript
22// < definition @example/b 1.0.0 src/`b.ts`/
33
4- import { a } from '@example/a/src'
4+ import { a , localResult } from '@example/a/src'
55// ^ reference @example/a 1.0.0 src/`index.ts`/a().
6- // ^^^^^^^^^^^^^^^^ reference @example/a 1.0.0 src/`index.ts`/
6+ // ^^^^^^^^^^^ reference @example/a 1.0.0 src/`index.ts`/localResult().
7+ // ^^^^^^^^^^^^^^^^ reference @example/a 1.0.0 src/`index.ts`/
78
89export function b ( ) {
910// ^ definition @example/b 1.0.0 src/`b.ts`/b().
11+ localResult ( ) . value
12+ //^^^^^^^^^^^ reference @example/a 1.0.0 src/`index.ts`/localResult().
1013 return a ( )
1114// ^ reference @example/a 1.0.0 src/`index.ts`/a().
1215}
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ export function Connection() {}
66
77Connection . prototype = {
88//^^^^^^^^^ reference prototype-members 1.0.0 src/`connection.mjs`/Connection().
9- //^^^^^^^^^ reference local 3
10- // ^^^^^^^^^ reference local 2
119 getSchemaVersion ( ) {
1210//^^^^^^^^^^^^^^^^ definition prototype-members 1.0.0 src/`connection.mjs`/Connection().getSchemaVersion().
1311 return 0
Original file line number Diff line number Diff line change @@ -65,6 +65,15 @@ export class FileIndexer {
6565
6666 this . emitSourceFileOccurrence ( )
6767 this . visit ( this . sourceFile )
68+ // A SCIP local symbol is owned by one document. TypeScript can report
69+ // synthetic or cross-file declaration candidates that the symbol algorithm
70+ // cannot represent as locals in this document, so discard those unusable
71+ // occurrences instead of emitting dangling local identities.
72+ this . document . occurrences = this . document . occurrences . filter (
73+ occurrence =>
74+ ! occurrence . symbol . startsWith ( 'local ' ) ||
75+ this . symbolInformation . has ( occurrence . symbol )
76+ )
6877 }
6978 private emitSourceFileOccurrence ( ) : void {
7079 const symbol = this . scipSymbol ( this . sourceFile )
Original file line number Diff line number Diff line change @@ -145,13 +145,14 @@ for (const snapshotDirectory of snapshotDirectories) {
145145 . filter (
146146 symbol =>
147147 symbol &&
148- ! symbol . startsWith ( 'local ' ) &&
149- ! availableSymbols . has ( symbol )
148+ ( symbol . startsWith ( 'local ' )
149+ ? ! symbols . has ( symbol )
150+ : ! availableSymbols . has ( symbol ) )
150151 )
151152 assert . equal (
152153 missingOccurrenceSymbols ,
153154 [ ] ,
154- `${ document . relative_path } global occurrences should have SymbolInformation`
155+ `${ document . relative_path } occurrences should have SymbolInformation`
155156 )
156157 const missingRelationshipSymbols = document . symbols
157158 . flatMap ( symbol => symbol . relationships )
You can’t perform that action at this time.
0 commit comments