Skip to content

Commit

Permalink
Add null check for customTags setting (#955)
Browse files Browse the repository at this point in the history
Fixes #807

Signed-off-by: David Thompson <davthomp@redhat.com>
Co-authored-by: Muthurajan Sivasubramanian <93245779+msivasubramaniaan@users.noreply.github.com>
  • Loading branch information
datho7561 and msivasubramaniaan authored May 28, 2024
1 parent 0e17579 commit 0871dc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/languageservice/services/yamlCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class YamlCompletion {
proposed,
};

if (this.customTags.length > 0) {
if (this.customTags && this.customTags.length > 0) {
this.getCustomTagValueCompletions(collector);
}

Expand Down
5 changes: 5 additions & 0 deletions test/autoCompletion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3126,5 +3126,10 @@ describe('Auto Completion Tests', () => {
expect(result.items.map((i) => i.label)).to.have.members(['fruit', 'vegetable']);
});
});
it('Should function when settings are undefined', async () => {
languageService.configure({ completion: true });
const content = '';
await parseSetup(content, 0);
});
});
});

0 comments on commit 0871dc1

Please sign in to comment.