mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-20 17:52:23 +00:00
feat: code assistant (#810)
* feat: code assistant implementation * refactor: clean up
This commit is contained in:
parent
d81648549c
commit
8d6ca73064
32 changed files with 944 additions and 62 deletions
|
|
@ -1,10 +1,12 @@
|
|||
package ee.carlrobert.codegpt;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import ee.carlrobert.codegpt.predictions.CodeSuggestionDiffViewer;
|
||||
import ee.carlrobert.codegpt.settings.prompts.PersonaDetails;
|
||||
import ee.carlrobert.codegpt.ui.DocumentationDetails;
|
||||
import ee.carlrobert.llm.client.codegpt.CodeGPTUserDetails;
|
||||
import java.util.List;
|
||||
import okhttp3.Call;
|
||||
|
||||
public class CodeGPTKeys {
|
||||
|
||||
|
|
@ -26,4 +28,8 @@ public class CodeGPTKeys {
|
|||
Key.create("codegpt.isFetchingCompletion");
|
||||
public static final Key<Boolean> IS_PROMPT_TEXT_FIELD_DOCUMENT =
|
||||
Key.create("codegpt.isPromptTextFieldDocument");
|
||||
public static final Key<CodeSuggestionDiffViewer> EDITOR_PREDICTION_DIFF_VIEWER =
|
||||
Key.create("codegpt.editorPredictionDiffViewer");
|
||||
public static final Key<Call> PENDING_PREDICTION_CALL =
|
||||
Key.create("codegpt.editorPendingPredictionCall");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package ee.carlrobert.codegpt.statusbar;
|
||||
|
||||
import static ee.carlrobert.codegpt.CodeGPTKeys.IS_FETCHING_COMPLETION;
|
||||
import static ee.carlrobert.codegpt.CodeGPTKeys.PENDING_PREDICTION_CALL;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
|
|
@ -44,7 +45,9 @@ public class CodeGPTStatusBarWidget extends EditorBasedStatusBarPopup {
|
|||
protected @NotNull WidgetState getWidgetState(@Nullable VirtualFile file) {
|
||||
var state = new WidgetState(CodeGPTBundle.get("statusBar.widget.tooltip"), "", true);
|
||||
var fetchingCompletion = IS_FETCHING_COMPLETION.get(getEditor());
|
||||
var loading = fetchingCompletion != null && fetchingCompletion;
|
||||
var pendingPredicationCall = PENDING_PREDICTION_CALL.get(getEditor());
|
||||
var loading =
|
||||
(fetchingCompletion != null && fetchingCompletion) || pendingPredicationCall != null;
|
||||
|
||||
state.setIcon(loading ? Icons.StatusBarCompletionInProgress : Icons.DefaultSmall);
|
||||
return state;
|
||||
|
|
|
|||
|
|
@ -139,8 +139,14 @@ public class UIUtil {
|
|||
}
|
||||
|
||||
public static JLabel createComment(String messageKey) {
|
||||
return createComment(messageKey, ComponentPanelBuilder.MAX_COMMENT_WIDTH);
|
||||
}
|
||||
|
||||
public static JLabel createComment(String messageKey, int maxLineLength) {
|
||||
var comment = ComponentPanelBuilder.createCommentComponent(
|
||||
CodeGPTBundle.get(messageKey), true);
|
||||
CodeGPTBundle.get(messageKey),
|
||||
true,
|
||||
maxLineLength);
|
||||
comment.setBorder(JBUI.Borders.empty(0, 4));
|
||||
return comment;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue