diff --git a/language/parser.js b/language/parser.js index f9b8bfc5..9eb7cad9 100644 --- a/language/parser.js +++ b/language/parser.js @@ -126,6 +126,7 @@ export default class Parser { */ static getIncludeFromDirective(line) { if (line.includes(`*`)) return; // Likely comment + if (line.includes(`//`)) return; // Likely comment const upperLine = line.toUpperCase(); let comment = -1; @@ -297,7 +298,7 @@ export default class Parser { } else { // We need to add qualified as it is qualified by default. if (!ds.keywords.includes(`QUALIFIED`)) - ds.keywords.push(`QUALIFIED`); + ds.keywords.push(`QUALIFIED`); // Fetch from local definitions for (let i = scopes.length - 1; i >= 0; i--) { diff --git a/tests/suite/directives.test.ts b/tests/suite/directives.test.ts index cbe36da8..b19a0f3a 100644 --- a/tests/suite/directives.test.ts +++ b/tests/suite/directives.test.ts @@ -500,7 +500,29 @@ test('variable_case1', async () => { type: `IncorrectVariableCase`, newValue: `CustomerName_t` }); -}) +}); + +test('variable_case1 commented out', async () => { + const lines = [ + `**FREE`, + `Ctl-Opt DftActGrp(*No);`, + `// /copy './tests/rpgle/copy3.rpgle'`, + `Dcl-S MyCustomerName1 like(customername_t);`, + `Dcl-S MyCustomerName2 like(CustomerName_t);`, + `Dcl-S MyCustomerName3 like(CUSTOMERNAME_t);`, + `Dcl-S MyCustomerName4 like(CUSTOMERNAME_T);`, + `MyCustomerName1 = 'John Smith';`, + `dsply MyCustomerName1;`, + `Return;` + ].join(`\n`); + + const cache = await parser.getDocs(uri, lines, { withIncludes: true, ignoreCache: true }); + const { errors } = Linter.getErrors({ uri, content: lines }, { + IncorrectVariableCase: true + }, cache); + + expect(errors.length).toBe(0); +}); test('uppercase1', async () => { const lines = [