@@ -251,50 +251,72 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
251
251
// Find all lines that we have matches on
252
252
const lines = file . matches
253
253
. map ( ( match : SearchMatch ) => {
254
- let line = Number ( match . line ) ;
254
+ let line = match . line ? Number ( match . line ) : null ;
255
255
if ( match . member !== undefined ) {
256
256
// This is an attribute of a class member
257
- const memberMatchPattern = new RegExp (
258
- `^((?:Class|Client)?Method|Property|XData|Query|Trigger|Parameter|Relationship|Index|ForeignKey|Storage|Projection) ${ match . member } `
259
- ) ;
260
- for ( let i = 0 ; i < content . length ; i ++ ) {
261
- if ( content [ i ] . match ( memberMatchPattern ) ) {
262
- let memend = i + 1 ;
263
- if (
264
- config ( "multilineMethodArgs" , api . configName ) &&
265
- content [ i ] . match ( / ^ (?: C l a s s | C l i e n t ) ? M e t h o d | Q u e r y / )
266
- ) {
267
- // The class member definition is on multiple lines so update the end
268
- for ( let j = i + 1 ; j < content . length ; j ++ ) {
269
- if ( content [ j ] . trim ( ) === "{" ) {
270
- memend = j ;
271
- break ;
272
- }
273
- }
257
+ if ( match . member == "Storage" && match . attr . includes ( "," ) && match . attrline == undefined ) {
258
+ // This is inside a Storage definition
259
+ const xmlTags = match . attr . split ( "," ) ;
260
+ const storageRegex = new RegExp ( `^Storage ${ xmlTags [ 0 ] } ` ) ;
261
+ let inStorage = false ;
262
+ for ( let i = 0 ; i < content . length ; i ++ ) {
263
+ if ( ! inStorage && content [ i ] . match ( storageRegex ) ) {
264
+ inStorage = true ;
265
+ xmlTags . shift ( ) ;
274
266
}
275
- if ( match . attr === undefined ) {
276
- if ( match . line === undefined ) {
277
- // This is in the class member definition
267
+ if ( inStorage ) {
268
+ if ( xmlTags . length > 0 && content [ i ] . includes ( xmlTags [ 0 ] ) ) {
269
+ xmlTags . shift ( ) ;
270
+ }
271
+ if ( xmlTags . length == 0 && content [ i ] . includes ( match . text ) ) {
278
272
line = i ;
279
- } else {
280
- // This is in the implementation
281
- line = memend + Number ( match . line ) ;
273
+ break ;
282
274
}
283
- } else {
284
- if ( match . attrline === undefined ) {
285
- // This is in the class member definition
286
- line = 1 ;
287
- } else {
288
- if ( match . attr === "Description" ) {
289
- // This is in the description
290
- line = descLineToDocLine ( content , match . attrline , i ) ;
275
+ }
276
+ }
277
+ } else {
278
+ const memberMatchPattern = new RegExp (
279
+ `^((?:Class|Client)?Method|Property|XData|Query|Trigger|Parameter|Relationship|Index|ForeignKey|Storage|Projection) ${ match . member } `
280
+ ) ;
281
+ for ( let i = 0 ; i < content . length ; i ++ ) {
282
+ if ( content [ i ] . match ( memberMatchPattern ) ) {
283
+ let memend = i + 1 ;
284
+ if (
285
+ config ( "multilineMethodArgs" , api . configName ) &&
286
+ content [ i ] . match ( / ^ (?: C l a s s | C l i e n t ) ? M e t h o d | Q u e r y / )
287
+ ) {
288
+ // The class member definition is on multiple lines so update the end
289
+ for ( let j = i + 1 ; j < content . length ; j ++ ) {
290
+ if ( content [ j ] . trim ( ) === "{" ) {
291
+ memend = j ;
292
+ break ;
293
+ }
294
+ }
295
+ }
296
+ if ( match . attr === undefined ) {
297
+ if ( match . line === undefined ) {
298
+ // This is in the class member definition
299
+ line = i ;
291
300
} else {
292
301
// This is in the implementation
293
- line = memend + match . attrline ;
302
+ line = memend + Number ( match . line ) ;
303
+ }
304
+ } else {
305
+ if ( match . attrline === undefined ) {
306
+ // This is in the class member definition
307
+ line = 1 ;
308
+ } else {
309
+ if ( match . attr === "Description" ) {
310
+ // This is in the description
311
+ line = descLineToDocLine ( content , match . attrline , i ) ;
312
+ } else {
313
+ // This is in the implementation
314
+ line = memend + match . attrline ;
315
+ }
294
316
}
295
317
}
318
+ break ;
296
319
}
297
- break ;
298
320
}
299
321
}
300
322
} else if ( match . attr !== undefined ) {
0 commit comments