Skip to content

Commit 65b308b

Browse files
committed
feat: add new option for devtools xwidgets support
Allows the use of flutter devtools within an xwidgets frame
1 parent c2dcced commit 65b308b

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,19 @@ matching names.
150150

151151
You can also open the [Dart DevTools](https://dart.dev/tools/dart-devtools) on the current debug session with `lsp-dart-open-devtools`.
152152

153+
It's also possible to spawn the devtools inside an
154+
[XWidgets](https://www.emacswiki.org/emacs/EmacsXWidgets) frame by enabling
155+
`lsp-dart-devtools-prefer-xwidgets` and ensuring that your emacs has proper
156+
support for xwidgets frames.
157+
158+
NVIDIA users may have to enable the below environment variables:
159+
160+
``` shell
161+
WEBKIT_DISABLE_COMPOSITING_MODE=1
162+
WEBKIT_FORCE_SANDBOX=0
163+
```
164+
165+
153166
### Commands
154167

155168
lsp-dart supports running Flutter and Dart commands as following:

lsp-dart-devtools.el

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
:group 'lsp-dart
3838
:type 'string)
3939

40+
(defcustom lsp-dart-devtools-prefer-xwidgets nil
41+
"If t and xwidgets support exists, open the devtools in an xwidget-webkit
42+
view.
43+
NOTE XWidgets are still quite buggy so only enable this if you know you have support"
44+
:group 'lsp-dart
45+
:type 'boolean)
46+
4047
(defconst lsp-dart-devtools--buffer-name "*LSP Dart - DevTools*")
4148

4249
(defun lsp-dart-devtools-log (msg &rest args)
@@ -133,7 +140,12 @@ If it is already activated or after activated successfully, call CALLBACK."
133140
(hide ,lsp-dart-devtools-hide-options)
134141
(theme ,lsp-dart-devtools-theme))))
135142
(url (concat "http://" uri "?" params)))
136-
(browse-url url)))
143+
(if (and lsp-dart-devtools-prefer-xwidgets
144+
(featurep 'xwidget-internal))
145+
(progn
146+
(select-window (split-window (selected-window) nil 'right))
147+
(xwidget-webkit-browse-url url))
148+
(browse-url url))))
137149

138150

139151
;;; Public interface

0 commit comments

Comments
 (0)