I need to execute a JS code on a json
file when I right click on it using VSCode and show the result on a modal or on command prompt based on other code.
For example:
Code to execute (example.js) when right-clicking a json file:
function run(fileLocation){
var file = require('./'+fileLocation);
return file.length;
}
The example.json (file to be right-clicked):
[{id: a},{id: b},{id: c},{id: d},{id: e}]
Like the image below, it would appear on the menu like Execute example.js
or something like this.
Is there a way to do it?