diff --git a/src/bscPlugin/completions/CompletionsProcessor.spec.ts b/src/bscPlugin/completions/CompletionsProcessor.spec.ts index a03d427ef..3bd0eada9 100644 --- a/src/bscPlugin/completions/CompletionsProcessor.spec.ts +++ b/src/bscPlugin/completions/CompletionsProcessor.spec.ts @@ -701,7 +701,7 @@ describe('CompletionsProcessor', () => { expect( // message = alpha| processor['getBrsFileCompletions'](util.createPosition(2, 39), file) - ).to.eql([]); + ).to.eql({ global: [], scoped: [] }); }); it('does not crash when functionExpression.body is undefined (somehow...)', () => { @@ -718,7 +718,7 @@ describe('CompletionsProcessor', () => { expect( // message = alpha| processor['getBrsFileCompletions'](util.createPosition(2, 39), file) - ).to.eql([]); + ).to.eql({ global: [], scoped: [] }); }); }); @@ -791,7 +791,7 @@ describe('CompletionsProcessor', () => { }); program.validate(); //get the name of all global completions - const globalCompletions = program.globalScope.getAllFiles().flatMap(x => completionProcessor.getBrsFileCompletions(position, x as BrsFile)).map(x => x.label); + const globalCompletions = program.globalScope.getAllFiles().flatMap(x => completionProcessor.getBrsFileCompletions(position, x as BrsFile).global).map(x => x.label); //filter out completions from global scope completions = completions.filter(x => !globalCompletions.includes(x.label)); expect(completions).to.be.empty; @@ -811,6 +811,31 @@ describe('CompletionsProcessor', () => { expect(labels).to.deep.include({ label: 'count' }); }); + + it('finds parameters when file is in multiple scopes', () => { + program.setFile('source/main.bs', ` + sub Main(count = 1) + firstName = "bob" + age = 21 + shoeSize = 10 + end sub + `); + + program.setFile('components/MyNode.xml', + trim` + +