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

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

Open
borekb opened this issue Feb 15, 2017 · 8 comments
Open

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

borekb opened this issue Feb 15, 2017 · 8 comments

Comments

@borekb
Copy link

borekb commented Feb 15, 2017

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

@sandcastle
Copy link
Owner

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

@borekb
Copy link
Author

borekb commented Feb 22, 2017

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

@borekb
Copy link
Author

borekb commented Feb 22, 2017

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
Copy link
Author

borekb commented Feb 23, 2017

@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
Copy link
Author

borekb commented Feb 23, 2017

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.

@aur3l14no
Copy link

aur3l14no commented Sep 19, 2019

I am experiencing the exact same problem.

Works outside, but does not inside VSCode.

@sandcastle
Copy link
Owner

sandcastle commented Sep 20, 2019

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

#7 (comment)

@DarwinJS
Copy link

DarwinJS commented Dec 21, 2019

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.

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