@@ -85,9 +85,15 @@ export class ObjectScriptDiagnosticProvider {
85
85
text = text . replace ( / \/ \/ .* $ / , "" ) ;
86
86
text = text . replace ( / # + ; .* $ / , "" ) ;
87
87
text = text . replace ( / ; .* $ / , "" ) ;
88
+ text = text . replace ( / \/ \* .* (? = \* \/ ) \* \/ / g, e => e . replace ( / ./ g, " " ) ) ;
88
89
return text ;
89
90
}
90
91
92
+ /// replace value in double quotes by spaces
93
+ private stripQuoted ( text : string ) {
94
+ return text . replace ( / " (?: .* (? = " " ) " " ) * [ ^ " ] * " / g, e => '"' + e . replace ( / ./ g, " " ) . slice ( 2 ) + '"' ) ;
95
+ }
96
+
91
97
private commands ( document : vscode . TextDocument ) : vscode . Diagnostic [ ] {
92
98
const result = new Array < vscode . Diagnostic > ( ) ;
93
99
const isClass = document . fileName . toLowerCase ( ) . endsWith ( ".cls" ) ;
@@ -102,7 +108,9 @@ export class ObjectScriptDiagnosticProvider {
102
108
let sqlParens = 0 ;
103
109
for ( let i = 0 ; i < document . lineCount ; i ++ ) {
104
110
const line = document . lineAt ( i ) ;
105
- const text = this . stripLineComments ( line . text ) ;
111
+ let text = line . text ;
112
+ text = this . stripLineComments ( text ) ;
113
+ text = this . stripQuoted ( text ) ;
106
114
107
115
// it is important to check script tag context before ObjectScript comments
108
116
// since /* ... */ comments can also be used in JavaScript
@@ -205,7 +213,9 @@ export class ObjectScriptDiagnosticProvider {
205
213
let isCode = ! isClass ;
206
214
for ( let i = 0 ; i < document . lineCount ; i ++ ) {
207
215
const line = document . lineAt ( i ) ;
208
- const text = this . stripLineComments ( line . text ) ;
216
+ let text = line . text ;
217
+ text = this . stripLineComments ( text ) ;
218
+ text = this . stripQuoted ( text ) ;
209
219
210
220
if ( text . match ( / \/ \* / ) ) {
211
221
inComment = true ;
@@ -230,7 +240,7 @@ export class ObjectScriptDiagnosticProvider {
230
240
continue ;
231
241
}
232
242
233
- const pattern = / (?< ! \$ ) ( \$ \b [ a - z ] + ) \b / gi;
243
+ const pattern = / (?< ! \$ ) ( \$ [ a - z ] + ) / gi;
234
244
let functionsMatch = null ;
235
245
while ( ( functionsMatch = pattern . exec ( text ) ) !== null ) {
236
246
const [ , found ] = functionsMatch ;
0 commit comments