File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 29
29
* Add ~lsp-bash-allowed-shells~ to configure supported ~sh-shell~ values.
30
30
* Add hint about ~activation-fn~ for unsupported buffers.
31
31
* Add Roc support
32
+ * Add support for environment variables in rust analyzer runnables. Allowing the new ~Update Tests (Expect)~ code lens to work as expected.
32
33
33
34
** 9.0.0
34
35
* Add language server config for QML (Qt Modeling Language) using qmlls.
Original file line number Diff line number Diff line change @@ -1505,19 +1505,25 @@ such as imports and dyn traits."
1505
1505
Extract the arguments, prepare the minor mode (cargo-process-mode if possible)
1506
1506
and run a compilation"
1507
1507
(-let* (((&rust-analyzer:Runnable :kind :label :args ) runnable)
1508
- ((&rust-analyzer:RunnableArgs :cargo-args :executable-args :workspace-root? :expect-test? ) args)
1508
+ ((&rust-analyzer:RunnableArgs :cargo-args :executable-args :workspace-root? :expect-test? :environment? ) args)
1509
1509
(default-directory (or workspace-root? default-directory)))
1510
1510
(if (not (string-equal kind " cargo" ))
1511
1511
(lsp--error " '%s' runnable is not supported" kind)
1512
1512
(compilation-start
1513
1513
(string-join (append (when expect-test? '(" env" " UPDATE_EXPECT=1" ))
1514
+ (when environment? (lsp-rust-analyzer--to-bash-env environment?) )
1514
1515
(list " cargo" ) cargo-args
1515
1516
(when executable-args '(" --" )) executable-args '()) " " )
1516
1517
1517
1518
; ; cargo-process-mode is nice, but try to work without it...
1518
1519
(if (functionp 'cargo-process-mode ) 'cargo-process-mode nil )
1519
1520
(lambda (_ ) (concat " *" label " *" ))))))
1520
1521
1522
+ (defun lsp-rust-analyzer--to-bash-env (env-vars )
1523
+ " Extract the environment variables from plist ENV-VARS."
1524
+ (cl-loop for (key value) on env-vars by 'cddr
1525
+ collect (format " %s =%s " (substring (symbol-name key) 1 ) value)))
1526
+
1521
1527
(defun lsp-rust-analyzer-run (runnable )
1522
1528
" Select and run a RUNNABLE action."
1523
1529
(interactive (list (lsp-rust-analyzer--select-runnable)))
Original file line number Diff line number Diff line change @@ -449,7 +449,7 @@ See `-let' for a description of the destructuring mechanism."
449
449
(rust-analyzer:MoveItemParams (:textDocument :range :direction ) nil )
450
450
(rust-analyzer:RunnablesParams (:textDocument ) (:position ))
451
451
(rust-analyzer:Runnable (:label :kind :args ) (:location ))
452
- (rust-analyzer:RunnableArgs (:cargoArgs :executableArgs ) (:workspaceRoot :expectTest ))
452
+ (rust-analyzer:RunnableArgs (:cargoArgs :executableArgs ) (:workspaceRoot :expectTest :environment ))
453
453
(rust-analyzer:RelatedTestsParams (:textDocument :position ) nil )
454
454
(rust-analyzer:RelatedTests (:runnable ) nil )
455
455
(rust-analyzer:SsrParams (:query :parseOnly ) nil )
You can’t perform that action at this time.
0 commit comments