From aa42bfbe972228eb5a53f6173d6a931b9cc4c0b7 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 19 Oct 2023 05:01:04 +0000 Subject: [PATCH 1/2] =?UTF-8?q?ci:=20=F0=9F=8F=B7=20Update=20PyPI=20versio?= =?UTF-8?q?n=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/pyproject.toml b/server/pyproject.toml index 247c2369b..d63c6f102 100644 --- a/server/pyproject.toml +++ b/server/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "continuedev" -version = "0.1.61" +version = "0.1.62" description = "" authors = ["Nate Sesti "] readme = "README.md" From 09e3e373d51aacd496ce107b9ca2703ebb6927ad Mon Sep 17 00:00:00 2001 From: James Vogel Date: Thu, 19 Oct 2023 23:59:23 -0500 Subject: [PATCH 2/2] register/unregister shortcuts instead of unregistering the commands themselves (#568) --- .../ContinuePluginStartupActivity.kt | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/intellij-extension/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/intellij-extension/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index fb66b9752..e0a3da21e 100644 --- a/intellij-extension/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/intellij-extension/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -459,19 +459,34 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable { private val coroutineScope = CoroutineScope(Dispatchers.IO) override fun runActivity(project: Project) { - // Register Actions - val actionManager = ActionManager.getInstance() - actionManager.unregisterAction("InsertLiveTemplate") - actionManager.unregisterAction("SurroundWithLiveTemplate") - actionManager.unregisterAction("EditorJoinLines") - // Initialize Plugin + removeShortcutFromAction(getPlatformSpecificKeyStroke("J")) + removeShortcutFromAction(getPlatformSpecificKeyStroke("shift J")) + ApplicationManager.getApplication().executeOnPooledThread { -// GlobalScope.async(Dispatchers.IO) { initializePlugin(project) } } + private fun getPlatformSpecificKeyStroke(key: String): String { + val osName = System.getProperty("os.name").lowercase() + val modifier = if (osName.contains("mac")) "meta" else "control" + return "$modifier $key" + } + + private fun removeShortcutFromAction(shortcut: String) { + val actionManager = ActionManager.getInstance() + val keyStroke = KeyStroke.getKeyStroke(shortcut) + val actionIds = actionManager.getActionIds(keyStroke) + + for (actionId in actionIds) { + val action = actionManager.getAction(actionId) + val shortcuts = action.shortcutSet.shortcuts.filterNot { it is KeyboardShortcut && it.firstKeyStroke == keyStroke }.toTypedArray() + + action.registerCustomShortcutSet(Shortcut { shortcuts }, null) + } + } + private fun initializePlugin(project: Project) { val continuePluginService = ServiceManager.getService( project,