@@ -144,50 +144,72 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
144144 // Find all lines that we have matches on
145145 const lines = file . matches
146146 . map ( ( match : SearchMatch ) => {
147- let line = Number ( match . line ) ;
147+ let line = match . line ? Number ( match . line ) : null ;
148148 if ( match . member !== undefined ) {
149149 // This is an attribute of a class member
150- const memberMatchPattern = new RegExp (
151- `^((?:Class|Client)?Method|Property|XData|Query|Trigger|Parameter|Relationship|Index|ForeignKey|Storage|Projection) ${ match . member } `
152- ) ;
153- for ( let i = 0 ; i < content . length ; i ++ ) {
154- if ( content [ i ] . match ( memberMatchPattern ) ) {
155- let memend = i + 1 ;
156- if (
157- config ( "multilineMethodArgs" , api . configName ) &&
158- 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 / )
159- ) {
160- // The class member definition is on multiple lines so update the end
161- for ( let j = i + 1 ; j < content . length ; j ++ ) {
162- if ( content [ j ] . trim ( ) === "{" ) {
163- memend = j ;
164- break ;
165- }
166- }
150+ if ( match . member == "Storage" && match . attr . includes ( "," ) && match . attrline == undefined ) {
151+ // This is inside a Storage definition
152+ const xmlTags = match . attr . split ( "," ) ;
153+ const storageRegex = new RegExp ( `^Storage ${ xmlTags [ 0 ] } ` ) ;
154+ let inStorage = false ;
155+ for ( let i = 0 ; i < content . length ; i ++ ) {
156+ if ( ! inStorage && content [ i ] . match ( storageRegex ) ) {
157+ inStorage = true ;
158+ xmlTags . shift ( ) ;
167159 }
168- if ( match . attr === undefined ) {
169- if ( match . line === undefined ) {
170- // This is in the class member definition
160+ if ( inStorage ) {
161+ if ( xmlTags . length > 0 && content [ i ] . includes ( xmlTags [ 0 ] ) ) {
162+ xmlTags . shift ( ) ;
163+ }
164+ if ( xmlTags . length == 0 && content [ i ] . includes ( match . text ) ) {
171165 line = i ;
172- } else {
173- // This is in the implementation
174- line = memend + Number ( match . line ) ;
166+ break ;
175167 }
176- } else {
177- if ( match . attrline === undefined ) {
178- // This is in the class member definition
179- line = 1 ;
180- } else {
181- if ( match . attr === "Description" ) {
182- // This is in the description
183- line = descLineToDocLine ( content , match . attrline , i ) ;
168+ }
169+ }
170+ } else {
171+ const memberMatchPattern = new RegExp (
172+ `^((?:Class|Client)?Method|Property|XData|Query|Trigger|Parameter|Relationship|Index|ForeignKey|Storage|Projection) ${ match . member } `
173+ ) ;
174+ for ( let i = 0 ; i < content . length ; i ++ ) {
175+ if ( content [ i ] . match ( memberMatchPattern ) ) {
176+ let memend = i + 1 ;
177+ if (
178+ config ( "multilineMethodArgs" , api . configName ) &&
179+ 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 / )
180+ ) {
181+ // The class member definition is on multiple lines so update the end
182+ for ( let j = i + 1 ; j < content . length ; j ++ ) {
183+ if ( content [ j ] . trim ( ) === "{" ) {
184+ memend = j ;
185+ break ;
186+ }
187+ }
188+ }
189+ if ( match . attr === undefined ) {
190+ if ( match . line === undefined ) {
191+ // This is in the class member definition
192+ line = i ;
184193 } else {
185194 // This is in the implementation
186- line = memend + match . attrline ;
195+ line = memend + Number ( match . line ) ;
196+ }
197+ } else {
198+ if ( match . attrline === undefined ) {
199+ // This is in the class member definition
200+ line = 1 ;
201+ } else {
202+ if ( match . attr === "Description" ) {
203+ // This is in the description
204+ line = descLineToDocLine ( content , match . attrline , i ) ;
205+ } else {
206+ // This is in the implementation
207+ line = memend + match . attrline ;
208+ }
187209 }
188210 }
211+ break ;
189212 }
190- break ;
191213 }
192214 }
193215 } else if ( match . attr !== undefined ) {
0 commit comments