Skip to content

Commit

Permalink
Don't implement by default custom language client API
Browse files Browse the repository at this point in the history
Fixes #398

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr authored and datho7561 committed May 23, 2023
1 parent a80f431 commit c91e736
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
public interface MicroProfileJavaCodeActionProvider {

@JsonRequest("microprofile/java/codeAction")
default CompletableFuture<List<CodeAction>> getJavaCodeAction(MicroProfileJavaCodeActionParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<List<CodeAction>> getJavaCodeAction(MicroProfileJavaCodeActionParams javaParams);

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
public interface MicroProfileJavaCodeActionResolveProvider {

@JsonRequest("microprofile/java/codeActionResolve")
default CompletableFuture<CodeAction> resolveCodeAction(CodeAction unresolved) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<CodeAction> resolveCodeAction(CodeAction unresolved);

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
public interface MicroProfileJavaCodeLensProvider {

@JsonRequest("microprofile/java/codeLens")
default CompletableFuture<List<? extends CodeLens>> getJavaCodelens(MicroProfileJavaCodeLensParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<List<? extends CodeLens>> getJavaCodelens(MicroProfileJavaCodeLensParams javaParams);

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
public interface MicroProfileJavaCompletionProvider {

@JsonRequest("microprofile/java/completion")
default CompletableFuture<MicroProfileJavaCompletionResult> getJavaCompletion(MicroProfileJavaCompletionParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<MicroProfileJavaCompletionResult> getJavaCompletion(MicroProfileJavaCompletionParams javaParams);

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
import org.eclipse.lsp4mp.commons.MicroProfileJavaCompletionParams;

/**
* Returns context related to the cursor location in the given document,
* or null if the client doesn't yet support this.
* Returns context related to the cursor location in the given document, or null
* if the client doesn't yet support this.
*
* @see JavaCursorContextResult
*/
public interface MicroProfileJavaCursorContextProvider {

@JsonRequest("microprofile/java/javaCursorContext")
default CompletableFuture<JavaCursorContextResult> getJavaCursorContext(MicroProfileJavaCompletionParams context) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<JavaCursorContextResult> getJavaCursorContext(MicroProfileJavaCompletionParams context);

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
public interface MicroProfileJavaDefinitionProvider {

@JsonRequest("microprofile/java/definition")
default CompletableFuture<List<MicroProfileDefinition>> getJavaDefinition(
MicroProfileJavaDefinitionParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<List<MicroProfileDefinition>> getJavaDefinition(MicroProfileJavaDefinitionParams javaParams);

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
public interface MicroProfileJavaDiagnosticsProvider {

@JsonRequest("microprofile/java/diagnostics")
default CompletableFuture<List<PublishDiagnosticsParams>> getJavaDiagnostics(
MicroProfileJavaDiagnosticsParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<List<PublishDiagnosticsParams>> getJavaDiagnostics(MicroProfileJavaDiagnosticsParams javaParams);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
public interface MicroProfileJavaFileInfoProvider {

@JsonRequest("microprofile/java/fileInfo")
default CompletableFuture<JavaFileInfo> getJavaFileInfo(MicroProfileJavaFileInfoParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<JavaFileInfo> getJavaFileInfo(MicroProfileJavaFileInfoParams javaParams);

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
public interface MicroProfileJavaHoverProvider {

@JsonRequest("microprofile/java/hover")
default CompletableFuture<Hover> getJavaHover(MicroProfileJavaHoverParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<Hover> getJavaHover(MicroProfileJavaHoverParams javaParams);

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@
public interface MicroProfileJavaProjectLabelsProvider {

@JsonRequest("microprofile/java/projectLabels")
default CompletableFuture<ProjectLabelInfoEntry> getJavaProjectLabels(
MicroProfileJavaProjectLabelsParams javaParams) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<ProjectLabelInfoEntry> getJavaProjectLabels(MicroProfileJavaProjectLabelsParams javaParams);

@JsonRequest("microprofile/java/workspaceLabels")
default CompletableFuture<List<ProjectLabelInfoEntry>> getAllJavaProjectLabels() {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<List<ProjectLabelInfoEntry>> getAllJavaProjectLabels();

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
public interface MicroProfileJavaWorkspaceSymbolsProvider {

@JsonRequest("microprofile/java/workspaceSymbols")
default CompletableFuture<List<SymbolInformation>> getJavaWorkspaceSymbols(String projectUri) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<List<SymbolInformation>> getJavaWorkspaceSymbols(String projectUri);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
public interface MicroProfilePropertyDefinitionProvider {

@JsonRequest("microprofile/propertyDefinition")
default CompletableFuture<Location> getPropertyDefinition(MicroProfilePropertyDefinitionParams params) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<Location> getPropertyDefinition(MicroProfilePropertyDefinitionParams params);

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
public interface MicroProfilePropertyDocumentationProvider {

@JsonRequest("microprofile/propertyDocumentation")
default CompletableFuture<String> getPropertyDocumentation(MicroProfilePropertyDocumentationParams params) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<String> getPropertyDocumentation(MicroProfilePropertyDocumentationParams params);

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,34 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;

import org.eclipse.lsp4j.CodeAction;
import org.eclipse.lsp4j.CodeLens;
import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.MessageActionItem;
import org.eclipse.lsp4j.MessageParams;
import org.eclipse.lsp4j.PublishDiagnosticsParams;
import org.eclipse.lsp4j.ShowMessageRequestParams;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4mp.commons.JavaCursorContextResult;
import org.eclipse.lsp4mp.commons.JavaFileInfo;
import org.eclipse.lsp4mp.commons.MicroProfileDefinition;
import org.eclipse.lsp4mp.commons.MicroProfileJavaCodeActionParams;
import org.eclipse.lsp4mp.commons.MicroProfileJavaCodeLensParams;
import org.eclipse.lsp4mp.commons.MicroProfileJavaCompletionParams;
import org.eclipse.lsp4mp.commons.MicroProfileJavaCompletionResult;
import org.eclipse.lsp4mp.commons.MicroProfileJavaDefinitionParams;
import org.eclipse.lsp4mp.commons.MicroProfileJavaDiagnosticsParams;
import org.eclipse.lsp4mp.commons.MicroProfileJavaFileInfoParams;
import org.eclipse.lsp4mp.commons.MicroProfileJavaHoverParams;
import org.eclipse.lsp4mp.commons.MicroProfileJavaProjectLabelsParams;
import org.eclipse.lsp4mp.commons.MicroProfileProjectInfo;
import org.eclipse.lsp4mp.commons.MicroProfileProjectInfoParams;
import org.eclipse.lsp4mp.commons.MicroProfilePropertiesChangeEvent;
import org.eclipse.lsp4mp.commons.MicroProfilePropertiesScope;
import org.eclipse.lsp4mp.commons.MicroProfilePropertyDefinitionParams;
import org.eclipse.lsp4mp.commons.MicroProfilePropertyDocumentationParams;
import org.eclipse.lsp4mp.commons.ProjectLabelInfoEntry;
import org.eclipse.lsp4mp.commons.metadata.ItemBase;
import org.eclipse.lsp4mp.commons.metadata.ItemHint;
import org.eclipse.lsp4mp.commons.metadata.ItemMetadata;
Expand Down Expand Up @@ -73,7 +91,7 @@ public void showMessage(MessageParams messageParams) {

@Override
public CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams requestParams) {
return null;
return CompletableFuture.completedFuture(null);
}

@Override
Expand Down Expand Up @@ -220,4 +238,73 @@ public List<PublishDiagnosticsParams> getPublishDiagnostics() {
return publishDiagnostics;
}

@Override
public CompletableFuture<String> getPropertyDocumentation(MicroProfilePropertyDocumentationParams params) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<List<CodeAction>> getJavaCodeAction(MicroProfileJavaCodeActionParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<List<? extends CodeLens>> getJavaCodelens(MicroProfileJavaCodeLensParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<MicroProfileJavaCompletionResult> getJavaCompletion(
MicroProfileJavaCompletionParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<List<PublishDiagnosticsParams>> getJavaDiagnostics(
MicroProfileJavaDiagnosticsParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<List<MicroProfileDefinition>> getJavaDefinition(
MicroProfileJavaDefinitionParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<Hover> getJavaHover(MicroProfileJavaHoverParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<ProjectLabelInfoEntry> getJavaProjectLabels(
MicroProfileJavaProjectLabelsParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<List<ProjectLabelInfoEntry>> getAllJavaProjectLabels() {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<JavaFileInfo> getJavaFileInfo(MicroProfileJavaFileInfoParams javaParams) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<CodeAction> resolveCodeAction(CodeAction unresolved) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<JavaCursorContextResult> getJavaCursorContext(MicroProfileJavaCompletionParams context) {
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<List<SymbolInformation>> getJavaWorkspaceSymbols(String projectUri) {
return CompletableFuture.completedFuture(null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
******************************************************************************/
package org.eclipse.lsp4mp.ls.deadlock;

import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.eclipse.lsp4j.DidOpenTextDocumentParams;
import org.eclipse.lsp4j.MessageActionItem;
import org.eclipse.lsp4j.MessageParams;
Expand All @@ -22,32 +36,19 @@
import org.eclipse.lsp4mp.commons.MicroProfileProjectInfoParams;
import org.eclipse.lsp4mp.commons.ProjectLabelInfoEntry;
import org.eclipse.lsp4mp.ls.MicroProfileServerLauncher;
import org.eclipse.lsp4mp.ls.api.MicroProfileLanguageClientAPI;
import org.eclipse.lsp4mp.ls.MockMicroProfileLanguageClient;
import org.eclipse.lsp4mp.ls.api.MicroProfileLanguageServerAPI;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertTrue;

public class MicroProfileLanguageServerDeadlockTest {
private static class MyLanguageClient implements MicroProfileLanguageClientAPI {
private static class MyLanguageClient extends MockMicroProfileLanguageClient {

private final CountDownLatch latch;

private MyLanguageClient(CountDownLatch latch) {
super(null);
this.latch = latch;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public CompletableFuture<ProjectLabelInfoEntry> getJavaProjectLabels(
ProjectLabelInfoEntry projectInfo = new ProjectLabelInfoEntry(uri, "", labels);
return CompletableFuture.completedFuture(projectInfo);
}

@Override
public CompletableFuture<List<ProjectLabelInfoEntry>> getAllJavaProjectLabels() {
return CompletableFuture.completedFuture(null);
}
};

@Test
Expand Down
Loading

0 comments on commit c91e736

Please sign in to comment.