Skip to content

Commit

Permalink
Add null check for customTags setting
Browse files Browse the repository at this point in the history
Fixes redhat-developer#807

Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Mar 21, 2024
1 parent dfccc6f commit 75bf3ae
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 75bf3ae

Please sign in to comment.