Skip to content

Commit 0c28fcd

Browse files
committed
try to execute slurp action
1 parent bfa026c commit 0c28fcd

File tree

1 file changed

+23
-1
lines changed
  • src/test/clojure/com/github/clojure_lsp/intellij

1 file changed

+23
-1
lines changed

src/test/clojure/com/github/clojure_lsp/intellij/foo_test.clj

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
[com.github.ericdallo.clj4intellij.app-manager :as app-manager]
55
[com.github.ericdallo.clj4intellij.test :as clj4intellij.test])
66
(:import
7-
[com.intellij.openapi.wm WindowManager]))
7+
[com.intellij.openapi.wm WindowManager]
8+
[com.intellij.openapi.actionSystem ActionManager]
9+
[com.intellij.ide DataManager]))
810

911
(set! *warn-on-reflection* true)
1012

@@ -13,6 +15,22 @@
1315
(let [status-bar (.. (WindowManager/getInstance) (getStatusBar project))]
1416
(.getWidget status-bar widget-id)))
1517

18+
19+
(defn run-editor-action [action-id project]
20+
(let [action (.getAction (ActionManager/getInstance) action-id)
21+
context (.getDataContext (DataManager/getInstance))]
22+
23+
24+
(println "Running action:" action-id)
25+
(println "Action:" action)
26+
(app-manager/write-command-action
27+
project
28+
(fn []
29+
(.actionPerformed
30+
action
31+
(com.intellij.openapi.actionSystem.AnActionEvent/createFromDataContext action-id nil context))))))
32+
33+
1634
(deftest foo-test
1735
(let [project-name "clojure.core"
1836
fixture (clj4intellij.test/setup project-name)
@@ -27,7 +45,11 @@
2745
project
2846
(fn [] (.openFileInEditor fixture clj-file)))
2947

48+
49+
3050
(clj4intellij.test/dispatch-all)
51+
(println "OLAAAA >> ")
52+
(run-editor-action "ClojureLSP.ForwardSlurp" project)
3153

3254
@(app-manager/invoke-later!
3355
{:invoke-fn (fn []

0 commit comments

Comments
 (0)