AdamRaichu / vscode-zip-viewer

An extension which allows for the manipulation of zip files in VS Code.
https://marketplace.visualstudio.com/items?itemName=AdamRaichu.zip-viewer
MIT License
13 stars 1 forks source link

[editor]: Support custom handlers for preview #76

Closed Jeff-Walker closed 1 year ago

Jeff-Walker commented 1 year ago

Please add support for .class files to the editor preview.

I use Intellij IDEA to open class files, but not everyone would, so add support for custom apps.

Generated by adamraichu.zip-viewer

AdamRaichu commented 1 year ago

What do you mean by "custom handlers" for preview? What do you have in mind? Would you want me to implement some kind of API?

Jeff-Walker commented 1 year ago

Just an external command? Have a list of file extension to a command. So I'd put in ... /idea.exe or whatever to extract and open the app. Not sure how vs code handles filetype editors, but in most cases there's an api. Is so maybe use that.

On Mon, Sep 18, 2023, 1:18 PM AdamRaichu @.***> wrote:

What do you mean by "custom handlers" for preview? What do you have in mind? Would you want me to implement some kind of API?

— Reply to this email directly, view it on GitHub https://github.com/AdamRaichu/vscode-zip-viewer/issues/76#issuecomment-1724140386, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQSBWVT4QVDNBHG2YTNITX3CF7DANCNFSM6AAAAAA45DKDXQ . You are receiving this because you authored the thread.Message ID: @.***>

AdamRaichu commented 1 year ago

A couple things come to mind after reading that.

  1. It seems like it could be a security vulnerability to have the extension run a command on opening a subfile of a zip file. (For example, a custom command could be set in the workspace settings which installs unwanted software.)
  2. I'm trying to make all features work in the browser version of vscode (vscode.dev / github.dev) as well as on a computer as not many good extensions are compatible with the browser. Running a command in the manner you suggest is not possible there.

Here are a couple solutions/alternatives which would do something similar to what you want:

  1. Use the Selective Extraction feature to extract the class files you are trying to read, and open them manually in IDEA.
  2. I would be willing to implement some way of opening raw .class files in vscode if I had a JavaScript library which could decompile them. If you know of or could find such a library I could implement that.

Not sure how vs code handles filetype editors, but in most cases there's an api.

The method vscode uses for custom editors is based on file path (name and location in folders). However, that requires having the actual file outside of the zip file, and so is outside the scope of this particular extension. However, see point 2 under solutions above; I would happy to make another extension if I had a library for it.

All of that said, I'm closing as wontfix because it is out of scope for this extension. (In the same way, I didn't have this extension display PDF files because you can simply selectively extract them and view with another extension.)

AdamRaichu commented 1 year ago

While I'm sorry to give a negative response, I do appreciate the feedback! Please continue to let me know if there are features you would like, or if you find any problems.