Skip to content

Commit

Permalink
Merge branch 'lsp-refactor' of https://github.com/rokucommunity/brigh…
Browse files Browse the repository at this point in the history
…terscript into lsp-refactor
  • Loading branch information
TwitchBronBron committed May 28, 2024
2 parents 64cadf8 + 71b4944 commit 10b5ff5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/Program.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,19 @@ describe('Program', () => {
expect(signatureHelp[0]?.signature).to.not.exist;
});

it('does not crash when parts is undefined', () => {
program.setFile('source/main.bs', `
sub main()
print m.b["c"].hello?(12345)
end sub
`);
program.validate();
expectZeroDiagnostics(program);
// 123|45
let signatureHelp = getSignatureHelp(2, 45);
expect(signatureHelp).is.empty;
});

describe('gets signature info for regular function call', () => {
it('does not get help when on method name', () => {
program.setFile('source/main.bs', `
Expand Down
8 changes: 5 additions & 3 deletions src/bscPlugin/CallExpressionInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ export class CallExpressionInfo {

} else {
let parts = util.getAllDottedGetParts(callExpression.callee);
parts.splice(parts?.length - 1, 1);
this.dotPart = parts.map(x => x.text).join('.');
this.namespace = this.getNamespace();
if (parts) {
parts.splice(parts?.length - 1, 1);
this.dotPart = parts.map(x => x.text).join('.');
this.namespace = this.getNamespace();
}
}
}

Expand Down

0 comments on commit 10b5ff5

Please sign in to comment.