Removed: Code action on selection change

This commit is contained in:
Akash Yadav
2021-10-19 07:28:35 +05:30
parent 7ca7e4fde1
commit 268bd20003
8 changed files with 7 additions and 49 deletions
+2 -2
View File
@@ -45,14 +45,14 @@ android {
signingConfigs {
debug {
storeFile file("/sdcard/Android App Projects/publishKey.keystore")
storeFile file("/sdcard/AndroidAppProjects/publishKey.keystore")
storePassword "itsaky"
keyAlias "itsaky"
keyPassword "itsaky"
}
release {
storeFile file("/sdcard/Android App Projects/publishKey.keystore")
storeFile file("/sdcard/AndroidAppProjects/publishKey.keystore")
storePassword "itsaky"
keyAlias "itsaky"
keyPassword "itsaky"
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -129,29 +129,6 @@ public abstract class AbstractLanguageClient implements IDELanguageClient {
}
}
public void showCodeActions(List<Either<Command, CodeAction>> actions) {
final String[] titles = new String[actions.size()];
int i=0;
for(Either<Command, CodeAction> either : actions) {
if(either.isLeft()) {
titles[i] = "[Command] " + either.getLeft().getTitle();
} else if(either.isRight()) {
titles[i] = "[Action] " + either.getRight().getTitle();
}
++i;
}
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity(), R.style.AppTheme_MaterialAlertDialog);
builder.setTitle(R.string.msg_code_actions);
builder.setItems(titles, null);
builder.show();
}
public void hideCodeActions() {
if(activity() == null) return;
}
public void showDiagnostic(Diagnostic diagnostic, final CodeEditor editor) {
if(activity() == null || activity().getDiagnosticBinding() == null) {
return;
@@ -165,11 +142,6 @@ public abstract class AbstractLanguageClient implements IDELanguageClient {
final LayoutDiagnosticInfoBinding binding = activity().getDiagnosticBinding();
binding.getRoot().setText(diagnostic.getMessage());
TransitionSet set = new TransitionSet();
set.addTransition(new ChangeBounds());
set.addTransition(new Fade());
set.setDuration(DIAGNOSTIC_TRANSITION_DURATION);
binding.getRoot().setVisibility(View.VISIBLE);
final float[] cursor = editor.getCursorPosition();
@@ -4831,28 +4831,14 @@ public class CodeEditor extends View implements ContentListener, TextAnalyzer.Ca
* Called by {@link EditorTouchEventHandler}
* <p>
* TODO The current implementation in JLS does not work. Make it work!
*
* @return A {@link CompletableFuture}. May return {@code null}.
*/
public void requestCodeActions() {
if(mLanguageServer == null && mLanguageClient == null) return;
public CompletableFuture<List<Either<Command, CodeAction>>> requestCodeActions() {
if(mLanguageServer == null && mLanguageClient == null) return null;
final List<Diagnostic> diagnostics = findDiagnosticsContainingLine(getCursor().getLeftLine());
final CompletableFuture<List<Either<Command, CodeAction>>> future = mCodeActionProvider.codeActions(mLanguageServer, getDocumentIdentifier(), getCursorRange(), diagnostics);
if(future == null) {
return;
}
future.whenComplete((l, t) -> {
final List<Either<Command, CodeAction>> actions = l;
final Throwable th = t;
if(future.isCancelled() || future.isCompletedExceptionally() || actions == null || actions.isEmpty()) {
mLanguageClient.hideCodeActions();
return;
}
mLanguageClient.showCodeActions(actions);
});
return mCodeActionProvider.codeActions(mLanguageServer, getDocumentIdentifier(), getCursorRange(), diagnostics);
}
public Position getCursorAsLSPPosition() {
Binary file not shown.
Binary file not shown.