Home > OS >  How to compile a third party extension from github?
How to compile a third party extension from github?

Time:05-11

I have never work in any vscode extension neither witch nodejs/npm

im trying to compile this extension: gutter-preview

I have download nodejs, installed, then i download the extension source, open cmd:

cd 'folder where is the extension src' > npm install package.json

it installed and created a folder node_modules

am i doing it correctly? what's the next steps?

CodePudding user response:

  1. The easiest way will be from the extension directory in your VSCode, you can open that using one of these three ways:
    a. View > Extension
    b. From sidebar, click on extension icon
    c. CTRL Shift x

Then search for "gutter preview" with quotations, you'll get one result called Image Preview, that's the extension, just click on install.

  1. Another way is visit this url
    https://marketplace.visualstudio.com/items?itemName=kisstkondoros.vscode-gutter-preview. Then press on 'Download Extension' on the right hand side, download the file then inside your vscode open the command pallet (CTRL Shift p) and type: extensions install from vsix, click that command, then choose the .VSIX file you just downloaded.

  2. And last if you must do it from the github repo, then inside the directory where you ran npm install and found the node_modules directory, run npm run webpack-prod (a command specified in the package.json file in the root of the project folder, which describes how to build the app). Then you should find a .VSIX file in the ./dist/extension directory in the project, and you apply step 2 on the generated .VSIX file

CodePudding user response:

The process to follow is the same like for any extension developer. When you have the code ready to build the extension package follow the publishing guidelines.

However, instead of really publishing the downloaded extension you would just build the package using:

vsce package (see also the Usage section on this page)

If you need to debug the extension code follow the Your First Extension page (jumping over the sections that explain how to create the initial extension code). See also the follow up pages like Extension Anatomy, which explain more details you might need.

  • Related