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:
@@ -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<>();
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user