Skip to content

vscode: add configurable server context limit - #34

Open
hoyyeva wants to merge 1 commit into
mainfrom
hoyyeva/fix-server-context-limit
Open

vscode: add configurable server context limit#34
hoyyeva wants to merge 1 commit into
mainfrom
hoyyeva/fix-server-context-limit

Conversation

@hoyyeva

@hoyyeva hoyyeva commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a configurable maximum context length for Ollama servers.

Users can set Ollama: Max Context Length to the same value as the server's OLLAMA_CONTEXT_LENGTH. The extension caps the model context reported to VS Code without exceeding the model's native context window.

This replaces the need to patch the installed extension with a hard-coded limit.

The change also:

  • Supports global and per-provider context limits.
  • Refreshes the model list when the setting changes.
  • Logs the configured cap in the Ollama output channel.
  • Documents setup in the README.
  • Preserves existing behavior when the setting is not configured.

Oversized one-shot requests that bypass VS Code's advertised limit remain unchanged and are tracked separately in #33.

Fixes #31.

Testing

  • Added tests for discovered, configured, fallback, and very small context windows.
  • Added tests for provider-over-global precedence.
  • Added tests for invalid context values.
  • Verified manually with OLLAMA_CONTEXT_LENGTH=8000.
  • Confirmed the output channel reports the configured value:
capped at 8000 context tokens
  • All 25 tests pass:
npm test

@hoyyeva
hoyyeva marked this pull request as ready for review July 20, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Extension ignores server max context size and provides no way to configure it

1 participant