Fix a bug and fix tests so it catches that kind of bug in future.

Bug caused by using == to compare Language ids instead of .equals
This commit is contained in:
Kris De Volder
2017-04-03 10:27:55 -07:00
parent 3b7d8710bb
commit 6191c23b23
2 changed files with 3 additions and 3 deletions

View File

@@ -102,9 +102,9 @@ public class Editor {
public Editor(LanguageServerHarness harness, String contents, String languageId) throws Exception {
this.harness = harness;
this.languageId = languageId;
this.languageId = new String(languageId); // So we can catch bugs that use == for langauge id comparison.
EditorState state = new EditorState(contents);
this.document = harness.openDocument(harness.createWorkingCopy(state.documentContents, languageId));
this.document = harness.openDocument(harness.createWorkingCopy(state.documentContents, this.languageId));
this.selectionStart = state.selectionStart;
this.selectionEnd = state.selectionEnd;
this.ignoredTypes = new HashSet<>();

View File

@@ -217,7 +217,7 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(task, "params", t_string_params);
task.require((dc) -> {
String languageId = dc.getDocument().getLanguageId();
if (languageId==LanguageIds.CONCOURSE_PIPELINE) {
if (LanguageIds.CONCOURSE_PIPELINE.equals(languageId)) {
Node parentImageDef = getParentPropertyNode("image", models, dc);
if (parentImageDef==null) {
return Constraints.requireOneOf("image_resource", "image");