Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates don't work with Visual Studio Code #11

Open
matthewpflueger opened this issue Aug 24, 2018 · 4 comments
Open

templates don't work with Visual Studio Code #11

matthewpflueger opened this issue Aug 24, 2018 · 4 comments

Comments

@matthewpflueger
Copy link

I am using Visual Studio Code as my editor which is on my path. My config looks like:

* editor = code
* pager = less
  pages_directory = /Users/matthewpflueger/.um/pages
  default_topic = shell
  pages_ext = .md

When doing

um edit grep

just brings up a blank editor. HOWEVER, setting the editor to vi brings up what you'd expect (a the template file).

@sinclairtarget
Copy link
Owner

um is pretty dumb and it launches the editor by invoking the editor and passing the file path as the first argument.

Does that work with the code executable? It could be that Visual Studio Code expects you to pass the file argument differently.

@matthewpflueger
Copy link
Author

matthewpflueger commented Aug 25, 2018 via email

@iajrz
Copy link
Contributor

iajrz commented Oct 19, 2018

Is this still a concern / issue?

With regards to git - it seems there's a difference in the way the editor is invoked, yet not too material:

While um writes a shell invocation directly through the system command (system(%{#{editor} "#{page_path}"})), git creates a child process and runs it - yet the result is very similar, as the the file is passed in as the second argument of the process (the first being the editor's name itself).

It would be nice to know what file VisualStudio Code has opened when it renders a blank.

@ernstki
Copy link

ernstki commented Aug 14, 2020

For the record, specifying editor = code seems to work fine on macOS Mojave (10.14.something; Catalina and Big Sur could present their own challenges). That is, provided you've followed the instructions for installing the code command line executable.

Workaround for VS Code .deb package on Linux

On Ubuntu 18.something (elementaryOS 5.1.x Hera), I was able to find a workaround for problem noted here, by pointing directly at VS Code's main executable:

editor = /usr/share/code/code --no-sandbox

It should be noted that there is also /usr/bin/code, a symlink to /usr/share/code/bin/code, but the one I'm talking about is 108 MB on my system (probably because it includes the Electron runtime).

Now, that's assuming that you've used the VS Code .deb. RPMs, tarballs, snaps, and flatpaks, and all the other whatnot may put the code executable somewhere else, like under /opt, for example.

However, I don't think this is um's problem (any more than if um had trouble opening a new page in an editor inside a flatpak), and this issue could be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants