org.eclipse.lsp4j.ApplyWorkspaceEditResponse Java Examples

The following examples show how to use org.eclipse.lsp4j.ApplyWorkspaceEditResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LanguageClientImpl.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public final CompletableFuture<ApplyWorkspaceEditResponse> applyEdit(ApplyWorkspaceEditParams params) {
    CompletableFuture<ApplyWorkspaceEditResponse> future = new CompletableFuture<>();
    ApplicationManager.getApplication().executeOnPooledThread(() -> {
        LSPIJUtils.applyWorkspaceEdit(params.getEdit());
        future.complete(new ApplyWorkspaceEditResponse(true));
    });
    return future;
}
 
Example #2
Source File: IdeTestLanguageClient.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public CompletableFuture<ApplyWorkspaceEditResponse> applyEdit(ApplyWorkspaceEditParams params) {
	boolean applied = false;
	synchronized (listeners) {
		for (IIdeTestLanguageClientListener l : listeners) {
			applied |= l.onServerRequest_applyEdit(params);
		}
	}
	return CompletableFuture.completedFuture(new ApplyWorkspaceEditResponse(applied));
}
 
Example #3
Source File: DefaultLanguageClient.java    From lsp4intellij with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<ApplyWorkspaceEditResponse> applyEdit(ApplyWorkspaceEditParams params) {
    boolean response = WorkspaceEditHandler.applyEdit(params.getEdit(), "LSP edits");
    return CompletableFuture.supplyAsync(() -> new ApplyWorkspaceEditResponse(response));
}
 
Example #4
Source File: LanguageClientImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<ApplyWorkspaceEditResponse> applyEdit(ApplyWorkspaceEditParams params) {
    Utils.applyWorkspaceEdit(params.getEdit());
    return CompletableFuture.completedFuture(new ApplyWorkspaceEditResponse(true));
}
 
Example #5
Source File: CommandRegistryTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public CompletableFuture<ApplyWorkspaceEditResponse> applyEdit(ApplyWorkspaceEditParams params) {
	return noImpl3.applyEdit(params);
}
 
Example #6
Source File: LanguageClient.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * The workspace/applyEdit request is sent from the server to the client to modify resource on the client side.
 */
@JsonRequest("workspace/applyEdit")
default CompletableFuture<ApplyWorkspaceEditResponse> applyEdit(ApplyWorkspaceEditParams params) {
	throw new UnsupportedOperationException();
}
 
Example #7
Source File: JavaClientConnection.java    From eclipse.jdt.ls with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Sends a message to client to apply the given workspace edit.
 * This is available since LSP v3.0 should be used
 * only by checking the ClientCapabilities.
 *
 * @param edit
 */
public boolean applyWorkspaceEdit(WorkspaceEdit edit){
	ApplyWorkspaceEditParams $ = new ApplyWorkspaceEditParams();
	$.setEdit(edit);
	ApplyWorkspaceEditResponse response = client.applyEdit($).join();
	return response.isApplied();
}