Home > Net >  Adding the run-code option to a new language in VSCode
Adding the run-code option to a new language in VSCode

Time:12-16

I'm currently writing my own language and I'm at a point where I would like to publish it to the VSCode-Marketplace so people can test it.

I have written a language extension and a syntax highlighter with the Yeoman-Generator and now want to merge it with my executable file that launches the interpreter, so that a file can get interpreted after clicking the run-code button.

Code Image

I now have checked multiple articles, like:

  • How to add a run button in visual studio code? - enter image description here

    (Code language not supported or defined.)

    But even after a lot of browsing Google for adding new language support to the code-runner, I found absolutely nothing helpful.

    (See enter image description here

  • Click on the "edit in settings.json" button.
  • Now a .json-file should've opened. There are two possible scenarios: Either, there is a json-object called code-runner.executorMapBy... or not.
  • If there is none, type code-runner.executorMapByFileExtension and let autocomplete do the job.
  • If the json-object exists, add the file-extension and a bash command that executes your compiler/interpreter. It gets automatically executed in the directory the program-file lies in.
  • Now still dont know, how to include the settings in my extension, but that was already a big step. Further help is still appreciated!

    CodePudding user response:

    There is an open source extension called code runner, you can check source code there.

  • Related