-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Accept by line. * Accept by line. * Accept by line. * Completion by line accept display fix. * Completion by line accept display fix. * Ctr + z undo fix. * Ignore multi-caret model completion
- Loading branch information
1 parent
7d7d360
commit 1faaf2d
Showing
15 changed files
with
547 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...a/com/zhongan/devpilot/completions/inline/AcceptDevPilotInlineCompletionByLineAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.zhongan.devpilot.completions.inline; | ||
|
||
import com.intellij.codeInsight.hint.HintManagerImpl.ActionToIgnore; | ||
import com.intellij.openapi.actionSystem.DataContext; | ||
import com.intellij.openapi.editor.Caret; | ||
import com.intellij.openapi.editor.Editor; | ||
import com.intellij.openapi.editor.actionSystem.EditorAction; | ||
import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler; | ||
|
||
public class AcceptDevPilotInlineCompletionByLineAction extends EditorAction implements ActionToIgnore, InlineCompletionAction { | ||
|
||
public static final String ACTION_ID = "AcceptDevPilotInlineCompletionByLineAction"; | ||
|
||
public AcceptDevPilotInlineCompletionByLineAction() { | ||
super(new AcceptInlineCompletionHandler()); | ||
} | ||
|
||
private static class AcceptInlineCompletionHandler extends EditorWriteActionHandler { | ||
|
||
@Override | ||
public void executeWriteAction(Editor editor, Caret caret, DataContext dataContext) { | ||
CompletionPreview.getInstance(editor).applyPreviewByLine(caret != null ? caret : editor.getCaretModel().getCurrentCaret()); | ||
} | ||
|
||
@Override | ||
protected boolean isEnabledForCaret(Editor editor, Caret caret, DataContext dataContext) { | ||
return CompletionPreview.getInstance(editor) != null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.