|
12 | 12 | [com.intellij.ide DataManager] |
13 | 13 | [com.intellij.openapi.actionSystem ActionManager] |
14 | 14 | [com.intellij.openapi.components ServiceManager] |
15 | | - [com.intellij.openapi.wm WindowManager])) |
| 15 | + [com.intellij.openapi.wm WindowManager] |
| 16 | + [com.intellij.testFramework EditorTestUtil])) |
16 | 17 |
|
17 | 18 | (set! *warn-on-reflection* true) |
18 | 19 |
|
|
21 | 22 | (let [status-bar (.. (WindowManager/getInstance) (getStatusBar project))] |
22 | 23 | (.getWidget status-bar widget-id))) |
23 | 24 |
|
| 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))}))) |
24 | 33 |
|
25 | 34 | (defn run-editor-action [action-id project] |
26 | 35 | (let [action (.getAction (ActionManager/getInstance) action-id) |
|
43 | 52 | deps-file (.createFile fixture "deps.edn" "{}") |
44 | 53 | _ (.setTestDataPath fixture "testdata") |
45 | 54 | clj-file (.copyFileToProject fixture "foo.clj") |
46 | | - project (.getProject fixture)] |
| 55 | + project (.getProject fixture) |
| 56 | + editor (.getEditor fixture)] |
47 | 57 | (is (= project-name (.getName project))) |
48 | 58 | (is deps-file) |
49 | 59 |
|
|
71 | 81 | (println (lsp-client/server-status project)) |
72 | 82 | (println (db/get-in project [:status])) |
73 | 83 |
|
74 | | - |
| 84 | + (println "editor >> ") |
| 85 | + (println editor) |
75 | 86 | (run-editor-action "ClojureLSP.ForwardSlurp" project) |
76 | 87 |
|
77 | 88 | @(app-manager/invoke-later! |
|
0 commit comments