Skip to content

Commit 20a8b07

Browse files
JPinkneygorkem
authored andcommitted
Fix issue with language server not issuing warning errors and throwing wrong duplicate key matches
1 parent 65a22fe commit 20a8b07

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/languageservice/parser/yamlParser07.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ function createJSONDocument(yamlDoc: Yaml.YAMLNode, startPositions: number[], te
191191

192192
//Patch ontop of yaml-ast-parser to disable duplicate key message on merge key
193193
const isDuplicateAndNotMergeKey = function (error: Yaml.YAMLException, yamlText: string) {
194-
const errorConverted = convertError(error);
195-
const errorStart = errorConverted.range.start.character;
196-
const errorEnd = errorConverted.range.end.character;
194+
const errorStart = error.mark.position;
195+
const errorEnd = error.mark.position + error.mark.column;
197196
if (error.reason === duplicateKeyReason && yamlText.substring(errorStart, errorEnd).startsWith('<<')) {
198197
return false;
199198
}

src/languageservice/services/yamlValidation.ts

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ export class YAMLValidation {
5151
if (syd.errors.length > 0) {
5252
validationResult.push(...syd.errors);
5353
}
54+
if (syd.warnings.length > 0) {
55+
validationResult.push(...syd.warnings);
56+
}
5457

5558
validationResult.push(...validation);
5659
index++;

0 commit comments

Comments
 (0)