vscode-open
vscode-open copied to clipboard
Doesn't open .md files in Caret (an Electron app)
Your extension works great on files that have the default association to Notepad++, e.g., .txt
files. However, it doesn't work for .md
files which I have associated with Caret, an Electron app.
You seem to use opn
so I tried this:
import * as opn from 'opn';
opn('README.md');
and it works fine. ~~Maybe an outdated dependency?~~ no the opn
package is up to date
@borekb I use caret on mac and it works fine for me. What OS are you using?
I'm on Windows 10. Will try to replicate with Atom which is another Electron app.
Same issue with *.md associated with Atom. Really strange because opn(file.md)
works for me. Maybe there's some funky with the path / URL that is passed to opn
?
@sandcastle If the file is C:\example\README.md
, what is the result of decodeURIComponent(uri)
on line 52? I'll try to emulate the problem with plain opn()
in a test project.
This works perfectly:
let opn = require('opn');
opn('file:///c:/example/test.md');
Not sure why it wouldn't work in the context of VS Code.
I am experiencing the exact same problem.
Works outside, but does not inside VSCode.
@Aur3l14no / @borekb - sorry about the lack of progress on this one, I don't really have a lot of spare time atm. Does either of you have the capacity to debug what is going on and send a PR?
I have also discussed on the following issue possibly changing the underlying package from opn
to open
- this may resolve the issue.
https://github.com/sandcastle/vscode-open/issues/7#issuecomment-480539191
I have run procmon to trace this irritating problem as it is also happening on other extensions when trying to open .MD files.
I seem to see TWO problems - both experienced on this extension and another and "Open in Application" (https://github.com/fabiospampinato/vscode-open-in-application.git)
Via procmon I can see that my external app "Typora" starts, but exits without showin a UI.
They work fine with non ".md" extensions.
The second problem is that tracing shows that the extension (or the code it is calling) no longer attempt to run the cmd.exe start command they do when working.
Curiously "Open in External App" (https://github.com/tjx666/open-in-external-app) does not have this problem - Typora opens fine.
Open in External App allows configuring the full path to the open app - but I have not had to do this - it works with defaults.
It does seem that "Open in External App" does NOT launch the cmd.exe "start" command to identify the default application for a file type.
It might also be WIndows only - which I was hoping to avoid since I use VS Code and Typora on WIndows, Linux and Mac.