File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/providers/FileSystemProvider Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -149,8 +149,8 @@ function searchMatchToLine(
149
149
// This is in the class description
150
150
line = descLineToDocLine ( content , match . attrline , i ) ;
151
151
break ;
152
- } else if ( match . attr == "Super" ) {
153
- // This is a superclass
152
+ } else if ( match . attr == "Super" || match . attr == "Name" ) {
153
+ // This is in the class definition line
154
154
if ( content [ i ] . includes ( match . text ) ) {
155
155
line = i ;
156
156
}
@@ -306,7 +306,17 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
306
306
307
307
/** Report matches in `file` to the user */
308
308
const reportMatchesForFile = async ( file : SearchResult ) : Promise < void > => {
309
- if ( token . isCancellationRequested ) {
309
+ // The last three checks are needed to protect against
310
+ // bad output from the server due to a bug.
311
+ if (
312
+ // The user cancelled the search
313
+ token . isCancellationRequested ||
314
+ // The server reported no matches in this file
315
+ ! file . matches . length ||
316
+ // The file name is malformed
317
+ ( file . doc . includes ( "/" ) && ! / \/ (?: [ ^ / ] + \/ ) + [ ^ / . ] * (?: \. [ ^ / . ] + ) + / . test ( file . doc ) ) ||
318
+ ( ! file . doc . includes ( "/" ) && ! / ( % ? [ \p{ L} \d \u{100} - \u{ffff} ] + (?: \. [ \p{ L} \d \u{100} - \u{ffff} ] + ) + ) / u. test ( file . doc ) )
319
+ ) {
310
320
return ;
311
321
}
312
322
You can’t perform that action at this time.
0 commit comments