Open toniz4 opened 1 year ago
I suspect is related with the shell process spawned by dart to run java is using a "default" shell which is not the same emacs or your terminal is using
I suspect is related with the shell process spawned by dart to run java is using a "default" shell which is not the same emacs or your terminal is using
I think that is the poblem too. It's not inheriting the "main buffer" (the one i'm executing lsp-dart-run) process-environment
and exec-path
, so it can't find the java executable or JAVA_HOME. But it's able to run flutter for some reason.
Do you know where this process is being started?
I don't know, but I use doom and they use https://github.com/purcell/exec-path-from-shell IIRC which fix most errors like that
I don't know, but I use doom and they use https://github.com/purcell/exec-path-from-shell IIRC which fix most errors like that
I use doom here too, but I found a possible solution. If I add
(dap--put-if-absent conf :environment-variables '(("GRADLE_OPTS" . "-Dorg.gradle.project.android.aapt2FromMavenOverride=/nix/store/3svzmqsal084m2wffsj7drqk2kzi514c-android-sdk-env/share/android-sdk/build-tools/33.0.2/aapt2")))
To lsp-dart-dap--base-debugger-args
, I'm able to run flutter just fine. There's a less intrusive way that I can do that? If there's not, if it's applicable, I could make a PR adding a variable to add custom debugger args.
@toniz4 you can create your own debugging template to customize that via:
(dap-register-debug-template "Flutter :: Debug with custom env vars"
(list :type "flutter"
:environment-variables '(("GRADLE_OPTS" . "-Dorg.gradle.project.android.aapt2FromMavenOverride=/nix/store/3svzmqsal084m2wffsj7drqk2kzi514c-android-sdk-env/share/android-sdk/build-tools/33.0.2/aapt2"))))
Describe the bug
When trying to run lsp-dart-run, using envrc to populate the env variables based on a shell.nix. The debbuger or runner exits with the following message:
The weird thing is, the flutter and dart executables and sdks and the jdk are being set up in the same way, at the same time. So, if the flutter command is avaliable to emacs, I don't know why it only fails with the java command.
To Reproduce
Have
JAVA_HOME
and thejava
executable path set by envrc. Rundap-debug
orlsp-dart-run
in a flutter project.Expected behavior That
lsp-dart-run
executes my appVersion
What I think is hapening is that somewere, the
process-environment
andexec-path
are being reseted to the default value, I tried to identify where, but my skills to debug elisp are not the best. But I found those possible related issues:https://github.com/greghendershott/racket-mode/issues/539 https://github.com/rust-lang/rust-mode/pull/447 https://github.com/magit/magit/issues/4160 https://github.com/purcell/envrc/issues/31