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

Opening files fails on *nix #124

Closed
aviaconstructor opened this issue Jul 30, 2019 · 8 comments
Closed

Opening files fails on *nix #124

aviaconstructor opened this issue Jul 30, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@aviaconstructor
Copy link

The extension works great on Windows, but does not operate on Linux for me - the path is arriving to DataPreview constructor as file:///home/me/mysubdir/myfile.csv, and there it gets truncated into home/me/mysubdir/myfile.csv, relative path, file not found. The fix would be to remove one slash less for non-Windows platforms, 'file://', so that the result path becomes absolute (will start with '/').

Thanks!

@RandomFractals
Copy link
Owner

@aviaconstructor thanks for reporting this. I'll look into fixing it in the next release.

@RandomFractals RandomFractals added the bug Something isn't working label Jul 30, 2019
@RandomFractals
Copy link
Owner

RandomFractals commented Jul 30, 2019

@aviaconstructor could your provide a screenshot of the error you get on your *nix machine? || better yet clone and run this ext. local & give me some dev log dumps from Data Preview to help me resolve this issue for Mac & Linux users. See steps to launch it local here: https://github.com/RandomFractals/vscode-data-preview#dev-build

I could try it on win10 WSL, but who has time :) Still, would love to patch this issue today

@RandomFractals
Copy link
Owner

RandomFractals commented Jul 30, 2019

@aviaconstructor I had other devs confirm what I have there in v1.27.0 works on Mac.

So, my followup question: what *nix system are you using? :)

vscode-data-preview-on-mac

@RandomFractals RandomFractals added invalid This doesn't seem right and removed bug Something isn't working labels Jul 30, 2019
@RandomFractals
Copy link
Owner

RandomFractals commented Jul 30, 2019

closing this for now as I can't reproduce it without more info :(

@aviaconstructor
Copy link
Author

Hi. This is Ubuntu 18.04, tried two separate comps:
Screenshot from 2019-07-30 18-42-52
Tried different file locations, etc. Strange it is not reproducible - I can debug to the line with the issue, and apply a workaround so it starts to work for me. Just set a breakpoint at line 155 of data.preview.ts,

    this._dataUrl = uri.toString(true).replace('file:///', ''); // skip uri encoding, strip out file scheme

On Windows I bet you get something like file:///C:/subdir/myfile.csv so C:/subdir/myfile.csv will open successfully, but on Linux, assuming the current directory is not '/' from file:///subdir/myfile.csv I get subdir/myfile.csv (notice, the leading slash is absent, relative path. I can fix it for Linux by removing one slash:

    this._dataUrl = uri.toString(true).replace('file://', ''); // skip uri encoding, strip out file scheme

I did not debug on Windows, so be careful. Please let me know if I can do any further experiments for you
Cheers

@RandomFractals
Copy link
Owner

@aviaconstructor thanks for the follow up on this! I'll reopen it and try to patch it for Ubuntu.

Appreciate the screen pic and faulty code details to help me troubleshoot this.

@RandomFractals RandomFractals added bug Something isn't working and removed invalid This doesn't seem right labels Jul 31, 2019
@RandomFractals
Copy link
Owner

@aviaconstructor this should be fixed now. I just pushed new v1.27.1 patch release with that update. Basically, I'll rely on vscode Uri.fsPath for loading local data files. see changes tagged above.

Let me know if it works for you now & many thanks for bringing this to my attention and code troubleshooting assist :)

Also, please review open features/enhancements I have planned for this ext. and let me know what you'd like to see in the next major release update. Just thumb up the once you like :)

https://github.com/RandomFractals/vscode-data-preview/issues

@aviaconstructor
Copy link
Author

Thank you very much, the new version works great! I looked at your plans, and sure, data edit would be my favorite - in fact I was searching for an extension to enable non-programmers manipulate data files conveniently from the source code tree. I also checked the internals of vscode - they currently do not support modification of dom. But there could be tricks to play - found some examples with react.js inside vscode extension, but I gave up. If I am not mistaken, here is one of such extensions: https://github.com/rebornix/vscode-webview-react

Thank you again for a quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants