ulauncher-vscode-projects
ulauncher-vscode-projects copied to clipboard
Difference launching VS Code from ulauncher as opposed to manually
For some reason, when I launch a project using this, it seems it cannot find dotnet
and I am getting errors like:
It was not possible to find any installed .NET Core SDKs
Cannot start .NET Core language services because `dotnet` was not found. Consider:
* setting the `FSharp.dotnetRoot` settings key to a directory with a `dotnet` binary,
* including `dotnet` in your PATH,
* installing .NET Core into one of the default locations, or
* using the `net` `FSharp.fsacRuntime` to use mono instead
When I manually open VS Code and select the project through the extension side bar, all is fine.
I dont know enough Python, but could it be that this is losing some PATH vars along the way: https://github.com/brpaz/ulauncher-vscode-projects/blob/master/main.py#L88
To be clear, dotnet
is on my PATH in my normal shell :)
What can I provide to help debug this?
I also experience this issue, I've found out that my $PYTHONPATH has /usr/lib/python3/dist-packages
added when opening via the ulauncher in the terminal. It makes the extension unusable as it conflicts with my virtual environment paths.
@CumpsD Maybe adding shell=True argument on that subprocess call.
You could try change the code directly (~/.local/share/ulauncher/extensions/com.github.brpaz.ulauncher-vscode-projects/main.py and restart Ulauncher to see if it helps.
The same thing happens with Node "Can not find npm on PATH" when I open vscode using this extension, but everything works if I open vscode normally
@joekaiser I cannot reproduce this in my machine. I thought it could be related to the command not being run in a shell environment and so the environment variables wouldn't be available, I tried adding "shell=True" to the command and now it opens VSCode but not the project directory, so it´s not the solution.
Can you try the following:
- Open a terminal and run
python
- It will open Python console. Then run the following commands. Press enter after each one and replace it with your project path.
import subprocess
subprocess.run(['code', '<path/to/your/project'])
- Check if the project is opened and if you have any errors.
Also, how did you install NodeJS? Did you use NVM or something?
Yes, I used nvm.
I'll try that later today and edit this comment with the results.
@brpaz
Opening the project this way works. No errors are reported and npm
is found in PATH
ok, that´s exactly the same command executed by this extension to launch code.
Something related to the execution envrionment of Ulauncher extensions maybe? I really dont have any idea for now.
I use subprocess.Popen()
with shell=True
but this also doesn't seem to solve the PATH
problem however it allows VS Code to open the project correctly. at least that's what i experienced during testing.
This other extension has the same issue https://github.com/Kazumasan/ulauncher-sessions/issues/2
The author and I determined it is how the Application Launcher runs ulauncher. If I kill the process and start it via the terminal then everything works great.
Just thought you might want to know. Go look at the linked issue on how to fix this. It isn't a bug with this extension.
man you're fast :)
dirty/quickfix might be to prevent your Application launcher to launch Ulauncer and insted do so through your shell profile as Ulauncher should then recive the full environment.
I was able to patch this issue by overriding the code
path to a custom script which unsets the problematic envvars.
Something like:
#! /usr/bin/zsh
unset PYTHONPATH && /usr/bin/code $@
Then change the code
path to that script like: