keepcalculator

06 Numbers and Powers

Run a Local Coding Assistant in VS Code with Ollama

Card No. 06·29416 · Updated · Standard formula, shown below

Run a coding model on your own computer and use it from VS Code through Ollama and the Continue extension. You will need to download a model that fits your hardware, then connect Continue to Ollama so you can ask questions and get code suggestions without sending prompts to a hosted model.

What You’ll Need

  • A supported Windows, macOS, or Linux computer with enough memory and disk space for your chosen model. Larger models generally need more resources and run more slowly on modest hardware.
  • Visual Studio Code installed and access to its Extensions view.
  • Ollama installed from its official website, with its local service running.
  • The Continue extension installed in VS Code.
  • An internet connection for downloading Ollama, Continue, and the model. After downloads finish, model inference can run locally.

Step-by-Step

  1. Install Ollama. Download the installer for your operating system from the official Ollama website and follow its prompts. Open a terminal after installation. On systems where Ollama runs as a background service, it may start automatically; otherwise, start the Ollama application or run ollama serve. Leave the service running while you use Continue.
  2. Choose a coding model. Check Ollama’s current model library for a code-capable model and its exact pull name. Select a model that your computer can handle; model size, quantization, and available memory affect speed and quality. Names and availability change, so do not assume a model tag from an old tutorial is still current.
  3. Download the model. In a terminal, run ollama pull MODEL_NAME, replacing MODEL_NAME with the exact name shown in the Ollama library, such as a name with a size tag. Wait for the download to complete. You can check what is installed with ollama list.
  4. Verify that Ollama can answer. Run ollama run MODEL_NAME with the same name. Enter a brief test prompt, then exit the interactive session as instructed by the terminal. If this test fails, fix Ollama or the model download before configuring VS Code.
  5. Install Continue in VS Code. Open VS Code, select the Extensions icon in the Activity Bar, search for Continue, and install the extension published by Continue. Open its view from the Activity Bar or the available Continue command in the Command Palette. Extension layouts and labels can change between releases.
  6. Set Ollama as the model provider. Open Continue’s configuration using its settings or configuration command. In current versions, Continue may offer a configuration file or a model setup flow; follow the option presented by your installed version. Add or select a model entry that uses the Ollama provider and the exact model name you pulled. For example, a configuration entry commonly uses provider: ollama and model: MODEL_NAME. Preserve the file’s existing structure and syntax; refer to Continue’s current configuration documentation if its format differs.
  7. Choose the model’s role. Set the Ollama model as a chat model to ask questions and discuss code. If you want inline autocomplete, configure a model that Continue supports for autocomplete and that is suitable for fast, short completions. A chat model is not automatically a good autocomplete model. Continue’s configuration may distinguish model roles, so use the role labels and examples in its current documentation.
  8. Check the connection and test in a project. Open a code folder in VS Code, open Continue, and select the Ollama model if there is a model selector. Ask a small question about a file or request a simple explanation. For inline completion, open a source file and type a short function or comment where a completion would make sense. Accept a suggestion only after reviewing it.
  9. Review privacy and workspace context. Local inference means the model runs on your machine, but Continue still needs to read relevant context from the files you ask it about. Check Continue’s current settings and documentation to understand what context is included and whether any optional features use external services. Avoid including secrets, credentials, or private data in prompts unless you have confirmed how the tool handles them.

Common Mistakes

  • Using a name that does not match: The model name in Continue must match an installed Ollama model, including any tag. Compare it with ollama list.
  • Assuming the extension downloads the model: Continue connects to Ollama; Ollama must have the model downloaded separately.
  • Closing Ollama’s service: A model can be installed correctly but unavailable when the local service is stopped. Keep Ollama running.
  • Choosing a model that is too large: Insufficient memory can cause slow responses, failures, or heavy system load. Start with a smaller suitable model, then try a larger one if performance allows.
  • Expecting autocomplete from chat setup: Chat and inline completion are different tasks. Configure a compatible autocomplete model separately if needed.
  • Copying outdated configuration examples: Continue’s setup and configuration can evolve. Use the format documented for your installed version rather than pasting an old file wholesale.

Tips

  • Start with one model and confirm chat works before adding autocomplete or other models.
  • Use ollama list to confirm the exact installed name; use ollama run MODEL_NAME to test that model outside VS Code.
  • Ask focused questions and open the relevant files. Clear context usually produces more useful answers than a vague request about an entire project.
  • Review generated code for correctness, security, and project conventions. A local model can still make incorrect suggestions.
  • Keep Ollama, Continue, and VS Code updated through their normal update mechanisms, and recheck configuration if an update changes available setup options.

Troubleshooting

Continue says it cannot connect: Confirm Ollama is installed and running. Test it in a terminal with ollama run MODEL_NAME. If the terminal works but Continue does not, verify that Continue uses the Ollama provider and the expected local connection settings shown in its current setup documentation. Restart VS Code after correcting the configuration.

The model is not found: Run ollama list, then compare the output character for character with the model field in Continue. If it is missing, pull the correct model again using ollama pull MODEL_NAME.

Responses are very slow or the computer struggles: Try a smaller model, close other resource-intensive applications, and allow the first response time to load the model. Check the model’s requirements in Ollama’s library; available memory and hardware strongly affect performance.

Chat works, but autocomplete does not: Check whether an autocomplete-capable model is configured and enabled for that role. Confirm Continue’s current documentation lists the model or model type as supported for inline completion. Test chat and autocomplete independently.

Configuration errors appear: Check spelling, punctuation, indentation, and required fields in the configuration file. Restore the extension’s generated configuration if necessary, then add the Ollama model using the current documented example. Avoid changing unrelated settings while diagnosing the problem.

Frequently Asked Questions

Does this setup work without internet?
After Ollama, Continue, and the model are installed, local prompts can generally run without internet. Downloads and optional features that rely on external services still need a connection.

Is my code automatically sent to a cloud service?
Ollama runs the selected model locally, but data handling also depends on Continue settings and any optional integrations. Review the current settings and documentation before using sensitive code.

Can I use any Ollama model with Continue?
Not necessarily. A model may work for chat but not be suitable or supported for autocomplete. Check Continue’s current model guidance and use the exact installed Ollama name.

Do I need a GPU?
No, but performance depends on your hardware. Some models can run on a CPU, often more slowly; supported acceleration depends on your system and Ollama installation.

Can I install more than one model?
Yes. Pull additional models with Ollama, then add or select their exact names in Continue. More installed models use additional disk space, and only the active model needs to be loaded for a given task.

What should I do if Continue’s menus differ from these steps?
Use the installed extension’s configuration and setup guidance. Continue’s interface and configuration options can change, while the key requirements remain an available Ollama model and a matching provider configuration.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →