Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import software.aws.toolkits.eclipse.amazonq.util.JsonHandler;
import software.aws.toolkits.eclipse.amazonq.util.ProgressNotificationUtils;
import software.aws.toolkits.eclipse.amazonq.util.QEclipseEditorUtils;
import software.aws.toolkits.eclipse.amazonq.util.ThreadingUtils;
import software.aws.toolkits.eclipse.amazonq.views.ChatUiRequestListener;
import software.aws.toolkits.eclipse.amazonq.views.model.ChatCodeReference;
import software.aws.toolkits.eclipse.amazonq.views.model.Command;
Expand Down Expand Up @@ -142,7 +143,7 @@ public void sendMessageToChatServer(final Command command, final Object params)
} catch (Exception e) {
throw new AmazonQPluginException("Error occurred when sending message to server", e);
}
});
}, ThreadingUtils.getWorkerPool());
}

private ChatRequestParams addEditorState(final ChatRequestParams chatRequestParams) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.ui.PlatformUI;

import software.aws.toolkits.eclipse.amazonq.util.Constants;
import software.aws.toolkits.eclipse.amazonq.util.ThreadingUtils;
import software.aws.toolkits.eclipse.amazonq.util.AutoTriggerDocumentListener;
import software.aws.toolkits.eclipse.amazonq.util.AutoTriggerPartListener;
import software.aws.toolkits.eclipse.amazonq.util.AutoTriggerTopLevelListener;
Expand All @@ -37,39 +38,41 @@ public class LspStartupActivity implements IStartup {

@Override
public final void earlyStartup() {
Job job = new Job("Start language servers") {
Job lspStartupJob = new Job("Start language servers") {
@Override
protected IStatus run(final IProgressMonitor monitor) {
try {
var lsRegistry = LanguageServersRegistry.getInstance();
var qServerDefinition = lsRegistry.getDefinition("software.aws.toolkits.eclipse.amazonq.qlanguageserver");
LanguageServiceAccessor.startLanguageServer(qServerDefinition);
Display.getDefault().asyncExec(() -> attachAutoTriggerListenersIfApplicable());
} catch (Exception e) {
return new Status(IStatus.ERROR, "amazonq", "Failed to start language server", e);
}
return Status.OK_STATUS;
}
};
job.schedule();
if (Activator.getPluginStore().get(ViewConstants.PREFERENCE_STORE_PLUGIN_FIRST_STARTUP_KEY) == null) {
Activator.getLspProvider().getAmazonQServer();
this.launchWebview();
}
Job updateCheckJob = new Job("Check for updates") {
@Override
protected IStatus run(final IProgressMonitor monitor) {
try {
UpdateUtils.getInstance().checkForUpdate();
} catch (Exception e) {
return new Status(IStatus.WARNING, "amazonq", "Failed to check for updates", e);
}
return Status.OK_STATUS;
lspStartupJob.setPriority(Job.INTERACTIVE);
lspStartupJob.schedule();
Activator.getLspProvider().getAmazonQServer().thenAcceptAsync(lsp -> {
if (Activator.getPluginStore().get(ViewConstants.PREFERENCE_STORE_PLUGIN_FIRST_STARTUP_KEY) == null) {
this.launchWebview();
}
};
Display.getDefault().asyncExec(() -> attachAutoTriggerListenersIfApplicable());
Job updateCheckJob = new Job("Check for updates") {
@Override
protected IStatus run(final IProgressMonitor monitor) {
try {
UpdateUtils.getInstance().checkForUpdate();
} catch (Exception e) {
return new Status(IStatus.WARNING, "amazonq", "Failed to check for updates", e);
}
return Status.OK_STATUS;
}
};

updateCheckJob.setPriority(Job.DECORATE);
updateCheckJob.schedule();
updateCheckJob.setPriority(Job.DECORATE);
updateCheckJob.schedule();
}, ThreadingUtils.getWorkerPool());
}

private void launchWebview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void setupBeforeEach() {
Consumer<? super ChatMessageProvider> consumer = invocation.getArgument(0);
consumer.accept(chatMessageProvider);
return CompletableFuture.completedFuture(null);
}).when(chatMessageProviderFuture).thenAcceptAsync(ArgumentMatchers.<Consumer<? super ChatMessageProvider>>any());
}).when(chatMessageProviderFuture).thenAcceptAsync(ArgumentMatchers.<Consumer<? super ChatMessageProvider>>any(), any());

chatCommunicationManager = spy(ChatCommunicationManager.builder()
.withJsonHandler(jsonHandler)
Expand Down