Skip to content

Commit 4d3daef

Browse files
committed
Merge branch 'main' into worksofliam/issue414
Signed-off-by: worksofliam <[email protected]>
2 parents 75a00ca + 0ac795c commit 4d3daef

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ dist
66
.vscode/settings.json
77
out
88
tsconfig.tsbuildinfo
9+
tests/private

tests/suite/fixed.test.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,4 +1372,57 @@ test('multiline procedure names', async () => {
13721372
const procRange = abcxyzTest.range;
13731373
expect(lines[procRange.start]).to.equal(` Pabc...`);
13741374
expect(lines[procRange.end]).to.equal(` P E`);
1375+
});
1376+
1377+
test('incorrect range on prototypes and procedures (#412)', async () => {
1378+
const lines = [
1379+
``,
1380+
` H NoMain`,
1381+
` *****************************************************************`,
1382+
` FSCOOBYFM CF E WorkStn SFile(OOPPS:SCOOPS)`,
1383+
` F InfDS(INFDS) USROPN`,
1384+
``,
1385+
` D Type S 1S 0`,
1386+
` D PTitle S 40`,
1387+
` ******************************************`,
1388+
` DSCO000 PR 34`,
1389+
` D 40`,
1390+
``,
1391+
` PSCO000 B Export`,
1392+
` DSCO000 PI 34`,
1393+
` D PTitle 40`,
1394+
` ******************************************`,
1395+
` D jgvb S 4 0 Dim(1)`,
1396+
` D gtdc S 1 Dim(1)`,
1397+
` D ditn S 1 Dim(1)`,
1398+
` D mgur S 1 Dim(1)`,
1399+
` D dfgx S 4 0 Dim(1)`,
1400+
` D G S 1 0 Inz(1)`,
1401+
` ******************************************`,
1402+
``,
1403+
` dsply 'this is awesome';`,
1404+
` `,
1405+
` ******************************************`,
1406+
` P E`,
1407+
` ******************************************`,
1408+
].join(`\n`);
1409+
1410+
const cache = await parser.getDocs(uri, lines, {withIncludes: true, ignoreCache: true});
1411+
1412+
expect(cache).toBeDefined();
1413+
1414+
const procedures = cache.procedures;
1415+
expect(procedures.length).toBe(2);
1416+
expect(procedures[0].name).toBe('SCO000');
1417+
expect(procedures[0].prototype).toBe(true);
1418+
1419+
expect(procedures[1].name).toBe('SCO000');
1420+
expect(procedures[1].prototype).toBe(false);
1421+
1422+
const prRange = procedures[0].range;
1423+
const procRange = procedures[1].range;
1424+
1425+
expect(prRange.start).to.deep.equal(prRange.end-1);
1426+
expect(procRange.start).toBeGreaterThan(prRange.end);
1427+
expect(procRange.end).toBeGreaterThan(procRange.start);
13751428
});

0 commit comments

Comments
 (0)