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

Document link should work with limited file extensions or file size #391

Closed
renkun-ken opened this issue Mar 17, 2021 · 5 comments · Fixed by #393
Closed

Document link should work with limited file extensions or file size #391

renkun-ken opened this issue Mar 17, 2021 · 5 comments · Fixed by #393

Comments

@renkun-ken
Copy link
Member

Currently, the document link provider will capture all existing file paths in the document to provide links. Some file paths are binary data files (e.g. *.fst) rather than source files (*.R) or text-data files (e.g. *.csv). Accidentally following the link of data binary data file is not useful (the editor cannot handle the file type) or sometimes makes the editor freeze (via remote-ssh).

I think we should use an option to provide links to a limited collection of file extensions. By default, it might include R, csv, log, txt, etc.

@randy3k
Copy link
Member

randy3k commented Mar 17, 2021

It seems reasonable. The only thing that I may add is to allow users to customize the set of file extensions.

@renkun-ken
Copy link
Member Author

renkun-ken commented Mar 18, 2021

Or we could limit the file size of a link because there are too many text file types that should be provided a link (e.g. python, matlab, julia, c++ code files). And we could use Document Link Resolve Request to check the file size so that it could determine if a link should be provided.

@renkun-ken renkun-ken changed the title Document link should work with limited file extensions Document link should work with limited file extensions or file size Mar 18, 2021
@randy3k
Copy link
Member

randy3k commented Mar 18, 2021

Instead of a whitelist, we could have a blacklist of extensions, (pdf, jpeg, exe, dll, etc). Though limiting file size seems reasonable.

@renkun-ken
Copy link
Member Author

renkun-ken commented Mar 18, 2021

Instead of a whitelist, we could have a blacklist of extensions, (pdf, jpeg, exe, dll, etc).

It makes sense. However, in vscode, user could associate these file extensions with different editor extensions, e.g. vscode-pdf could open pdf in a WebView in vscode, hex editor could view and edit any binary file, and vscode could natively view image files such as png, etc, etc. and svg extension could preview svg as well.

@renkun-ken
Copy link
Member Author

I guess we could first avoid supplying a large file to the editor and leave handling different file formats to the editor at the moment.

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

Successfully merging a pull request may close this issue.

2 participants