vscode-data-preview icon indicating copy to clipboard operation
vscode-data-preview copied to clipboard

no preview for csv file

Open PierreMarchand20 opened this issue 3 years ago • 43 comments

Sorry for the naive question, but I cannot preview a simple csv file: image

Am I missing something ? here is the log

> window.WebComponentsReady

 data viewer initialized!

> data size in bytes: 0

> document.readystatechange complete

 data.view:complete!

> loadDataInfo()

 data url: file://path/to/elliptic_cavity_2D_10_combined_dir_direct_eig.csv
 data table: 

> restoreConfig(
{})

> loadTableList(
 tableNames = []
 requestedDataTable = ''
)

> refresh(dataTable='')

 loading data: elliptic_cavity_2D_10_combined_dir_direct_eig.csv ...

> getData()

 loading file data: elliptic_cavity_2D_10_combined_dir_direct_eig.csv ...

> getData()

 records count: 75

> refresh('')

 updating view data: elliptic_cavity_2D_10_combined_dir_direct_eig.csv ...

> 

PierreMarchand20 avatar Feb 18 '21 13:02 PierreMarchand20

@PierreMarchand20 do you see any errors in Help -> Toggle Developer Tools when you run it?

RandomFractals avatar Feb 25 '21 17:02 RandomFractals

I have this :

image

PierreMarchand20 avatar Feb 25 '21 19:02 PierreMarchand20

Similar to PierreMarchand20

Screen Shot 2021-02-25 at 6 18 17 PM

Weirdly enough, toggling Developer Tools and refreshing a few times will occasionally trigger a load of the data.

mrsoftowl avatar Feb 25 '21 23:02 mrsoftowl

yeah, I need to look into this. That updateStats call just reports the number of records read from a data file and size in vscode status bar and ext. log.

Thank you for sharing your error outputs.

RandomFractals avatar Feb 26 '21 13:02 RandomFractals

yeah, I need to look into this. That updateStats call just reports the number of records read from a data file and size in vscode status bar and ext. log.

Thank you for sharing your error outputs.

Let me know if you need something else. Your plugin, after Jupyter Notebooks, is the key reason to recommend VSCode... Coffee inbound.

mrsoftowl avatar Feb 26 '21 14:02 mrsoftowl

Exact same error as @PierreMarchand20 and @mrsoftowl over here !

oolonek avatar Feb 28 '21 09:02 oolonek

Hi there, as far as I find, the error is caused by the dark theme. Change the theme to light to fix it temporarily.

ivaquero avatar Feb 28 '21 10:02 ivaquero

Changing theme has no effect on my installation

programmiererei avatar Feb 28 '21 11:02 programmiererei

so, after updating to vscode v1.53.2 I can finally reproduce this for a dark data preview theme. I was not able to do it with the initial v1.53 release. Also, interestingly enough an older data preview I had open for zipcodes while testing with earlier version of that vscode release worked, while creating new data preview after vscode update to latest did not.

Oddly enough, changing data preview to light theme works.

data-preview-dense-light

If you want to try it, just change data preview theme setting in Preferences -> Settings -> Extensions -> Data Preview -> Theme

or set it in .vscode/settings.json for your project similar to: https://github.com/RandomFractals/vscode-data-preview/blob/master/.vscode/settings.json

I'll see if I can debug and patch this soon. It's a bit tricky and I suspect there is more to it than that error we get. Thanks for your patience.

RandomFractals avatar Feb 28 '21 15:02 RandomFractals

I am going to try this with new vscode v1.54 release today. I was not able to find the origin of this issue for the dark theme and that css is not much different from the stylesheet I am using for light data preview theme. I do suspect new built-in vscode table widget or something else related to webview loading has something to do with it since after fixing that stats update call I saw some Table trace logs that I did not recognize. Will try it in the latest vscode v. and keep you posted.

RandomFractals avatar Mar 06 '21 15:03 RandomFractals

Both light and dark scheme fail randomly for me, with light theme seeming to work a bit more reliably. (light loaded data 6 out of 10 tries, dark loaded it 4 out of 10 tries).

FWIW, I get a similar but slightly different error as well. It might just be a linux thing though (vscode v1.54.1).

[[object Object]]Cannot read property 'toFixed' of undefined
$onExtensionRuntimeError @ mainThreadExtensionService.ts:59
mainThreadExtensionService.ts:60 TypeError: Cannot read property 'toFixed' of undefined
	at Object.formatBytes (~/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/out/utils/file.utils.js:95)
	at DataPreview.updateStats (~/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/out/data.preview.js:344)
	at ~/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/out/data.preview.js:205
	at p.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57)
	at r._updateViewState (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88)
	at s.$onDidChangeWebviewPanelViewStates (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88)
	at u._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90)
	at u._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90)
	at u._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90)
	at u._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90)
	at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90
	at p.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57)
	at g.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65)
	at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106
	at p.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57)
	at g.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65)
	at t._receiveMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65)
	at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65
	at p.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57)
	at l.acceptChunk (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65)
	at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65
	at Socket.E (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106)
	at Socket.emit (events.js:315)
	at addChunk (_stream_readable.js:295)
	at readableAddChunk (_stream_readable.js:271)
	at Socket.Readable.push (_stream_readable.js:212)
	at Pipe.onStreamRead (internal/stream_base_commons.js:186)
$onExtensionRuntimeError @ mainThreadExtensionService.ts:60
mainThreadExtensionService.ts:59 [[object Object]]Cannot read property '0' of undefined
$onExtensionRuntimeError @ mainThreadExtensionService.ts:59
mainThreadExtensionService.ts:60 TypeError: Cannot read property '0' of undefined
	at parse_xlml_xml (~/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/node_modules/xlsx/xlsx.js:16111)
	at parse_xlml (~/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/node_modules/xlsx/xlsx.js:16530)
	at Object.readSync [as read] (~/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/node_modules/xlsx/xlsx.js:21009)
	at ~/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/out/data.providers/excel.data.provider.js:47
$onExtensionRuntimeError @ mainThreadExtensionService.ts:60

Denzo77 avatar Mar 08 '21 15:03 Denzo77

Same problem for me, VS Code 1.54.1. Does not load, however it accurately shows number of rows and size in the bottom bar

S-Maciejewski avatar Mar 10 '21 11:03 S-Maciejewski

Similar error for me with a .csv Just can't preview for a comma and pipe delimited file It did work for me the first time I installed the extension.
Every other times I've been prompted to" Open a Data file to Preview Source:Data Preview (Extension).

UbuntuScott avatar Mar 11 '21 22:03 UbuntuScott

Same here. Light theme works with no error but dark theme failed with error:

[Embedded Page] Registered perspective-computed-column
workbench.desktop.main.js:1541 [Embedded Page] Registered perspective-row
workbench.desktop.main.js:1541 [Embedded Page] Registered perspective-viewer
workbench.desktop.main.js:1541 [Embedded Page] Registered perspective-hypergrid
workbench.desktop.main.js:1541 [Embedded Page] Registered perspective-d3fc-chart
workbench.desktop.main.js:1541 [Embedded Page] data.view:interactive!
workbench.desktop.main.js:1541 [Embedded Page] data.view:initializeDataView()

 initializing...
workbench.desktop.main.js:1541 [Embedded Page] data.view:window.WebComponentsReady

 data viewer initialized!
workbench.desktop.main.js:1541 [Embedded Page] data.view:data size in bytes: 0
workbench.desktop.main.js:1541 [Embedded Page] data.view:document.readystatechange complete

 data.view:complete!
workbench.desktop.main.js:1541 [Embedded Page] data.view:loadDataInfo()

 data url: file:///[hidden].csv
 data table: 
workbench.desktop.main.js:1541 [Embedded Page] data.view:restoreConfig(
{})
workbench.desktop.main.js:1541 [Embedded Page] data.view:loadTableList(
 tableNames = []
 requestedDataTable = ''
)
workbench.desktop.main.js:1541 [Embedded Page] data.view:refresh(dataTable='')

 loading data: [hidden].csv ...
workbench.desktop.main.js:1541 [Embedded Page] data.view:getData()

 loading file data: [hidden].csv ...
workbench.desktop.main.js:1541 [Embedded Page] data.view:getData()

 records count: 4
workbench.desktop.main.js:1541 [Embedded Page] data.view:refresh('')

 updating view data: [hidden].csv ...
workbench.desktop.main.js:1541 [Embedded Page] Transferable support detected
workbench.desktop.main.js:1541 [Embedded Page] Loading wasm
workbench.desktop.main.js:1541 [Embedded Page] Abort(): Failed to open RecordBatchStreamReader: Tried reading schema message, was null or length 0
workbench.desktop.main.js:1541 [Embedded Page] 
workbench.desktop.main.js:1541 [Embedded Page] Table initialization failed: Error: abort()
workbench.desktop.main.js:1541 [Embedded Page] Uncaught Error: abort()
2workbench.desktop.main.js:1541 [Embedded Page] Uncaught (in promise) #<Object>
workbench.desktop.main.js:1541 [Embedded Page] Uncaught Error: abort()
3workbench.desktop.main.js:1541 [Embedded Page] Uncaught (in promise) #<Object>

jerryc05 avatar Mar 19 '21 19:03 jerryc05

Can confirm that the extension will not preview CSV with theme Dark, but does work with theme: Light, and the first clue that I notice is columns: undefined in the footer.

jm3 avatar Mar 22 '21 16:03 jm3

Hi, amazing extension! But sadly, I'm also getting preview issues with a large file (+26MB) in both light and dark themes. Refreshing the data in VS Code does not help much... I was able to get the data to load once, but I haven't been able to preview it since... at least 50 tries of refreshing and/or reopening the file.

In dev tools, i get similar errors as above. In the lower status bar, shows Columns: undefined

[Embedded Page] data.view:loadTableList(
 tableNames = []
 requestedDataTable = ''
)
webviewElement.ts:90 [Embedded Page] data.view:refresh(dataTable='')

 loading data: data.csv ...
webviewElement.ts:90 [Embedded Page] data.view:getData()

 loading file data: data.csv ...
webviewElement.ts:90 [Embedded Page] data.view:getData()

 records count: 43,374
webviewElement.ts:90 [Embedded Page] data.view:refresh('')

 updating view data: data.csv ...
[Embedded Page] Uncaught (in promise) #<Object>

kartzke avatar Mar 23 '21 15:03 kartzke

Same problem for me too. Screen Shot 2021-03-27 at 14 56 03

VS code Version: 1.54.2 OS: Darwin x64 19.6.0

forybm avatar Mar 27 '21 05:03 forybm

well, it actually works on gitpod.io. So, I suspect there is a conflicting extension that stops it from working, or some faulty vscode update in the past two releases.

data-preview-gitpod-io

works with CSV files too. Try Data: Preview Remote data command and paste this data url: https://us-counties.datasette.io/counties/counties.csv

us-counties-data-preview

RandomFractals avatar Apr 06 '21 22:04 RandomFractals

yep. just confirmed that it works in vscodium too. Please try uninstalling some data related extensions that might be causing that issue. I can't find the culprit.

image

RandomFractals avatar Apr 07 '21 01:04 RandomFractals

PS: this is the problem and it's not coming from my extenion. something else steals data transfer to my webview:

workbench.desktop.main.js:1541 [Embedded Page] Transferable support detected
workbench.desktop.main.js:1541 [Embedded Page] Loading wasm
workbench.desktop.main.js:1541 [Embedded Page] Abort(): Failed to open RecordBatchStreamReader: Tried reading schema message, was null or length 0
workbench.desktop.main.js:1541 [Embedded Page] 
workbench.desktop.main.js:1541 [Embedded Page] Table initialization failed: Error: abort()
workbench.desktop.main.js:1541 [Embedded Page] Uncaught Error: abort()
2workbench.desktop.main.js:1541 [Embedded Page] Uncaught (in promise) #<Object>
workbench.desktop.main.js:1541 [Embedded Page] Uncaught Error: abort()
3workbench.desktop.main.js:1541 [Embedded Page] Uncaught (in promise) #<Object>

RandomFractals avatar Apr 07 '21 01:04 RandomFractals

The dark theme actually works once for me (the first time I installed the extension and the first file it opened). Then it won't load data ever again. I disabled all other extensions but nothing happened. Reinstalling vscode does not work either. It at least proved that it could work once in a life time.

MatrixRanger98 avatar May 09 '21 11:05 MatrixRanger98

@matrix-ranger have you tried it with the light theme?

https://github.com/RandomFractals/vscode-data-preview/issues/250#issuecomment-787466218

Just set it to that for now, till I find the time to look into those data transfers issues.

I suspect they are related to new changes for byte array transfers:

https://code.visualstudio.com/updates/v1_56#_improved-transfer-of-arraybuffers-to-and-from-webviews

I was hoping vscode v1.56 release would fix it. I did not have time to investigate this further.

There is def. something very odd at the core going on there.

RandomFractals avatar May 09 '21 19:05 RandomFractals

The light themes work well. And btw I am using vscode v1.56.

MatrixRanger98 avatar May 10 '21 01:05 MatrixRanger98

some devs experiencing this issue reported that prior version of DataPreview v2.2.0 worked.

Please try that version if you run into this issue on your vscode or OS.

You can download it from here: https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.vscode-data-preview&ssr=false#version-history

Not much changed since that version in 2.3.0. I am still not sure what's causing this.

Could be new WASM loading or other general vscode files reading issues on Darwin OS? https://github.com/RandomFractals/vscode-data-preview/issues/250#issuecomment-808664190

See them here for more info: https://github.com/microsoft/vscode/issues?q=is%3Aissue+WASM+Darwin

Please report your OS and version, if you run into this.

RandomFractals avatar May 20 '21 14:05 RandomFractals

well, I can confirm that the last published Data Preview v2.3.0 works in vscode v1.56.0 on win7:

image

It also works in Code Spaces. See: https://github.com/RandomFractals/vscode-leaflet/issues/9#issuecomment-844463639

and in the latest vscode v1.56.2:

image

RandomFractals avatar May 20 '21 15:05 RandomFractals

It works only in the light theme for me with no errors in the dark theme but failing to load.

Version: 1.56.2 (Universal) Commit: 054a9295330880ed74ceaedda236253b4f39a335 Date: 2021-05-12T17:44:30.902Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Darwin x64 19.6.0

mhkeller avatar May 26 '21 17:05 mhkeller

that's good info. I tested it with @alefragnani last week and we narrowed it down to Darwin OS so far.

Still doesn't explain why switching data preview theme stylesheet would break or fix that data transfer and display.

There are quite a few issues related to extension host reload and wasm in vscode since v1.54.0 release.

I might bite the bullet and update that grid lib and dependencies and bundle this extension to trim it down a bit.

Other than that I am still puzzled by some of those errors.

Thanks for your findings @mhkeller. Much appreciated!

RandomFractals avatar May 26 '21 17:05 RandomFractals

I just learned you can get some more debug output from the >. Here's what I get on dark mode:

> window.WebComponentsReady

 data viewer initialized!

> data size in bytes: 0

> document.readystatechange complete

 data.view:complete!

> loadDataInfo()

 data url: file:///Users/path/to/file.csv
 data table: 

> restoreConfig(
{})

> loadTableList(
 tableNames = []
 requestedDataTable = ''
)

> refresh(dataTable='')

 loading data: file.csv ...

> getData()

 loading file data: file.csv ...

> getData()

 records count: 1,692

> refresh('')

 updating view data: file.csv ...

> 

versus light mode

> window.WebComponentsReady

 data viewer initialized!

> document.readystatechange complete

 data.view:complete!

> loadDataInfo()

 data url: file:///path/to/file.csv
 data table: 

> restoreConfig(
{})

> loadTableList(
 tableNames = []
 requestedDataTable = ''
)

> refresh(dataTable='')

 loading data: file.csv ...

> getData()

 loading file data: file.csv ...

> getData()

 records count: 1,692

> refresh(dataTable='')

 initializing data view: file.csv ...

> viewer.perspective-config-update 

 plugin: hypergrid
 editable: true
 selectable: true
 columns: <columnlist...>
 row-pivots: null
 column-pivots: null
 aggregates: null
 filters: null
 sort: null
 computed-columns: null

> updateStats()

 columns: <columnlist...>
 rows: 1,692

> updateStats()

 columns: <columnlist...>
 rows: 1,692

> 

mhkeller avatar May 26 '21 17:05 mhkeller

yeah, that provides some debug info. for some reason data is read from file in those blank grid cases, but never makes it to the data preview webview.

RandomFractals avatar May 26 '21 18:05 RandomFractals

Hey, this is an awesome extension =) Unfortunately, I'm facing this issue too. Changing to white theme seemed to work.

Maybe the issue should be reopened for visibility? I almost opened one myself because I couldn't find anything related on the open ones.

dbofmmbt avatar May 28 '21 15:05 dbofmmbt