mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-16 19:44:36 +00:00
Inline Autocompletion Pt.2 (#333)
* Add first draft of inline code completion with mock text * Adds InsertInlineTextAction for inserting autocomplete suggestion with tab - Changed to disable suggestions when text is selected - Adds and removes the insert action based on when it shows the inlay hint * Request inline code completion * Move inline completion prompt into txt file * Add inline completion settings to ConfigurationState * Fix code style * Use EditorTrackerListener instead of EditorFactoryListener to enable inline completion * Code completion requests synchronously without SSE * Use LlamaClient.getInfill() for inline code completion * support inlay block element rendering, clean up code * Use only enclosed Method or Class contents for code completion if possible * Refactor extracting PsiElement contents in code completion * bump llm-client * fix completion call from triggering on EDT, force method params to be nonnull by default * refactor request building, decrease delay value * Trigger code completion if cursor is not inside a word * Improve inlay rendering * Support cancellable infill requests * add statusbar widget, disable completions by default * Show error notification if code completion failed * Truely disable/enable EditorInlayHandler when completion is turned off/on * Add CodeCompletionEnabledListener Topic to control enabling/disabling code-completion * Add progress indicator for code-completion with option to cancel * Add CodeCompletionServiceTest + refactor inlay ElementRenderers * several improvements - replace timer implementation with call debouncing - use OpenAI /v1/completions API for completions - code refactoring * trigger progress indicator only for llama completions * fix tests --------- Co-authored-by: James Higgins <james.isaac.higgins@gmail.com> Co-authored-by: Carl-Robert Linnupuu <carlrobertoh@gmail.com>
This commit is contained in:
parent
390d8cdd5e
commit
7387cf4536
41 changed files with 1461 additions and 21 deletions
|
|
@ -0,0 +1,52 @@
|
|||
package ee.carlrobert.codegpt.statusbar;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory.ActionSelectionAid;
|
||||
import com.intellij.openapi.ui.popup.ListPopup;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.StatusBarWidget;
|
||||
import com.intellij.openapi.wm.impl.status.EditorBasedStatusBarPopup;
|
||||
import ee.carlrobert.codegpt.CodeGPTBundle;
|
||||
import ee.carlrobert.codegpt.Icons;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CodeGPTStatusBarWidget extends EditorBasedStatusBarPopup {
|
||||
|
||||
public CodeGPTStatusBarWidget(Project project) {
|
||||
super(project, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull WidgetState getWidgetState(@Nullable VirtualFile file) {
|
||||
var state = new WidgetState(CodeGPTBundle.get("statusBar.widget.tooltip"), "", true);
|
||||
state.setIcon(Icons.DefaultSmall);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ListPopup createPopup(DataContext context) {
|
||||
return JBPopupFactory.getInstance()
|
||||
.createActionGroupPopup(
|
||||
CodeGPTBundle.get("project.label"),
|
||||
(ActionGroup) ActionManager.getInstance().getAction("codegpt.statusBarPopup"),
|
||||
context,
|
||||
ActionSelectionAid.SPEEDSEARCH,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull StatusBarWidget createInstance(@NotNull Project project) {
|
||||
return new CodeGPTStatusBarWidget(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNls @NotNull String ID() {
|
||||
return "ee.carlrobert.codegpt.statusbar.widget";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue