Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify when closure for Run Last Task keybinding #7890

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented May 26, 2020

What it does

fix #7888: specify when closure for Run Last Task keybinding

How to test

  • use ctrlcmd+shift+k when text input focused in not readonly editor
    • it should remove line
  • use ctrlcmd+shift+k when text input is not focused or editor is readonly
    • it should run the last task or ask to run a new task (that's aligned with VS Code)

Review checklist

Reminder for reviewers

…ybinding

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
@akosyakov akosyakov force-pushed the akosyakov/delete-line-keybinding-7888 branch from bd53a9b to fa9259f Compare May 26, 2020 08:30
@akosyakov akosyakov added the tasks issues related to the task system label May 26, 2020
@kittaakos
Copy link
Contributor

Sure, I can verify this easily but how do we know there aren't any broken keybindings after #7839? #7849 should cover them, right?

@akosyakov
Copy link
Member Author

akosyakov commented May 26, 2020

@kittaakos ideally we have to go through all Theia extensions in this repo which depend on the monaco extension and check that they contribute keybindings with proper when closures. Could we have a separate issue for it and unblock line deletion?

@akosyakov
Copy link
Member Author

@kittaakos I skimmed through all implementations of KeybindingContribution.registerKeybindings and found that many already have context closure, rest either don't depend on the monaco extension or don't have overlapping keybindings. I think you can do the same to double check.

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified 👍

@akosyakov
Copy link
Member Author

akosyakov commented May 26, 2020

Here is also a list of all keybindings which have more than 1 contribution. First keybinding has a priority in this list, i.e. it was added later and inserted at the beginning.

[
  {
    "k": "shift+f4",
    "v": [
      {
        "keybinding": "shift+f4",
        "command": "references-view.prev",
        "when": "reference-list.hasResult"
      },
      {
        "command": "goToPreviousReference",
        "keybinding": "shift+f4",
        "when": "referenceSearchVisible"
      },
      {
        "command": "goToPreviousReferenceFromEmbeddedEditor",
        "keybinding": "shift+f4",
        "when": "inReferenceSearchEditor"
      }
    ]
  },
  {
    "k": "f4",
    "v": [
      {
        "keybinding": "f4",
        "command": "references-view.next",
        "when": "reference-list.hasResult"
      },
      {
        "command": "goToNextReference",
        "keybinding": "f4",
        "when": "referenceSearchVisible"
      },
      {
        "command": "goToNextReferenceFromEmbeddedEditor",
        "keybinding": "f4",
        "when": "inReferenceSearchEditor"
      }
    ]
  },
  {
    "k": "cmd+f4",
    "v": [
      {
        "keybinding": "cmd+f4",
        "command": "extension.node-debug.pickLoadedScript",
        "when": "debugType == 'node2'"
      },
      {
        "keybinding": "cmd+f4",
        "command": "extension.node-debug.pickLoadedScript",
        "when": "debugType == 'node'"
      }
    ]
  },
  {
    "k": "esc",
    "v": [
      {
        "command": "notifications.commands.hide",
        "context": "notificationsVisible",
        "keybinding": "esc"
      },
      {
        "command": "git.editor.clear.annotations",
        "context": "showsBlameAnnotations",
        "keybinding": "esc"
      },
      {
        "command": "debug.breakpointWidget.close",
        "keybinding": "esc",
        "context": "breakpointWidgetInputStrictFocus"
      },
      {
        "command": "terminal:find:cancel",
        "keybinding": "esc",
        "context": "hideSearch"
      }
    ]
  },
  {
    "k": "alt+b",
    "v": [
      {
        "command": "git.editor.toggle.annotations",
        "context": "editorTextFocus",
        "keybinding": "alt+b"
      },
      {
        "command": "passthrough",
        "keybinding": "alt+b",
        "context": "terminalActive"
      }
    ]
  },
  {
    "k": "alt+h",
    "v": [
      {
        "command": "scm-history:open-branch-history",
        "keybinding": "alt+h"
      },
      {
        "command": "passthrough",
        "keybinding": "alt+h",
        "context": "terminalActive"
      }
    ]
  },
  {
    "k": "enter",
    "v": [
      {
        "command": "debug.breakpointWidget.accept",
        "keybinding": "enter",
        "context": "breakpointWidgetInputFocus"
      },
      {
        "command": "console.execute",
        "keybinding": "enter",
        "context": "consoleInputFocus"
      },
      {
        "command": "acceptRenameInput",
        "keybinding": "enter",
        "when": "editorFocus && renameInputVisible"
      },
      {
        "command": "acceptSelectedSuggestion",
        "keybinding": "enter",
        "when": "acceptSuggestionOnEnter && suggestWidgetVisible && suggestionMakesTextEdit && textInputFocus"
      },
      {
        "command": "editor.action.replaceOne",
        "keybinding": "enter",
        "when": "editorFocus && findWidgetVisible && replaceInputFocussed"
      },
      {
        "command": "editor.action.nextMatchFindAction",
        "keybinding": "enter",
        "when": "editorFocus && findInputFocussed"
      }
    ]
  },
  {
    "k": "f5",
    "v": [
      {
        "command": "workbench.action.debug.continue",
        "keybinding": "f5",
        "context": "inDebugMode"
      },
      {
        "command": "workbench.action.debug.start",
        "keybinding": "f5"
      }
    ]
  },
  {
    "k": "ctrlcmd+f",
    "v": [
      {
        "command": "terminal:find",
        "keybinding": "ctrlcmd+f",
        "context": "terminalActive"
      },
      {
        "command": "core.find",
        "keybinding": "ctrlcmd+f"
      }
    ]
  },
  {
    "k": "ctrlcmd+a",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrlcmd+a",
        "context": "terminalActive"
      },
      {
        "command": "console.selectAll",
        "keybinding": "ctrlcmd+a",
        "context": "consoleContentFocus"
      },
      {
        "command": "core.selectAll",
        "keybinding": "ctrlcmd+a"
      }
    ]
  },
  {
    "k": "alt+z",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "alt+z",
        "context": "terminalActive"
      },
      {
        "command": "editor.action.toggleWordWrap",
        "keybinding": "alt+z"
      }
    ]
  },
  {
    "k": "alt+w",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "alt+w",
        "context": "terminalActive"
      },
      {
        "command": "core.close.main.tab",
        "keybinding": "alt+w"
      }
    ]
  },
  {
    "k": "alt+r",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "alt+r",
        "context": "terminalActive"
      },
      {
        "command": "navigator.reveal",
        "keybinding": "alt+r"
      }
    ]
  },
  {
    "k": "alt+n",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "alt+n",
        "context": "terminalActive"
      },
      {
        "command": "file.newFile",
        "keybinding": "alt+n"
      }
    ]
  },
  {
    "k": "alt+m",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "alt+m",
        "context": "terminalActive"
      },
      {
        "command": "core.toggleMaximized",
        "keybinding": "alt+m"
      }
    ]
  },
  {
    "k": "alt+c",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "alt+c",
        "context": "terminalActive"
      },
      {
        "command": "core.collapse.tab",
        "keybinding": "alt+c"
      }
    ]
  },
  {
    "k": "ctrl+t",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+t",
        "context": "terminalActive"
      },
      {
        "command": "editor.action.transposeLetters",
        "keybinding": "ctrl+t",
        "when": "textInputFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "ctrl+p",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+p",
        "context": "terminalActive"
      },
      {
        "command": "selectPrevSuggestion",
        "keybinding": "ctrl+p",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "showPrevParameterHint",
        "keybinding": "ctrl+p",
        "when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
      },
      {
        "command": "cursorUp",
        "keybinding": "ctrl+p",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "ctrl+o",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+o",
        "context": "terminalActive"
      },
      {
        "command": "lineBreakInsert",
        "keybinding": "ctrl+o",
        "when": "textInputFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "ctrl+n",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+n",
        "context": "terminalActive"
      },
      {
        "command": "selectNextSuggestion",
        "keybinding": "ctrl+n",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "showNextParameterHint",
        "keybinding": "ctrl+n",
        "when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
      },
      {
        "command": "cursorDown",
        "keybinding": "ctrl+n",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "ctrl+k",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+k",
        "context": "terminalActive"
      },
      {
        "command": "deleteAllRight",
        "keybinding": "ctrl+k",
        "when": "textInputFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "ctrl+j",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+j",
        "context": "terminalActive"
      },
      {
        "command": "editor.action.joinLines",
        "keybinding": "ctrl+j",
        "when": "editorTextFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "ctrl+h",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+h",
        "context": "terminalActive"
      },
      {
        "command": "deleteLeft",
        "keybinding": "ctrl+h",
        "when": "textInputFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "ctrl+g",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+g",
        "context": "terminalActive"
      },
      {
        "command": "editor.action.gotoLine",
        "keybinding": "ctrl+g",
        "when": "editorFocus"
      }
    ]
  },
  {
    "k": "ctrl+f",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+f",
        "context": "terminalActive"
      },
      {
        "command": "cursorRight",
        "keybinding": "ctrl+f",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "ctrl+e",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+e",
        "context": "terminalActive"
      },
      {
        "command": "cursorLineEnd",
        "keybinding": "ctrl+e",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "ctrl+d",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+d",
        "context": "terminalActive"
      },
      {
        "command": "deleteRight",
        "keybinding": "ctrl+d",
        "when": "textInputFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "ctrl+b",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+b",
        "context": "terminalActive"
      },
      {
        "command": "cursorLeft",
        "keybinding": "ctrl+b",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "ctrl+a",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+a",
        "context": "terminalActive"
      },
      {
        "command": "cursorLineStart",
        "keybinding": "ctrl+a",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "ctrl+space",
    "v": [
      {
        "command": "passthrough",
        "keybinding": "ctrl+space",
        "context": "terminalActive"
      },
      {
        "command": "toggleSuggestionDetails",
        "keybinding": "ctrl+space",
        "when": "suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "editor.action.triggerSuggest",
        "keybinding": "ctrl+space",
        "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "down",
    "v": [
      {
        "command": "console.navigateNext",
        "keybinding": "down",
        "context": "consoleNavigationForwardEnabled"
      },
      {
        "command": "history.showNext",
        "keybinding": "down",
        "when": "historyNavigationEnabled && historyNavigationWidget"
      },
      {
        "command": "selectNextSuggestion",
        "keybinding": "down",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "showNextParameterHint",
        "keybinding": "down",
        "when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
      },
      {
        "command": "cursorDown",
        "keybinding": "down",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "up",
    "v": [
      {
        "command": "console.navigatePrevious",
        "keybinding": "up",
        "context": "consoleNavigationBackEnabled"
      },
      {
        "command": "history.showPrevious",
        "keybinding": "up",
        "when": "historyNavigationEnabled && historyNavigationWidget"
      },
      {
        "command": "selectPrevSuggestion",
        "keybinding": "up",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "showPrevParameterHint",
        "keybinding": "up",
        "when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
      },
      {
        "command": "cursorUp",
        "keybinding": "up",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "shift+f12",
    "v": [
      {
        "command": "goToPreviousReference",
        "keybinding": "shift+f12",
        "when": "referenceSearchVisible"
      },
      {
        "command": "goToPreviousReferenceFromEmbeddedEditor",
        "keybinding": "shift+f12",
        "when": "inReferenceSearchEditor"
      },
      {
        "command": "editor.action.goToReferences",
        "keybinding": "shift+f12",
        "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
      }
    ]
  },
  {
    "k": "f12",
    "v": [
      {
        "command": "goToNextReference",
        "keybinding": "f12",
        "when": "referenceSearchVisible"
      },
      {
        "command": "goToNextReferenceFromEmbeddedEditor",
        "keybinding": "f12",
        "when": "inReferenceSearchEditor"
      },
      {
        "command": "editor.gotoNextSymbolFromResult",
        "keybinding": "f12",
        "when": "hasSymbols"
      }
    ]
  },
  {
    "k": "escape",
    "v": [
      {
        "command": "closeReferenceSearch",
        "keybinding": "escape",
        "when": "referenceSearchVisible && !config.editor.stablePeek"
      },
      {
        "command": "closeAccessibilityHelp",
        "keybinding": "escape",
        "when": "accessibilityHelpWidgetVisible && editorFocus"
      },
      {
        "command": "cancelRenameInput",
        "keybinding": "escape",
        "when": "editorFocus && renameInputVisible"
      },
      {
        "command": "hideSuggestWidget",
        "keybinding": "escape",
        "when": "suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "closeParameterHints",
        "keybinding": "escape",
        "when": "editorFocus && parameterHintsVisible"
      },
      {
        "command": "closeMarkersNavigation",
        "keybinding": "escape",
        "when": "editorFocus && markersNavigationVisible"
      },
      {
        "command": "leaveSnippet",
        "keybinding": "escape",
        "when": "editorTextFocus && inSnippetMode"
      },
      {
        "command": "leaveEditorMessage",
        "keybinding": "escape",
        "when": "messageVisible"
      },
      {
        "command": "closeFindWidget",
        "keybinding": "escape",
        "when": "editorFocus && findWidgetVisible"
      },
      {
        "command": "editor.gotoNextSymbolFromResult.cancel",
        "keybinding": "escape",
        "when": "hasSymbols"
      },
      {
        "command": "editor.cancelOperation",
        "keybinding": "escape",
        "when": "cancellableOperation"
      },
      {
        "command": "removeSecondaryCursors",
        "keybinding": "escape",
        "when": "editorHasMultipleSelections && textInputFocus"
      },
      {
        "command": "cancelSelection",
        "keybinding": "escape",
        "when": "editorHasSelection && textInputFocus"
      },
      {
        "command": "closeReferenceSearchEditor",
        "keybinding": "escape",
        "when": "inReferenceSearchEditor && !config.editor.stablePeek"
      }
    ]
  },
  {
    "k": "shift+escape",
    "v": [
      {
        "command": "closeReferenceSearch",
        "keybinding": "shift+escape",
        "when": "referenceSearchVisible && !config.editor.stablePeek"
      },
      {
        "command": "closeAccessibilityHelp",
        "keybinding": "shift+escape",
        "when": "accessibilityHelpWidgetVisible && editorFocus"
      },
      {
        "command": "cancelRenameInput",
        "keybinding": "shift+escape",
        "when": "editorFocus && renameInputVisible"
      },
      {
        "command": "hideSuggestWidget",
        "keybinding": "shift+escape",
        "when": "suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "closeParameterHints",
        "keybinding": "shift+escape",
        "when": "editorFocus && parameterHintsVisible"
      },
      {
        "command": "closeMarkersNavigation",
        "keybinding": "shift+escape",
        "when": "editorFocus && markersNavigationVisible"
      },
      {
        "command": "leaveSnippet",
        "keybinding": "shift+escape",
        "when": "editorTextFocus && inSnippetMode"
      },
      {
        "command": "closeFindWidget",
        "keybinding": "shift+escape",
        "when": "editorFocus && findWidgetVisible"
      },
      {
        "command": "removeSecondaryCursors",
        "keybinding": "shift+escape",
        "when": "editorHasMultipleSelections && textInputFocus"
      },
      {
        "command": "cancelSelection",
        "keybinding": "shift+escape",
        "when": "editorHasSelection && textInputFocus"
      },
      {
        "command": "closeReferenceSearchEditor",
        "keybinding": "shift+escape",
        "when": "inReferenceSearchEditor && !config.editor.stablePeek"
      }
    ]
  },
  {
    "k": "alt+up",
    "v": [
      {
        "command": "history.showPrevious",
        "keybinding": "alt+up",
        "when": "historyNavigationEnabled && historyNavigationWidget"
      },
      {
        "command": "showPrevParameterHint",
        "keybinding": "alt+up",
        "when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
      },
      {
        "command": "editor.action.moveLinesUpAction",
        "keybinding": "alt+up",
        "when": "editorTextFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "alt+down",
    "v": [
      {
        "command": "history.showNext",
        "keybinding": "alt+down",
        "when": "historyNavigationEnabled && historyNavigationWidget"
      },
      {
        "command": "showNextParameterHint",
        "keybinding": "alt+down",
        "when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
      },
      {
        "command": "editor.action.moveLinesDownAction",
        "keybinding": "alt+down",
        "when": "editorTextFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "meta+up",
    "v": [
      {
        "command": "selectPrevSuggestion",
        "keybinding": "meta+up",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "cursorTop",
        "keybinding": "meta+up",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "pageup",
    "v": [
      {
        "command": "selectPrevPageSuggestion",
        "keybinding": "pageup",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "cursorPageUp",
        "keybinding": "pageup",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "meta+pageup",
    "v": [
      {
        "command": "selectPrevPageSuggestion",
        "keybinding": "meta+pageup",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "scrollPageUp",
        "keybinding": "meta+pageup",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "meta+down",
    "v": [
      {
        "command": "selectNextSuggestion",
        "keybinding": "meta+down",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "cursorBottom",
        "keybinding": "meta+down",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "pagedown",
    "v": [
      {
        "command": "selectNextPageSuggestion",
        "keybinding": "pagedown",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "cursorPageDown",
        "keybinding": "pagedown",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "meta+pagedown",
    "v": [
      {
        "command": "selectNextPageSuggestion",
        "keybinding": "meta+pagedown",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "scrollPageDown",
        "keybinding": "meta+pagedown",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "shift+tab",
    "v": [
      {
        "command": "insertPrevSuggestion",
        "keybinding": "shift+tab",
        "when": "hasOtherSuggestions && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
      },
      {
        "command": "acceptSelectedSuggestion",
        "keybinding": "shift+tab",
        "when": "suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "jumpToPrevSnippetPlaceholder",
        "keybinding": "shift+tab",
        "when": "editorTextFocus && hasPrevTabstop && inSnippetMode"
      },
      {
        "command": "outdent",
        "keybinding": "shift+tab",
        "when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus"
      }
    ]
  },
  {
    "k": "tab",
    "v": [
      {
        "command": "insertNextSuggestion",
        "keybinding": "tab",
        "when": "hasOtherSuggestions && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
      },
      {
        "command": "insertBestCompletion",
        "keybinding": "tab",
        "when": "atEndOfWord && !hasOtherSuggestions && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
      },
      {
        "command": "acceptSelectedSuggestion",
        "keybinding": "tab",
        "when": "suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "jumpToNextSnippetPlaceholder",
        "keybinding": "tab",
        "when": "editorTextFocus && hasNextTabstop && inSnippetMode"
      },
      {
        "command": "tab",
        "keybinding": "tab",
        "when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus"
      }
    ]
  },
  {
    "k": "shift+enter",
    "v": [
      {
        "command": "acceptSelectedSuggestion",
        "keybinding": "shift+enter",
        "when": "suggestWidgetVisible && textInputFocus"
      },
      {
        "command": "editor.action.previousMatchFindAction",
        "keybinding": "shift+enter",
        "when": "editorFocus && findInputFocussed"
      }
    ]
  },
  {
    "k": "meta+enter",
    "v": [
      {
        "command": "editor.action.replaceAll",
        "keybinding": "meta+enter",
        "when": "editorFocus && findWidgetVisible && replaceInputFocussed"
      },
      {
        "command": "editor.action.insertLineAfter",
        "keybinding": "meta+enter",
        "when": "editorTextFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "shift+alt+right",
    "v": [
      {
        "command": "cursorWordAccessibilityRightSelect",
        "keybinding": "shift+alt+right",
        "when": "accessibilityModeEnabled && textInputFocus"
      },
      {
        "command": "cursorWordEndRightSelect",
        "keybinding": "shift+alt+right",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "alt+right",
    "v": [
      {
        "command": "cursorWordAccessibilityRight",
        "keybinding": "alt+right",
        "when": "accessibilityModeEnabled && textInputFocus"
      },
      {
        "command": "cursorWordEndRight",
        "keybinding": "alt+right",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "shift+alt+left",
    "v": [
      {
        "command": "cursorWordAccessibilityLeftSelect",
        "keybinding": "shift+alt+left",
        "when": "accessibilityModeEnabled && textInputFocus"
      },
      {
        "command": "cursorWordStartLeftSelect",
        "keybinding": "shift+alt+left",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "alt+left",
    "v": [
      {
        "command": "cursorWordAccessibilityLeft",
        "keybinding": "alt+left",
        "when": "accessibilityModeEnabled && textInputFocus"
      },
      {
        "command": "cursorWordStartLeft",
        "keybinding": "alt+left",
        "when": "textInputFocus"
      }
    ]
  },
  {
    "k": "meta+/",
    "v": [
      {
        "command": "toggleExplainMode",
        "keybinding": "meta+/",
        "when": "suggestWidgetVisible"
      },
      {
        "command": "editor.action.commentLine",
        "keybinding": "meta+/",
        "when": "editorTextFocus && !editorReadonly"
      }
    ]
  },
  {
    "k": "shift+f7",
    "v": [
      {
        "command": "editor.action.wordHighlight.prev",
        "keybinding": "shift+f7",
        "when": "editorTextFocus && hasWordHighlights"
      },
      {
        "command": "editor.action.diffReview.prev",
        "keybinding": "shift+f7",
        "when": "isInDiffEditor"
      }
    ]
  },
  {
    "k": "f7",
    "v": [
      {
        "command": "editor.action.wordHighlight.next",
        "keybinding": "f7",
        "when": "editorTextFocus && hasWordHighlights"
      },
      {
        "command": "editor.action.diffReview.next",
        "keybinding": "f7",
        "when": "isInDiffEditor"
      }
    ]
  },
  {
    "k": "f2",
    "v": [
      {
        "command": "editor.action.rename",
        "keybinding": "f2",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
      },
      {
        "command": "file.rename",
        "keybinding": "f2",
        "context": "navigatorActive"
      }
    ]
  }
]

How to get it in the browser console:

const registry = theia.container.get(theia['@theia/core/lib/browser/keybinding'].KeybindingRegistry);
map = registry.keymaps[0].reduce((map, value) => {
  const values = map.get(value.keybinding) || [];
  values.push(value);
  map.set(value.keybinding, values);
  return map;
}, new Map());
collided = [];
for (const k of map.keys()) {
  const v = map.get(k);
  if (v.length > 1) {
    collided.push({k, v});
  }
}
JSON.stringify(collided, (key, value) => key === 'scope' || key === 'resolved' ? undefined: value, 2);

Copy link
Contributor

@RomanNikitenko RomanNikitenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, it works as described in How to test section:

  • it removes a line when an editor is focused
  • when an editor is not focused (another area is focused) it runs the last task or displays list of tasks for running if there is no last used task

In long-term I think it makes sense to define another keybinding for Run Last Task action to have ability to run the last task using keybinding when an editor is focused as well. But I don't have the proposal at the moment. Also user has ability to define own keybinding for Run Last Task action.

@akosyakov akosyakov merged commit 1153bfb into eclipse-theia:master May 26, 2020
@akosyakov akosyakov deleted the akosyakov/delete-line-keybinding-7888 branch May 26, 2020 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tasks issues related to the task system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Delete Line" Keybinding does not work
3 participants