Skip to content

Commit

Permalink
Fix compile with latest LSP4E
Browse files Browse the repository at this point in the history
  • Loading branch information
akurtakov committed Sep 7, 2023
1 parent 63e434e commit 14e7744
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*********************************************************************
* Copyright (c) 2018, 2021 Red Hat Inc. and others.
* Copyright (c) 2018, 2023 Red Hat Inc. and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -14,9 +14,7 @@
package org.eclipse.corrosion.snippet;

import java.util.Arrays;
import java.util.concurrent.ExecutionException;

import org.eclipse.corrosion.CorrosionPlugin;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.lsp4e.LanguageServiceAccessor.LSPDocumentInfo;
Expand All @@ -27,7 +25,6 @@
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.TextEdit;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.lsp4j.services.LanguageServer;

@SuppressWarnings("restriction")
public class Snippet {
Expand Down Expand Up @@ -57,16 +54,7 @@ public ICompletionProposal convertToCompletionProposal(int offset, LSPDocumentIn
// if there is a text selection, take it, since snippets with $TM_SELECTED_TEXT
// will want to wrap the selection.
item.setTextEdit(Either.forLeft(new TextEdit(textRange, createReplacement(lineIndentation))));
return new LSCompletionProposal(document, offset, item, getLanguageClient(info));
}

private static LanguageServer getLanguageClient(LSPDocumentInfo info) {
try {
return info.getInitializedLanguageClient().get();
} catch (InterruptedException | ExecutionException e) {
CorrosionPlugin.logError(e);
return null;
}
return new LSCompletionProposal(document, offset, item, info.getLanguageServerWrapper());
}

public boolean matchesPrefix(String prefix) {
Expand Down

0 comments on commit 14e7744

Please sign in to comment.