Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LSP4J 0.15 #201

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Debug Adapter client for Eclipse IDE (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.debug;singleton:=true
Bundle-Version: 0.13.5.qualifier
Bundle-Version: 0.14.0.qualifier
Bundle-Activator: org.eclipse.lsp4e.debug.DSPPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.debug.core,
org.eclipse.debug.ui,
org.eclipse.jface,
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.14.0,0.15.0)",
org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[0.14.0,0.15.0)",
org.eclipse.lsp4j.debug;bundle-version="[0.14.0,0.15.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.15.0,0.16.0)",
org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[0.15.0,0.16.0)",
org.eclipse.lsp4j.debug;bundle-version="[0.15.0,0.16.0)",
org.eclipse.ui.editors,
org.eclipse.core.filesystem,
org.eclipse.ui.ide;bundle-version="[3.16.0,4.0.0)",
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests for language server bundle (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.test;singleton:=true
Bundle-Version: 0.13.13.qualifier
Bundle-Version: 0.14.0.qualifier
Fragment-Host: org.eclipse.lsp4e
Bundle-Vendor: Eclipse.org
Bundle-RequiredExecutionEnvironment: JavaSE-11
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</parent>
<artifactId>org.eclipse.lsp4e.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<version>0.13.13-SNAPSHOT</version>
<version>0.14.0-SNAPSHOT</version>

<properties>
<os-jvm-flags /> <!-- for the default case -->
Expand Down
6 changes: 3 additions & 3 deletions org.eclipse.lsp4e.tests.mock/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mock Language Server to test LSP4E
Bundle-SymbolicName: org.eclipse.lsp4e.tests.mock
Bundle-Version: 0.14.5.qualifier
Bundle-Version: 0.15.0.qualifier
Bundle-Vendor: Eclipse LSP4E
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.lsp4j;bundle-version="[0.14.0,0.15.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.14.0,0.15.0)"
Require-Bundle: org.eclipse.lsp4j;bundle-version="[0.15.0,0.16.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.15.0,0.16.0)"
Export-Package: org.eclipse.lsp4e.tests.mock
Automatic-Module-Name: org.eclipse.lsp4e.tests.mock
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.eclipse.lsp4j.launch.LSPLauncher;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.lsp4j.services.NotebookDocumentService;

public final class MockLanguageServer implements LanguageServer {

Expand Down Expand Up @@ -304,4 +305,9 @@ public void setDocumentSymbols(DocumentSymbol... documentSymbols) {
this.textDocumentService.setDocumentSymbols(Arrays.asList(documentSymbols));
}

@Override
public NotebookDocumentService getNotebookDocumentService() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.eclipse.lsp4j.launch.LSPLauncher;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.lsp4j.services.NotebookDocumentService;
import org.eclipse.lsp4j.services.WorkspaceService;

public final class MockLanguageServerMultiRootFolders implements LanguageServer {
Expand Down Expand Up @@ -242,4 +243,8 @@ public boolean isRunning() {
return this.started;
}

@Override
public NotebookDocumentService getNotebookDocumentService() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.LocationLink;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.PrepareRenameDefaultBehavior;
import org.eclipse.lsp4j.PrepareRenameParams;
import org.eclipse.lsp4j.PrepareRenameResult;
import org.eclipse.lsp4j.PublishDiagnosticsParams;
Expand All @@ -71,6 +72,7 @@
import org.eclipse.lsp4j.WillSaveTextDocumentParams;
import org.eclipse.lsp4j.WorkspaceEdit;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.lsp4j.jsonrpc.messages.Either3;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.services.TextDocumentService;

Expand Down Expand Up @@ -100,7 +102,7 @@ public class MockTextDocumentService implements TextDocumentService {
private List<Either<Command, CodeAction>> mockCodeActions;
private List<ColorInformation> mockDocumentColors;
private WorkspaceEdit mockRenameEdit;
private Either<Range, PrepareRenameResult> mockPrepareRenameResult;
private Either3<Range, PrepareRenameResult, PrepareRenameDefaultBehavior> mockPrepareRenameResult;
private List<DocumentSymbol> documentSymbols;

public <U> MockTextDocumentService(Function<U, CompletableFuture<U>> futureFactory) {
Expand All @@ -110,7 +112,8 @@ public <U> MockTextDocumentService(Function<U, CompletableFuture<U>> futureFacto
item.setLabel("Mock completion item");
mockCompletionList = new CompletionList(false, Collections.singletonList(item));
mockHover = new Hover(Collections.singletonList(Either.forLeft("Mock hover")), null);
mockPrepareRenameResult = Either.forRight(new PrepareRenameResult(new Range(new Position(0,0), new Position(0,0)), "placeholder"));
mockPrepareRenameResult = Either3
.forSecond(new PrepareRenameResult(new Range(new Position(0, 0), new Position(0, 0)), "placeholder"));
this.remoteProxies = new ArrayList<>();
this.documentSymbols = Collections.emptyList();
}
Expand Down Expand Up @@ -219,12 +222,9 @@ public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
}

@Override
public CompletableFuture<Either<Range, PrepareRenameResult>> prepareRename(PrepareRenameParams params) {
if (this.mockPrepareRenameResult == null) {
return CompletableFuture.completedFuture(null);
} else {
return CompletableFuture.completedFuture(this.mockPrepareRenameResult);
}
public CompletableFuture<Either3<Range, PrepareRenameResult, PrepareRenameDefaultBehavior>> prepareRename(
PrepareRenameParams params) {
return CompletableFuture.completedFuture(this.mockPrepareRenameResult);
}

@Override
Expand Down Expand Up @@ -307,7 +307,7 @@ public void setMockHover(Hover hover) {
}

public void setPrepareRenameResult(Either<Range, PrepareRenameResult> result) {
this.mockPrepareRenameResult = result;
this.mockPrepareRenameResult = result == null ? null : result.map(Either3::forFirst, Either3::forSecond);
}

public void setMockCodeLenses(List<CodeLens> codeLenses) {
Expand Down
6 changes: 3 additions & 3 deletions org.eclipse.lsp4e/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Language Server Protocol client for Eclipse IDE (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e;singleton:=true
Bundle-Version: 0.13.13.qualifier
Bundle-Version: 0.14.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.equinox.common;bundle-version="3.8.0",
Expand All @@ -27,8 +27,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.jdt.annotation;bundle-version="2.1.0";resolution:=optional,
org.eclipse.ui.editors,
org.eclipse.ui.navigator;bundle-version="3.6.100",
org.eclipse.lsp4j;bundle-version="[0.14.0,0.15.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.14.0,0.15.0)",
org.eclipse.lsp4j;bundle-version="[0.15.0,0.16.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.15.0,0.16.0)",
org.eclipse.mylyn.wikitext;bundle-version="3.0.40",
org.eclipse.mylyn.wikitext.markdown;bundle-version="3.0.40",
org.eclipse.ui.console,
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</parent>
<artifactId>org.eclipse.lsp4e</artifactId>
<packaging>eclipse-plugin</packaging>
<version>0.13.13-SNAPSHOT</version>
<version>0.14.0-SNAPSHOT</version>

<build>
<plugins>
Expand Down
6 changes: 0 additions & 6 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ public static CompletionParams toCompletionParams(URI fileUri, int offset, IDocu
Position start = toPosition(offset, document);
CompletionParams param = new CompletionParams();
param.setPosition(start);
param.setUri(fileUri.toString());
TextDocumentIdentifier id = new TextDocumentIdentifier();
id.setUri(fileUri.toString());
param.setTextDocument(id);
Expand All @@ -201,7 +200,6 @@ public static TextDocumentPositionParams toTextDocumentPosistionParams(URI fileU
Position start = toPosition(offset, document);
TextDocumentPositionParams param = new TextDocumentPositionParams();
param.setPosition(start);
param.setUri(fileUri.toString());
TextDocumentIdentifier id = new TextDocumentIdentifier();
id.setUri(fileUri.toString());
param.setTextDocument(id);
Expand All @@ -215,7 +213,6 @@ private static <T extends TextDocumentPositionParams> T toTextDocumentPositionPa
param.setPosition(start);
TextDocumentIdentifier id = new TextDocumentIdentifier();
if (uri != null) {
param.setUri(uri.toString());
id.setUri(uri.toString());
}
param.setTextDocument(id);
Expand Down Expand Up @@ -260,9 +257,6 @@ private static <T extends TextDocumentPositionParams> T toTextDocumentPositionPa
if (genericParams.getTextDocument() != null) {
specificParams.setTextDocument(genericParams.getTextDocument());
}
if (genericParams.getUri() != null) {
specificParams.setUri(genericParams.getUri());
}
return specificParams;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ public synchronized void start() throws IOException {
textDocumentClientCapabilities,
windowClientCapabilities,
lspStreamProvider.getExperimentalFeaturesPOJO()));
initParams.setClientName(name);
initParams.setClientInfo(getClientInfo(name));
initParams.setTrace(this.lspStreamProvider.getTrace(rootURI));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.lsp4e.LanguageServerPlugin;
import org.eclipse.lsp4e.LanguageServiceAccessor;
import org.eclipse.lsp4e.ui.Messages;
import org.eclipse.lsp4j.PrepareRenameDefaultBehavior;
import org.eclipse.lsp4j.PrepareRenameParams;
import org.eclipse.lsp4j.PrepareRenameResult;
import org.eclipse.lsp4j.Range;
Expand All @@ -40,6 +41,7 @@
import org.eclipse.lsp4j.WorkspaceEdit;
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.lsp4j.jsonrpc.messages.Either3;
import org.eclipse.lsp4j.jsonrpc.messages.ResponseError;
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.ltk.core.refactoring.Change;
Expand All @@ -64,7 +66,7 @@ public class LSPRenameProcessor extends RefactoringProcessor {
private String newName;

private WorkspaceEdit rename;
private Either<Range, PrepareRenameResult> prepareRenameResult;
private Either3<Range, PrepareRenameResult, PrepareRenameDefaultBehavior> prepareRenameResult;

public LSPRenameProcessor(@NonNull IDocument document, LanguageServer languageServer, int offset) {
this.document = document;
Expand Down Expand Up @@ -123,21 +125,21 @@ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
}

public String getPlaceholder() {
String placeholder = null;
if (prepareRenameResult != null) {
if (prepareRenameResult.isRight()) {
return prepareRenameResult.getRight().getPlaceholder();
} else {
Range range = prepareRenameResult.getLeft();
placeholder = prepareRenameResult.map(range -> {
try {
int startOffset = LSPEclipseUtils.toOffset(range.getStart(), document);
int endOffset = LSPEclipseUtils.toOffset(range.getEnd(), document);
return document.get(startOffset, endOffset - startOffset);
} catch (BadLocationException e) {
LanguageServerPlugin.logError(e);
return null;
}
}
}, result -> result.getPlaceholder(),
options -> null);
}
return "newName"; //$NON-NLS-1$
return placeholder != null && !placeholder.isBlank() ? placeholder :"newName"; //$NON-NLS-1$
}

public static boolean isPrepareRenameProvider(ServerCapabilities serverCapabilities) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<unit id="org.eclipse.lsp4j.jsonrpc" version="0.0.0"/>
<unit id="org.eclipse.lsp4j.debug" version="0.0.0"/>
<unit id="org.eclipse.lsp4j.jsonrpc.debug" version="0.0.0"/>
<repository location="https://download.eclipse.org/lsp4j/updates/releases/0.14.0/"/>
<repository location="https://download.eclipse.org/lsp4j/updates/releases/0.15.0/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.xtext.xbase.lib" version="0.0.0"/>
Expand Down