AI Solutions


Open Source LLM as Analyser Plugin Extension for Visual Code Studio

Step 1: Add the Code Analysis Logic

First, make sure you have set up the language model API as discussed earlier. You'll need the code to send requests to the AI model and receive the improved code. Modify your extension's activate function to include the code analysis logic. Replace the existing activate function with the following code:

const vscode = require('vscode');

const axios = require('axios');

function activate(context) {

console.log('Congratulations, your extension "appdrew" is now active!');

let disposable = vscode.commands.registerCommand('appdrew.improveCode', async function () {

const editor = vscode.window.activeTextEditor;

if (!editor) {



const code = editor.document.getText();

try {

// Replace '' with the actual AI model API endpoint

const modelEndpoint = '';

const payload = {



const response = await, payload);

const improvedCode =;

if (improvedCode) {

editor.edit((editBuilder) => {

const documentRange = new vscode.Range(




editBuilder.replace(documentRange, improvedCode);


vscode.window.showInformationMessage('Code improved successfully!');

} else {

vscode.window.showErrorMessage('Failed to improve the code. Please check the AI model and API.');


} catch (error) {

console.error('Error improving code:', error.message);

vscode.window.showErrorMessage('Failed to improve the code. Please check the AI model and API.');





function deactivate() {}

module.exports = {





To test this extension, save the changes, reload the extension in Visual Studio Code by pressing F5, and then open a code file. Run the command "Appdrew: Improve Code" as explained in the previous response.

Please keep in mind that you'll need to have the axios library installed in your extension's node_modules folder. You can install it by running npm install axios in your extension's root directory.

Make sure you have set up your AI model and its API endpoint correctly to receive the code, analyze it, and return the improved code. Additionally, handle any potential errors or edge cases specific to your AI model's behavior or API response. Always take precautions when applying automated changes to code, especially in a production environment. Test the extension on a smaller scale before applying it to larger projects.

Building a Visual Studio Code extension in JavaScript that uses an open-source language model to analyze and improve the written code in a project.

You can use the model orca 3b with flask api for this project.


  1. An Open-Source Language Model: You'll need to find a suitable language model that can analyze and suggest improvements to the code. Since my knowledge is limited up to September 2021, I won't have information about the latest models available. However, some popular language models for code analysis include CodeBERT, GPT-3 (though it's not open-source), and GPT-Neo. Choose the one that best suits your needs.
  2. Visual Studio Code Extension: We'll create a simple extension that interacts with the language model and provides code suggestions within the editor.

02. Usage

npm install -g yo generator-code

yo code

  1. You'll be asked a few questions during the scaffolding process. Make sure to select "JavaScript" as the programming language.

Step 2: Set up Language Model

  1. Choose the open-source language model you want to use for code analysis.
  2. Set up the language model as per its documentation and APIs. This may involve deploying the model on a server or using a pre-built API.

Step 3: Add Code Analysis Logic to the Extension

  1. In your extension project, navigate to the "src" folder and open the extension.ts file.
  2. Add code to interact with your chosen language model and get code suggestions. This can be done using HTTP requests to the model's API or by directly calling a local server.
  3. Implement a function that takes the user's code, sends it to the language model, and receives the suggested improvements.
  4. Display the suggestions as Quick Fixes or Code Actions in the editor. You can refer to the VS Code API documentation for more details on how to provide code actions.

Step 4: Test the Extension

  1. In the extension's root directory, run the following command to compile and package your extension:

vsce package

Open Source LLM as Analyser Plugin Extension for Visual Code Studio
  • Category : AI Solutions
  • Time Read:10 Min
  • Source: Youtube
  • Author: Partener Link
  • Date: July 26, 2023, 8:45 p.m.
Providing assistance

The web assistant should be able to provide quick and effective solutions to the user's queries, and help them navigate the website with ease.


The Web assistant is more then able to personalize the user's experience by understanding their preferences and behavior on the website.


The Web assistant can help users troubleshoot technical issues, such as broken links, page errors, and other technical glitches.


Please log in to gain access on Open Source LLM as Analyser Plugin Extension for Visual Code Studio file .