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

CTRL-CLicking A file:/// URL should open with correct file handler #143

Open
tbpassin opened this issue Jun 23, 2024 · 5 comments
Open

CTRL-CLicking A file:/// URL should open with correct file handler #143

tbpassin opened this issue Jun 23, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@tbpassin
Copy link

I have a file:/// url to a .pdf file in the body of an outline. The .pdf file is on my computer. When I CTRL-click on it, LeoJS tries to open it in VSC, but VSC does not know how to open it.

LeoPy sends it to the browser. I don't know if it specifically uses the browser or the system-specified program for .pdf files.

IMO, LeoJS should open obvious text files as text, and binary or uncertain files with an appropriate handler. LeoJS does send http: urls to the browser as it should.

ISTR that LeoPy can properly dispatch file: urls that have relative paths. I haven't checked that with LeoJS, but I assume that the JS handling code is equivalent to leoPy's. if not it should be.

@tbpassin
Copy link
Author

UPDATE - I just found and installed the VSC extension "vscode-pdf". This does allow a CTRL-Click on a .pdf file:URL to display the file in VSC.

This solves the issue for .pdf files. The underlying issue remains, though - if VSC doesn't know how to open a file type, it should try to delegate to the system's handler when that exists.

@boltex boltex self-assigned this Jun 23, 2024
@boltex boltex added the enhancement New feature or request label Jun 23, 2024
@boltex
Copy link
Owner

boltex commented Jun 23, 2024

@tbpassin Thanks for this noticing this! I'll see what the 'url detection' code I had in place can do for regular urls other than Leo's UNL (such as file:///some_folder/some_file.txt )

@boltex
Copy link
Owner

boltex commented Jun 25, 2024

@tbpassin Thanks again for this great feature suggestion!

I've given it some thought: I'll first check if there's a feature (or at least create a vscode issue if not) in vscode to signify to vscode that a binary file link should be opened with the default OS system handler for such binary file, (on a per-extension basis, with a customizable list in the options settings), instead of trying to be opened by vscode itself.

Therefore I'm considering closing this 'LeoJS' issue to instead open a 'VSCode' issue, inquiring about implementing this very same concept...

To be clear, I'm not thinking about closing this issue because it's a bad idea, to the contrary, it's such an obvious 'nice-to-have' concept that I think it should be a VSCode feature in itself.

I'll leave this issue opened for a while in the meantime, and will take a decision about closing or implementing this later.

@boltex boltex added the Meta About the context or usage of Leo label Jun 25, 2024
@tbpassin
Copy link
Author

If VSC will let you call the OS, for example equivalent to Python's os.system()
or POpen.run(), you can roll your own if VSC hasn't got one built in.

This link might be what's needed: https://code.visualstudio.com/docs/terminal/shell-integration

@boltex boltex removed the Meta About the context or usage of Leo label Jun 25, 2024
@boltex boltex added this to the 1.0.1 milestone Jun 25, 2024
@boltex
Copy link
Owner

boltex commented Jun 25, 2024

@tbpassin Thanks, but these features (Have the underlying OS launch external files) were already covered with run-command, execute-general-script and execute-external-file which were implemented in the latest release. They are also demoed in the sample scripts at https://github.com/boltex/scripting-samples-leojs .

Thanks again for bringing my attention to this lacking feature_: opening file links with default app instead of opening it in the vscode editor_, I have decided to implement it in LeoJS. (for 1.0.1)

Note: After doing a little research, I've found that it is a feature that other people have asked in general for VSCode -> https://stackoverflow.com/questions/63224768/visual-studio-code-how-to-make-local-file-link-open-default-program?rq=3

@boltex boltex removed this from the 1.0.1 milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants