In our previous article, we explored various code editors with built-in AI options. On the other hand, those choices incessantly rely on a cloud connection and would in all likelihood require subscriptions to gain access to all features. This can be inconvenient if you’re working offline or if you find that the subscription costs outweigh the benefits.
If you’re looking for free, offline variety, LM Studio is a great option. This desktop application allows you to instantly run complex Massive Language Models (LLM) on your computer. You will also be able to choose from numerous models available through the Ollama platform.
In this article we will look at how to use LM Studio with Visual Studio Code (VS Code) to get AI help in the code editor. We’ll cover the environment, connecting it to VS Code and using AI assistance choices.
What you will need
To begin with, let’s keep in mind that we have a couple of problems in one position:
Surroundings Up LM Studio
First, open LM Studio and capture the LLM you want to use.
For coding assistance, it is best to choose a specifically professional type on coding. In this example we will use the “Qwen2.5 Coder” sort with 14 billion parameters.
On the other hand, it is also crucial to make a choice that simply works on your computer. If the 14B parameter sorting is simply too heavy, imagine trying the 3B parameter style.
If you have downloaded LLM, load it into LM Studio and start the server. You will find server controls throughout the file “Developers” sidebar panel as confirmed in the screenshot below. The server will have to get to work http://localhost:1234
and you will also see the available endpoints listed.
Connecting LM Studio to VS Code
To leverage the power of LM Studio’s AI within VS Code, we will organize the open source extension, Proceed.dev. This extension focuses on AI code assistance, making it perfect for our needs.
Once you’ve organized, you’ll see a new tab appear in the sidebar of VS Code. This is the “Continue” form.
Throughout the tab, we can find the Chat field where you will be able to interact with AI assistance.
Even though the Chat field seems functional, it won’t display or respond to your questions. We would like to choose the LLM sort order to use for the chat. To enable this, click on on Taste possibilities at the bottom of the sector and select + Add chat sorting
Choose “LLM Study” for the reason that Supplier AND “Automatic detection” for the reason that Taste.
Once connected, the Chat field will show the LLM templates available from LM Studio. In this example we will select the file “Qwen2.5 encoder with 14B” sort that we downloaded and organized in LM Studio.
Using the chat field
The Chat field works similarly to other AI assistants. You will be able to interact with it by asking questions, asking for concepts, or even generating code snippets. Some examples are listed below:
Request a simple HTML report snippet:
Use the @
symbol and select “Knowledge” to offer context. For example, attach existing file to generate a docblock for a selected section.
Configuring autocomplete
Automatic completion is probably one of the more uncommon choices found in AI-powered code editors. In this case, with Continue.dev + VS Code setting, however now it will not be enabled. To enable this, open the configuration file su ~/.continue/config.json
and add the following to attach the autocomplete to LM Studio.
{ "tabAutocompleteModel": { "apiBase": "http://localhost:1234/v1/", "identify": "Qwen2.5-Coder 14B", "provider": "lmstudio", "sort": "qwen2.5-coder:14b" } }
Once organized and saved, you will see autocomplete running on your VS Code editor.
In conclusion
And that’s how you’ll use LM Studio for AI assistance in Visual Studio Code. It’s an effective way to have AI assistance on your code editor without relying on the cloud. It is also free and you can also select the type that is best on your computer. A perfect strain for cloud-based services like OpenAI or GitHub Copilot.
Give it a try to see how it will enable you to accomplish your coding tasks.
The post Methods for Using LM Studio for AI Driving in Visible Studio Code appeared first on Hongkiat.
Scope of delivery: https://www.hongkiat.com/blog/lm-studio-ai-assistance-vs-code-setup/
[ continue ]
wordpress Maintenance Plans | wordpress hosting
Read more