Open coezbek opened 2 years ago
Thanks for this @coezbek! I see that you added it to the wiki page already, which is what I would have recommended rather than adding to KNOWN_EDITORS
, especially since your case uses an environment variable to assemble the URL. However, I would also recommend that you change your snippet to only be executed when that environment variable is set. i.e.
if defined?(BetterErrors) && (distro_name = ENV['WSL_DISTRO_NAME'])
BetterErrors.editor = "vscode://vscode-remote/wsl+#{distro_name}%{file_unencoded}:%{line}"
end
One downside of this solution is that is isn't compatible with multiple users using different editors on the same codebase. That's why I asked..
(I updated the wiki with the improved snippet. Thank you!)
I am using Visual Studio Code under WSL remote. To build the URL for the editor link scheme I need to access an environment variable for the current distro being used. This works as an initializer, but I was hoping to contribute a patch to the
KNOWN_EDITORS
.Discussion on SO for building the URL path for VS code remote: https://stackoverflow.com/questions/66582696/url-for-opening-vscode-in-file-in-wsl-workspace?noredirect=1#comment124115062_66582696