sransara / speedscope-in-vscode

VSCode extension for viewing Speedscope flamegraphs
https://marketplace.visualstudio.com/items?itemName=sransara.speedscope-in-vscode
MIT License
13 stars 0 forks source link

Automatic file detection #6

Open AndrewNolte opened 6 days ago

AndrewNolte commented 6 days ago

I think it'd be nice for speedscope json files to automatically be opened, so the terminal link can just be clicked. There's a couple options here-

sransara commented 1 day ago

I tried adding a default file type from the extension itself but there seems to be some limitations: https://github.com/microsoft/vscode/issues/141562

I just found out you can specify custom editors in Workspace settings. So you can try something like this instead:

{
  "workbench.editorAssociations": {
      "*.speedscope.json": "speedscope-in-vscode.speedscope"
  }
}

a hook for opening files, then checking if the json files starts with {"$schema":"https://www.speedscope.app/file-format-schema.json"

The extension will have to be activated first to do a magic number trick like this (if even possible). But my goal is to activate the extension only when absolutely necessary.