Fix for PT-167494938

Snippet completion was broken for concourse resource type
'extra insertions'.
This commit is contained in:
Kris De Volder
2019-07-25 16:46:00 -07:00
parent bd061a4ec3
commit d9f48ed693
8 changed files with 63 additions and 12 deletions

View File

@@ -424,7 +424,7 @@ public class ConcourseModel {
snippet.text("\n "+p.getName()+": ");
snippet.placeHolder();
}
return snippet.toString();
return snippet.build();
}
}
return null;

View File

@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
import org.eclipse.lsp4j.CompletionItem;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.DiagnosticSeverity;
import org.eclipse.lsp4j.InsertTextFormat;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
@@ -4382,6 +4383,24 @@ public class ConcourseEditorTest {
);
editor.assertProblems(/*NONE*/);
}
@Test public void cfResourceTypeCompletion() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +
"- name: foo\n" +
" type: <*>"
);
CompletionItem item = editor.assertCompletionWithLabel(label -> label.startsWith("cf"),
"resources:\n" +
"- name: foo\n" +
" type: cf\n" +
" source:\n" +
" api: $1\n" +
" organization: $2\n" +
" space: $3<*>"
);
assertEquals(InsertTextFormat.Snippet, item.getInsertTextFormat());
}
@Test public void cfResourceSourceCompletions() throws Exception {
Editor editor = harness.newEditor(