Skip to content

Commit 6e9c640

Browse files
committed
interacting with editor - wip
1 parent f67bb03 commit 6e9c640

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

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

+14-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
[com.intellij.ide DataManager]
1313
[com.intellij.openapi.actionSystem ActionManager]
1414
[com.intellij.openapi.components ServiceManager]
15-
[com.intellij.openapi.wm WindowManager]))
15+
[com.intellij.openapi.wm WindowManager]
16+
[com.intellij.testFramework EditorTestUtil]))
1617

1718
(set! *warn-on-reflection* true)
1819

@@ -21,6 +22,14 @@
2122
(let [status-bar (.. (WindowManager/getInstance) (getStatusBar project))]
2223
(.getWidget status-bar widget-id)))
2324

25+
(defn ensure-editor
26+
"Ensure the editor was created in the UI thread"
27+
[project]
28+
(let [repl-content (repl-content project)]
29+
@(app-manager/invoke-later!
30+
{:invoke-fn (fn []
31+
(.addNotify repl-content)
32+
(.getEditor repl-content true))})))
2433

2534
(defn run-editor-action [action-id project]
2635
(let [action (.getAction (ActionManager/getInstance) action-id)
@@ -43,7 +52,8 @@
4352
deps-file (.createFile fixture "deps.edn" "{}")
4453
_ (.setTestDataPath fixture "testdata")
4554
clj-file (.copyFileToProject fixture "foo.clj")
46-
project (.getProject fixture)]
55+
project (.getProject fixture)
56+
editor (.getEditor fixture)]
4757
(is (= project-name (.getName project)))
4858
(is deps-file)
4959

@@ -71,7 +81,8 @@
7181
(println (lsp-client/server-status project))
7282
(println (db/get-in project [:status]))
7383

74-
84+
(println "editor >> ")
85+
(println editor)
7586
(run-editor-action "ClojureLSP.ForwardSlurp" project)
7687

7788
@(app-manager/invoke-later!

testdata/foo.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
(ns foo)
22

3-
(println) "Oiii"
3+
(println<caret>) "Oiii"

0 commit comments

Comments
 (0)