|
25 | 25 | (not))) %1) |
26 | 26 | files-res))) |
27 | 27 |
|
28 | | -(defn show-propose-env-dialog [] |
| 28 | +(defn show-propose-env-dialog [log-channel] |
29 | 29 | (let [select-label (-> l/lang :label :select-env) |
30 | 30 | dismiss-label (-> l/lang :label :dismiss) |
31 | 31 | dialog (w/show-notification (-> l/lang :notification :env-available) |
32 | 32 | [select-label dismiss-label])] |
33 | 33 | (p/mapcat dialog |
34 | 34 | #((cond |
35 | | - (= select-label %1) (cmd/execute :nix-env-selector/select-env) |
| 35 | + (= select-label %1) (cmd/execute :nix-env-selector/select-env log-channel) |
36 | 36 | (= dismiss-label %1) (workspace/config-set! vscode-config |
37 | 37 | :workspace |
38 | 38 | :nix-env-selector/suggestion |
|
54 | 54 | (= answer support-label) |
55 | 55 | (open-external-url constants/donate-url))))))) |
56 | 56 |
|
57 | | -(defn show-reload-dialog [] |
| 57 | +(defn show-reload-dialog [log-channel] |
58 | 58 | (let [reload-label (-> l/lang :label :reload) |
59 | 59 | reload-message (-> l/lang :notification :env-applied) |
60 | 60 | dialog (w/show-notification reload-message |
61 | 61 | [reload-label])] |
62 | 62 | (p/chain dialog |
63 | 63 | #(when (= reload-label %1) |
64 | | - (cmd/execute :workbench/action.reload-window))))) |
| 64 | + (cmd/execute :workbench/action.reload-window log-channel))))) |
65 | 65 |
|
66 | | -(defn load-env-by-path [nix-path status] |
| 66 | +(defn load-env-by-path [nix-path status log-channel] |
67 | 67 | (when nix-path |
| 68 | + (w/write-log log-channel (str "Loading env in path: " nix-path)) |
68 | 69 | (status-bar/show {:text (-> l/lang :label :env-loading)} |
69 | 70 | status) |
70 | 71 | (->> (env/get-nix-env-async {:nix-config nix-path |
71 | | - :nix-shell-path (:nix-shell-path @config)}) |
| 72 | + :nix-shell-path (:nix-shell-path @config)} |
| 73 | + log-channel) |
72 | 74 | (p/map (fn [env-vars] |
73 | 75 | (when env-vars |
74 | 76 | (env/set-current-env env-vars) |
|
79 | 81 | :command :nix-env-selector/select-env} status)))) |
80 | 82 | (p/mapcat show-reload-dialog)))) |
81 | 83 |
|
82 | | -(defn hit-nix-environment [status] |
| 84 | +(defn hit-nix-environment [status log-channel] |
| 85 | + (w/write-log log-channel "Running action: Hit environment") |
83 | 86 | (fn [] |
84 | 87 | (-> (:nix-file @config) |
85 | | - (load-env-by-path status)))) |
| 88 | + (load-env-by-path status log-channel)))) |
86 | 89 |
|
87 | | -(defn select-nix-environment [status] |
| 90 | +(defn select-nix-environment [status log-channel] |
| 91 | + (w/write-log log-channel "Running action: Select environment") |
88 | 92 | (fn [] |
89 | 93 | (->> (get-nix-files (:workspace-root @config)) |
90 | 94 | (p/mapcat #(w/show-quick-pick {:place-holder (-> l/lang :label :select-config-placeholder)} |
|
97 | 101 | (cond |
98 | 102 | (= "disable" (:id nix-file-name)) |
99 | 103 | (do |
| 104 | + (w/write-log log-channel "Selected to disable Nix environment") |
100 | 105 | (status-bar/hide status) |
101 | 106 | (workspace/config-set! vscode-config |
102 | 107 | :workspace |
|
109 | 114 |
|
110 | 115 | (not-empty nix-file-name) |
111 | 116 | (let [nix-file (str (:workspace-root @config) "/" (:id nix-file-name))] |
| 117 | + (w/write-log log-channel (str "Selected Nix file: " nix-file)) |
112 | 118 | (workspace/config-set! vscode-config |
113 | 119 | :workspace |
114 | 120 | :nix-env-selector/nix-file |
115 | 121 | (unrender-workspace nix-file (:workspace-root @config))) |
116 | 122 | nix-file)))) |
117 | | - (p/mapcat #(load-env-by-path %1 status)) |
| 123 | + (p/mapcat #(load-env-by-path %1 status log-channel)) |
118 | 124 | (p/error #(js/console.error %))))) |
0 commit comments