Skip to content

Commit

Permalink
Allow generic snippets to be computed when completion token is null.
Browse files Browse the repository at this point in the history
- Fixes redhat-developer/vscode-java#3466

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Jan 22, 2024
1 parent 8f0f822 commit 619e6d8
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private static List<CompletionItem> getGenericSnippets(SnippetCompletionContext
CompletionContext completionContext = scc.getCompletionContext();
char[] completionToken = completionContext.getToken();
if (completionToken == null) {
return Collections.emptyList();
completionToken = new char[0];
}
int tokenLocation = completionContext.getTokenLocation();
JavaContextType contextType = null;
Expand Down Expand Up @@ -430,7 +430,10 @@ private static boolean isCompletionItemLabelDetailsSupport() {
public static String evaluateGenericTemplate(ICompilationUnit cu, CompletionContext completionContext, Template template) {
JavaContextType contextType = (JavaContextType) JavaLanguageServerPlugin.getInstance().getTemplateContextRegistry().getContextType(template.getContextTypeId());
char[] completionToken = completionContext.getToken();
if (contextType == null || completionToken == null) {
if (completionToken == null) {
completionToken = new char[0];
}
if (contextType == null) {
return null;
}

Expand Down

0 comments on commit 619e6d8

Please sign in to comment.