molstar / VSCoding-Sequence

VSCode Extension for interactively visualising protein structure data in the editor
MIT License
101 stars 9 forks source link

Allow opening Amber NetCDF files #34

Open axsk opened 2 months ago

axsk commented 2 months ago

According to https://molstar.org/docs/plugin/file-formats/ .nc or .nctraj are supported as well.

This allows to open them from the context menu.

a-r-j commented 2 months ago

Hi @axsk! Thanks for the PR :)

Have you tried this out? I expect it may require some manipulation of the loading command to dispatch the appropriate command depending on the file type:

https://github.com/molstar/VSCoding-Sequence/blob/ce7a1de38900d721c1258621c4b473053e8e39e7/src/panels/ProteinViewerPanel.ts#L190

axsk commented 2 months ago

I am not sure how that feature is supposed to work. I selected files in the VSCode explorer and ran the Lauch Protein Viewer from File(s) command, but only get an error message:

Command 'Lauch Protein Viewer from File(s)' resulted in an error
Cannot read properties of undefined (reading 'map')
2024-09-23 10:43:29.489 [error] TypeError: Cannot read properties of undefined (reading 'map')
    at Function.renderFromFiles ([...]home/.vscode-server/extensions/arianjamasb.protein-viewer-0.1.0/src/panels/ProteinViewerPanel.ts:36:33)
    at [...]home/.vscode-server/extensions/arianjamasb.protein-viewer-0.1.0/src/extension.ts:20:22
    at h ([...]home/.vscode-server/cli/servers/Stable-38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/server/out/vs/workbench/api/node/extensionHostProcess.js:161:210554)
axsk commented 2 months ago

Oh, maybe I misunderstood. Are you suggesting that we need to translate the file extension to a valid extension type as below?

https://github.com/molstar/VSCoding-Sequence/blob/ce7a1de38900d721c1258621c4b473053e8e39e7/src/panels/ProteinViewerPanel.ts#L186-L187

axsk commented 2 months ago

Unfortunately I haven't managed to get the extension dev framework working so I cannot test my suggestions :O