|
9 | 9 | [com.github.clojure_lsp.intellij.extension SettingsState]
|
10 | 10 | [com.intellij.ide DataManager]
|
11 | 11 | [com.intellij.openapi.actionSystem ActionManager]
|
12 |
| - [com.intellij.openapi.components ServiceManager] |
13 |
| - [com.intellij.openapi.editor LogicalPosition] |
14 |
| - [com.intellij.openapi.wm WindowManager])) |
| 12 | + [com.intellij.openapi.components ServiceManager])) |
15 | 13 |
|
16 | 14 | (set! *warn-on-reflection* true)
|
17 | 15 |
|
18 |
| -(defn get-status-bar-widget [project widget-id] |
19 |
| - (let [status-bar (.. (WindowManager/getInstance) (getStatusBar project))] |
20 |
| - (.getWidget status-bar widget-id))) |
| 16 | +(defn get-editor-text |
| 17 | + "Returns the text content of the editor's document." |
| 18 | + [fixture] |
| 19 | + (-> fixture .getEditor .getDocument .getText)) |
| 20 | + |
| 21 | +(defn open-file-in-editor |
| 22 | + "Opens a file in the editor and returns the editor instance." |
| 23 | + [fixture file] |
| 24 | + (let [project (.getProject fixture)] |
| 25 | + (app-manager/write-command-action |
| 26 | + project |
| 27 | + (fn [] (.openFileInEditor fixture file))) |
| 28 | + (.getEditor fixture))) |
21 | 29 |
|
22 | 30 | (defn run-editor-action
|
23 | 31 | "Runs an editor action with the given ID for the specified project."
|
|
77 | 85 | :project project
|
78 | 86 | :deps-file deps-file})))
|
79 | 87 |
|
80 |
| -(defn open-file-in-editor |
81 |
| - "Opens a file in the editor and returns the editor instance." |
82 |
| - [fixture file] |
83 |
| - (let [project (.getProject fixture)] |
84 |
| - (app-manager/write-command-action |
85 |
| - project |
86 |
| - (fn [] (.openFileInEditor fixture file))) |
87 |
| - (.getEditor fixture))) |
88 |
| - |
89 |
| -(defn move-caret-to-position |
90 |
| - "Moves the caret to the specified logical position in the editor." |
91 |
| - [editor line column] |
92 |
| - (let [caret (.getCaretModel editor) |
93 |
| - new-position (LogicalPosition. line column)] |
94 |
| - @(app-manager/invoke-later! |
95 |
| - {:invoke-fn (fn [] (.moveToLogicalPosition caret new-position))}))) |
96 |
| - |
97 |
| -(defn get-editor-text |
98 |
| - "Returns the text content of the editor's document." |
99 |
| - [fixture] |
100 |
| - (-> fixture .getEditor .getDocument .getText)) |
101 |
| - |
102 |
| -(defn check-result-by-file |
103 |
| - "Checks if the current editor content matches the expected file." |
104 |
| - [fixture expected-file] |
105 |
| - (.checkResultByFile fixture expected-file)) |
106 |
| - |
107 | 88 | (defn setup-lsp-server
|
108 | 89 | "Sets up and waits for the LSP server to be ready."
|
109 | 90 | [project]
|
|
0 commit comments