Skip to content

Commit 003e8fc

Browse files
fixes #118 - removed unneeded test and simplified null parsing
1 parent 3cf3429 commit 003e8fc

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

src/languageservice/parser/yamlParser07.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,9 @@ function recursivelyBuildAst(parent: ASTNode, node: Yaml.YAMLNode): ASTNode {
115115
return new BooleanASTNodeImpl(parent, parseYamlBoolean(value), node.startPosition, node.endPosition - node.startPosition);
116116
}
117117

118-
//This is patch to support YAML null values: https://yaml.org/type/null.html
119-
const possibleNullValues = ['~', 'NULL', 'Null', 'null'];
120-
if (instance.plainScalar && possibleNullValues.indexOf(value.toString()) !== -1) {
121-
return new NullASTNodeImpl(parent, node.startPosition, node.endPosition - node.startPosition);
122-
}
123-
124118
switch (type) {
125119
case Yaml.ScalarType.null: {
126-
return new StringASTNodeImpl(parent, instance.startPosition, instance.endPosition - instance.startPosition);
120+
return new NullASTNodeImpl(parent, node.startPosition, node.endPosition - node.startPosition);
127121
}
128122
case Yaml.ScalarType.bool: {
129123
return new BooleanASTNodeImpl(parent, Yaml.parseYamlBoolean(value), node.startPosition, node.endPosition - node.startPosition);

test/schemaValidation.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,6 @@ suite('Validation Tests', () => {
9696
}).then(done, done);
9797
});
9898

99-
// TODO: remove this test, because it is just plain wrong: https://yaml.org/type/null.html
100-
// See: https://github.com/redhat-developer/yaml-language-server/issues/118
101-
it.skip('Null scalar value should be treated as string', done => {
102-
const content = 'cwd: Null';
103-
const validator = parseSetup(content);
104-
validator.then(function (result) {
105-
assert.equal(result.length, 0);
106-
}).then(done, done);
107-
});
108-
10999
it('Anchor should not not error', done => {
110100
const content = 'default: &DEFAULT\n name: Anchor\nanchor_test:\n <<: *DEFAULT';
111101
const validator = parseSetup(content);

0 commit comments

Comments
 (0)