Skip to content

Commit 1be2e57

Browse files
committed
Also don't suggest different-case properties
1 parent 7ee5891 commit 1be2e57

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/languageservice/services/yamlCompletion.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,17 @@ export class YamlCompletion {
691691
});
692692
}
693693

694-
const hasMatchingAlias = (propSchema: JSONSchema): boolean => {
694+
const hasMatchingProperty = (key: string, propSchema: JSONSchema): boolean => {
695695
return node.items.some((pair) => {
696+
if (!isScalar(pair.key) || typeof pair.key.value !== 'string') {
697+
return false;
698+
}
699+
700+
const ignoreCase = shouldIgnoreCase(propSchema, 'key');
701+
if (ignoreCase && pair.key.value.toUpperCase() === key.toUpperCase() && pair.key.value !== key) {
702+
return true;
703+
}
704+
696705
if (Array.isArray(propSchema.aliases)) {
697706
return propSchema.aliases.some((alias) => {
698707
if (!isScalar(pair.key) || typeof pair.key.value !== 'string') {
@@ -749,7 +758,7 @@ export class YamlCompletion {
749758
typeof propertySchema === 'object' &&
750759
!propertySchema.deprecationMessage &&
751760
!propertySchema['doNotSuggest'] &&
752-
!hasMatchingAlias(propertySchema)
761+
!hasMatchingProperty(key, propertySchema)
753762
) {
754763
let identCompensation = '';
755764
if (nodeParent && isSeq(nodeParent) && node.items.length <= 1 && !hasOnlyWhitespace) {

0 commit comments

Comments
 (0)