RandomFractals / vscode-data-preview

Data Preview 🈸 extension for importing 📤 viewing 🔎 slicing 🔪 dicing 🎲 charting 📊 & exporting 📥 large JSON array/config, YAML, Apache Arrow, Avro, Parquet & Excel data files
https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.vscode-data-preview
Apache License 2.0
550 stars 59 forks source link

Support loading unsaved files #256

Closed vaughnkoch closed 3 years ago

vaughnkoch commented 3 years ago

Great extension! Feature request: work with unsaved files.

If I copy json and paste it into a new Untitled doc in VSCode, and don't save it, then open Data: Preview Data On Save, I get the following debug info from DP:

> window.WebComponentsReady

 data viewer initialized!

> document.readystatechange complete

 data.view:complete!

> loadDataInfo()

 data url: untitled:Untitled-3
 data table: 

> restoreConfig(
{})

> 

It would be awesome if it could recognize that the current tab isn't a saved file and just use the data in the window. Even better, if you highlight a subset of data, it could use that.

RandomFractals commented 3 years ago

@vaughnkoch data preview is designed to work only with local data files saved on disk, and doesn't extract data from your active editor or untitled docs.

It's an interesting request and I can see how previewing chunks of selected json can be useful. Implementing it might require some major refactoring and implementing new editor selection data provider that also detects what kind of data document you have open, not to mention validating that your selection is a valid json, csv, etc.

A lot of things in data preview are tied to data file name and type for data loading, saving, caching data search/filters config, etc. for data preview restore on vscode reopen. So, this might be a larger effort than I see myself investing time into, and I am going to close this as out of scope for now.

As a workaround you can save your Untitled doc or extract selected data chunks into a separate file and use this extension as is.

kczx3 commented 3 years ago

Most of the time, viewing temp data is exactly what I'd be using this extension for. Its unfortunate you don't plan to support it.

RandomFractals commented 3 years ago

@kczx3 sorry, I try to produce and maintain quite a few data viz tools for vscode, but I am just one guy and my bandwidth is limited. I might add it in a paid Pro version when I find the time to do that.

Thanks for your feedback and support!