bugfix(jb): dont override esc key globally
This commit is contained in:
parent
d5491cc21c
commit
e991e519ca
3 changed files with 23 additions and 20 deletions
|
|
@ -1,8 +0,0 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Continue" type="CompoundRunConfigurationType">
|
||||
<toRun name="Run Extension" type="GradleRunConfiguration" />
|
||||
<toRun name="GUI: Start Dev Server" type="js.build_tools.npm" />
|
||||
<toRun name="Tail Dev Logs" type="ShConfigurationType" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
|
|
@ -1,21 +1,30 @@
|
|||
package com.github.continuedev.continueintellijextension.autocomplete
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.service
|
||||
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.EditorActionHandler
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
class CancelAutocompleteAction : EditorAction(object : EditorActionHandler() {
|
||||
override fun doExecute(editor: Editor, caret: Caret?, dataContext: DataContext?) {
|
||||
ApplicationManager.getApplication().runWriteAction {
|
||||
editor.project?.service<AutocompleteService>()?.clearCompletions(editor)
|
||||
class CancelAutocompleteAction : AnAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
if (isInvokedInEditor(e)) {
|
||||
val editor = e.getRequiredData(CommonDataKeys.EDITOR)
|
||||
ApplicationManager.getApplication().runWriteAction {
|
||||
editor.project?.service<AutocompleteService>()?.clearCompletions(editor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun isEnabledForCaret(editor: Editor, caret: Caret, dataContext: DataContext?): Boolean {
|
||||
return true
|
||||
override fun update(e: AnActionEvent) {
|
||||
e.presentation.isEnabledAndVisible = isInvokedInEditor(e)
|
||||
}
|
||||
}) {}
|
||||
|
||||
private fun isInvokedInEditor(e: AnActionEvent): Boolean {
|
||||
val project: Project? = e.project
|
||||
val editor: Editor? = e.getData(CommonDataKeys.EDITOR)
|
||||
return project != null && editor != null && editor.contentComponent.hasFocus()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,9 @@ fun openInlineEdit(project: Project?, editor: Editor) {
|
|||
editor,
|
||||
startLineNumber,
|
||||
endLineNumber,
|
||||
{ inlayRef.get().dispose() },
|
||||
{
|
||||
inlayRef.get()?.dispose()
|
||||
},
|
||||
{
|
||||
textArea.document.insertString(textArea.caretPosition, ", ", null)
|
||||
textArea.requestFocus()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue