Skip to content

Commit

Permalink
Fix issue with language server not issuing warning errors and throwin…
Browse files Browse the repository at this point in the history
…g wrong duplicate key matches
  • Loading branch information
JPinkney authored and gorkem committed Jan 22, 2020
1 parent 65a22fe commit 20a8b07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/languageservice/parser/yamlParser07.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,8 @@ function createJSONDocument(yamlDoc: Yaml.YAMLNode, startPositions: number[], te

//Patch ontop of yaml-ast-parser to disable duplicate key message on merge key
const isDuplicateAndNotMergeKey = function (error: Yaml.YAMLException, yamlText: string) {
const errorConverted = convertError(error);
const errorStart = errorConverted.range.start.character;
const errorEnd = errorConverted.range.end.character;
const errorStart = error.mark.position;
const errorEnd = error.mark.position + error.mark.column;
if (error.reason === duplicateKeyReason && yamlText.substring(errorStart, errorEnd).startsWith('<<')) {
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions src/languageservice/services/yamlValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class YAMLValidation {
if (syd.errors.length > 0) {
validationResult.push(...syd.errors);
}
if (syd.warnings.length > 0) {
validationResult.push(...syd.warnings);
}

validationResult.push(...validation);
index++;
Expand Down

0 comments on commit 20a8b07

Please sign in to comment.