@@ -56,37 +56,38 @@ export const enum ItemSource {
56
56
57
57
export class FileItem {
58
58
59
- private _document : Thenable < vscode . TextDocument > | undefined ;
60
-
61
59
constructor (
62
60
readonly uri : vscode . Uri ,
63
61
readonly results : Array < ReferenceItem > ,
64
62
readonly parent : ReferencesModel
65
63
) { }
64
+ }
65
+
66
+ export class ReferenceItem {
67
+
68
+ private _document : Thenable < vscode . TextDocument > | undefined ;
69
+
70
+ constructor (
71
+ readonly location : vscode . Location ,
72
+ readonly parent : FileItem ,
73
+ ) { }
66
74
67
75
async getDocument ( warmUpNext ?: boolean ) {
68
76
if ( ! this . _document ) {
69
- this . _document = vscode . workspace . openTextDocument ( this . uri ) ;
77
+ this . _document = vscode . workspace . openTextDocument ( this . location . uri ) ;
70
78
}
71
79
if ( warmUpNext ) {
72
80
// load next document once this document has been loaded
73
81
// and when next document has not yet been loaded
74
- const item = await this . parent . move ( this , true ) ;
75
- if ( item && ! item . parent . _document ) {
76
- this . _document . then ( ( ) => item . parent . getDocument ( false ) ) ;
82
+ const item = await this . parent . parent . move ( this , true ) ;
83
+ if ( item && ! item . _document ) {
84
+ this . _document . then ( ( ) => item . getDocument ( false ) ) ;
77
85
}
78
86
}
79
87
return this . _document ;
80
88
}
81
89
}
82
90
83
- export class ReferenceItem {
84
- constructor (
85
- readonly location : vscode . Location ,
86
- readonly parent : FileItem ,
87
- ) { }
88
- }
89
-
90
91
export class ReferencesModel {
91
92
92
93
static create ( uri : vscode . Uri , position : vscode . Position , source : ItemSource ) : ReferencesModel {
@@ -113,7 +114,7 @@ export class ReferencesModel {
113
114
locations . sort ( ReferencesModel . _compareLocations ) ;
114
115
for ( const loc of locations ) {
115
116
if ( ! last || ReferencesModel . _compareUriIgnoreFragment ( last . uri , loc . uri ) !== 0 ) {
116
- last = new FileItem ( loc . uri , [ ] , this ) ;
117
+ last = new FileItem ( loc . uri . with ( { fragment : '' } ) , [ ] , this ) ;
117
118
items . push ( last ) ;
118
119
}
119
120
last . results . push ( new ReferenceItem ( loc , last ) ) ;
0 commit comments