Skip to content

Commit a25d24f

Browse files
committed
Fix lsp-dart-run not working for dart ^3.0.0.
Fixes #197
1 parent 3db9f93 commit a25d24f

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* Avoid outdated test tree after tests run.
66
* Improve test output to be more precise on output messages.
7+
* Fix `lsp-dart-run` not working for dart ^3.0.0. #197
78

89
## 1.24.1
910

lsp-dart-dap.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ Run program PATH if not nil passing ARGS if not nil."
408408
(-> (list :type "dart"
409409
:name "Dart Run"
410410
:program path
411-
:args args
412411
:noDebug t)
412+
(lsp-dart-plist-put-if args :args args)
413413
lsp-dart-dap--populate-dart-start-file-args
414414
dap-start-debugging))
415415

@@ -419,8 +419,8 @@ Run program PATH if not nil passing ARGS if not nil."
419419
(-> (list :type "flutter"
420420
:name "Flutter Run"
421421
:program path
422-
:args args
423422
:noDebug t)
423+
(lsp-dart-plist-put-if args :args args)
424424
lsp-dart-dap--populate-flutter-start-file-args
425425
(funcall #'dap-start-debugging)))
426426

@@ -445,8 +445,8 @@ Run program PATH if not nil passing ARGS if not nil."
445445
lsp-dart-dap-dart-test-debugger-program)
446446
:program path
447447
:noDebug nil
448-
:shouldConnectDebugger t
449-
:args args)
448+
:shouldConnectDebugger t)
449+
(lsp-dart-plist-put-if args :args args)
450450
lsp-dart-dap--base-debugger-args
451451
dap-start-debugging))
452452

@@ -460,8 +460,8 @@ Run program PATH if not nil passing ARGS if not nil."
460460
:program path
461461
:noDebug nil
462462
:shouldConnectDebugger t
463-
:flutterMode "debug"
464-
:args args)
463+
:flutterMode "debug")
464+
(lsp-dart-plist-put-if args :args args)
465465
lsp-dart-dap--base-debugger-args
466466
dap-start-debugging))
467467

lsp-dart-utils.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ Order is important."
120120
(append list (list value))
121121
list))
122122

123+
(defun lsp-dart-plist-put-if (plist predicate key value)
124+
"plist-put KEY VALUE to PLIST if PREDICATE is t."
125+
(if predicate
126+
(plist-put plist key value)
127+
plist))
128+
123129
(defun lsp-dart-flutter-snap-install-p ()
124130
"Detecting whether this is a Linux system with a Snap style install."
125131
(and (string= system-type "gnu/linux")

0 commit comments

Comments
 (0)