vscode-open icon indicating copy to clipboard operation
vscode-open copied to clipboard

Doesn't open .md files in Caret (an Electron app)

Open borekb opened this issue 8 years ago • 8 comments

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 avatar Feb 15 '17 11:02 borekb

@borekb I use caret on mac and it works fine for me. What OS are you using?

sandcastle avatar Feb 18 '17 17:02 sandcastle

I'm on Windows 10. Will try to replicate with Atom which is another Electron app.

borekb avatar Feb 22 '17 11:02 borekb

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?

borekb avatar Feb 22 '17 11:02 borekb

@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.

borekb avatar Feb 23 '17 09:02 borekb

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.

borekb avatar Feb 23 '17 13:02 borekb

I am experiencing the exact same problem.

Works outside, but does not inside VSCode.

aur3l14no avatar Sep 19 '19 13:09 aur3l14no

@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

sandcastle avatar Sep 20 '19 07:09 sandcastle

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.

DarwinJS avatar Dec 21 '19 15:12 DarwinJS