@@ -62,36 +62,14 @@ function generateHighlighting() {
62
62
}
63
63
64
64
export function findMatch ( editor : vscode . TextEditor , text : string ) : any {
65
- const regEx = / ^ \ { 0 , 3 } u s e (?: (?: f u n c t i o n | c o n s t ) ) ? ( .* ) ; / mg;
66
- let match ;
67
- let matches : any [ ] = [ ] ;
68
- let isAlias = false ;
69
-
70
- while ( match = regEx . exec ( text ) ) {
71
- let found = 0 ;
72
- let splitNameSpace = match [ 1 ] . split ( '\\' ) ;
73
- let className = splitNameSpace [ splitNameSpace . length - 1 ] ;
74
-
75
- if ( className . search ( / a s / ) > - 1 ) {
76
- isAlias = true ;
77
- let splitAlias = className . split ( ' as ' ) ;
78
- className = splitAlias [ splitAlias . length - 1 ] . trim ( ) ;
79
- }
80
-
81
- const reg = new RegExp ( '\\b' + className + '\\b' , 'g' ) ;
82
-
83
- const test = text . match ( reg ) ;
84
-
85
- found = ( test || [ ] ) . length ;
86
-
87
- extractUnusedImports ( text ) . forEach ( element => {
88
- const { match} = element ;
89
- const startPos = editor . document . positionAt ( match . index ) ;
90
- const endPos = editor . document . positionAt ( match . index + match [ 0 ] . length ) ;
91
- ranges . push ( new vscode . Range ( startPos , endPos ) ) ;
92
- matches . push ( element . match ) ;
93
- } )
94
- }
65
+ const matches : any [ ] = [ ] ;
66
+ extractUnusedImports ( text ) . forEach ( element => {
67
+ const { match} = element ;
68
+ const startPos = editor . document . positionAt ( match . index ) ;
69
+ const endPos = editor . document . positionAt ( match . index + match [ 0 ] . length ) ;
70
+ ranges . push ( new vscode . Range ( startPos , endPos ) ) ;
71
+ matches . push ( element . match ) ;
72
+ } ) ;
95
73
96
74
return matches ;
97
75
}
0 commit comments