Skip to content

4.3.25: dev > main - #586

Merged
rjmacarthy merged 7 commits into
mainfrom
dev
Nov 24, 2026
Merged

rjmacarthy merged 7 commits into
mainfrom
dev

Conversation

@m1ab0t

@m1ab0t m1ab0t commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Completions in a notebook read the cells round them (#580), and two new commands ask for a one-line or several-line suggestion (#579).

Closes #430. Closes #201.

#579 also gets a fix on top: its commands did nothing while a suggestion was already showing, because the editor reused it without asking the provider. A regression test covers it.

P2P gateway server: cancels the remote request when the caller hangs up is flaky and also fails on clean dev. Merging this publishes 4.3.25 to the Marketplace and Open VSX.

officialasishkumar and others added 7 commits November 20, 2026 03:35
Whether an inline suggestion runs over several lines is decided by
twinny.multilineCompletionsEnabled and a guess from the code round the
cursor. Users who usually want one line, and a block only now and then
(or the other way round), had no way to ask for the other length at the
moment they wanted it (#201).

Two commands now trigger a suggestion at the cursor with the length
chosen by the user, whatever the setting and the guess would pick:

- "Twinny - Suggest one line" (twinny.suggestLine)
- "Twinny - Suggest several lines" (twinny.suggestLines), up to
  twinny.maxLines

They have no default keys, so nothing clashes with Alt+\ or other
extensions; they can be bound in Keyboard Shortcuts and show in the
command palette while an editable editor has focus.

The command records the length with the document, version and cursor
it was asked at, then runs editor.action.inlineSuggest.trigger. The
first invoked request takes it, and uses it only if it is for that same
place, so the next suggestion follows the settings again. A request
with an asked length is never served from the suggestion on screen or
the one prefetched for the next line, since either may be the other
length, and it is cached under its own key. Typing through a suggestion
the command showed still serves the rest of it. The settings'
descriptions mention the commands.

Tests drive the command through the editor with the provider registered
against a fake Ollama: several lines where the settings give one, one
line where they give a block, and the asked length being let go once a
request elsewhere takes it. The prefetch tests' helpers move up a level
so the new suite can share them.
VS Code hands the completion provider each notebook cell as a document
of its own, so the window of code round the cursor stopped at the
cell's edges. In a Jupyter notebook that is usually most of what
matters: the imports, the data frame and the helpers a cell uses were
defined in the cells above, and the model, shown only the cell, guessed
at them or wrote code in another language altogether (#430).

When the document is a notebook cell, the code cells of the open
notebook in that cell's language are now joined in order, a blank line
between each, and the prefix and suffix window is cut from that text
with the cursor moved to its place in it. Markdown cells and code cells
in another language (a SQL cell in a Python notebook) are left out, as
they would not read as part of the same code. The usual limits still
apply: twinny.contextLength lines, the character caps, and the
step-aligned start that lets the server reuse its prompt cache.

getPrefixSuffix now takes only the lineCount and getText it reads, so
the joined text is passed to it through a small view with the same
clamping as a document. The prefetch check uses the same window, so a
prefetched completion in a notebook is recognised as on the way.

Tests: the view matches a real document for every window and clamped
range tried; cells are joined and the cell's first line found, with
markdown and other-language cells skipped; and a completion asked in
the middle cell of a real jupyter-notebook document is made with the
cell above as prefix and the one below as suffix.
The editor reuses what it has for the same place without asking the
provider, so asking for the other length did nothing.

Claude-Session: https://claude.ai/code/session_01CKXDgYQNBL8Zw8LwpfL1jd
The open conversation was kept in global state, which every VS Code
window shares. With two windows open, a reply saved in one went into
whichever conversation the other window had opened last. The open
conversation now lives in workspace state; the conversation list stays
global.
@rjmacarthy
rjmacarthy merged commit 037d6fd into main Nov 24, 2026
1 check passed
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.

Completions in Jupyter include only the current cell Different shortcuts for single-line or multi-line suggestions

4 participants