@@ -85,9 +85,15 @@ export class ObjectScriptDiagnosticProvider {
8585 text = text . replace ( / \/ \/ .* $ / , "" ) ;
8686 text = text . replace ( / # + ; .* $ / , "" ) ;
8787 text = text . replace ( / ; .* $ / , "" ) ;
88+ text = text . replace ( / \/ \* .* (? = \* \/ ) \* \/ / g, e => e . replace ( / ./ g, " " ) ) ;
8889 return text ;
8990 }
9091
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+
9197 private commands ( document : vscode . TextDocument ) : vscode . Diagnostic [ ] {
9298 const result = new Array < vscode . Diagnostic > ( ) ;
9399 const isClass = document . fileName . toLowerCase ( ) . endsWith ( ".cls" ) ;
@@ -102,7 +108,9 @@ export class ObjectScriptDiagnosticProvider {
102108 let sqlParens = 0 ;
103109 for ( let i = 0 ; i < document . lineCount ; i ++ ) {
104110 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 ) ;
106114
107115 // it is important to check script tag context before ObjectScript comments
108116 // since /* ... */ comments can also be used in JavaScript
@@ -205,7 +213,9 @@ export class ObjectScriptDiagnosticProvider {
205213 let isCode = ! isClass ;
206214 for ( let i = 0 ; i < document . lineCount ; i ++ ) {
207215 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 ) ;
209219
210220 if ( text . match ( / \/ \* / ) ) {
211221 inComment = true ;
@@ -230,7 +240,7 @@ export class ObjectScriptDiagnosticProvider {
230240 continue ;
231241 }
232242
233- const pattern = / (?< ! \$ ) ( \$ \b [ a - z ] + ) \b / gi;
243+ const pattern = / (?< ! \$ ) ( \$ [ a - z ] + ) / gi;
234244 let functionsMatch = null ;
235245 while ( ( functionsMatch = pattern . exec ( text ) ) !== null ) {
236246 const [ , found ] = functionsMatch ;
0 commit comments