Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

All notable changes to R Console will be documented in this file.

## [0.4.0] - 2026-07-11
## [0.4.1] - 2026-07-11

### Added

- Added `Alt+Esc` (`⌥ Esc` on macOS) to open console completions anywhere, including positions without a completion prefix or context.
- Added `F7` to open console completions anywhere, including positions without a completion prefix or context.
- Added `Restore Default Name` to the console tab menu for returning a renamed console to `R Console (PID)`.

### Changed

- Console syntax highlighting now follows the active VS Code theme without depending on the language server.
- Persistent-session reattachment now warns when the configured R path differs from the running session, with options to close the session or open the R path setting.
- Completion suggestions now keep runtime and language-server results in their existing groups.
- Runtime completions now appear immediately while language-server suggestions continue loading.
- Completions opened without a prefix now update as you type, including inside empty `[]` / `()` contexts and when using `Alt+Esc`.
- Completions opened without a prefix now update as you type, including inside empty `[]` / `()` contexts and when using the completion shortcut.
- Runtime and language-server completions are now both available in normal expression positions, including function calls and data-frame/table expressions; `pkg::`, `pkg:::`, `$`, `@`, quoted column-name, and `[[` completions remain limited to their matching context.
- Further reduced the delay when opening language-server suggestions.
- Renamed consoles and their session-manager labels now keep their names when the console is reopened or detached and reattached.
- Persistent-session reattachment now warns when the configured R path differs from the running session, with options to close the session or open the R path setting.

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ R Console is a lightweight R console for VS Code that runs R inside a custom pse

- Custom R console hosted in the VS Code terminal area.
- Persistent R console sessions that can be attached, detached, or closed from VS Code, while preserving custom console names.
- Tab-triggered completion, including objects from the active R session and runtime `$` / `@` member completion. `Alt+Esc` (`⌥ Esc` on macOS) opens the completion window at the cursor, including empty positions where Tab is used for indentation.
- Tab-triggered completion, including objects from the active R session and runtime `$` / `@` member completion. `F7` opens the completion window at the cursor, including empty positions where Tab is used for indentation.
- Syntax highlighting that follows the active VS Code color theme.
- Multiline editing with local history navigation, reverse search, and long-input rendering.
- Auto-matching brackets and quotes.
Expand Down
14 changes: 9 additions & 5 deletions docs/IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,15 @@ inherits the normalized R environment used by the console runtime. Diagnostics
are disabled because the virtual console document exists only to provide
completion context and must not be linted as a source file.

The contributed `Alt+Esc` keybinding is limited to an active R Console and
invokes its internal forced-completion handler, preventing VS Code's terminal
suggestion command from consuming the shortcut first. Forced completion shows
the Quick Pick before full workspace and language-server results arrive, then
fills the open window asynchronously.
The contributed `F7` keybinding is limited to an active R Console and invokes
its internal forced-completion handler when VS Code handles the keybinding. If
VS Code instead forwards F7 to the pseudoterminal, `KeyProcessor` maps the
standard xterm `ESC [ 18 ~` sequence to the same forced-completion handler.
This fallback keeps completion available when
`terminal.integrated.sendKeybindingsToShell` is enabled without changing the
separate Tab action used for indentation and contextual completion. Forced
completion shows the Quick Pick before full workspace and language-server
results arrive, then fills the open window asynchronously.

Console syntax highlighting is separate from language-server completion. It is
implemented locally by `src/Terminal/consoleSyntax.ts` and
Expand Down
12 changes: 10 additions & 2 deletions docs/MANUALTEST.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,22 @@ lm_test <- lm(mpg ~ wt + cyl, data = mtcars)

Now test in the console:

- press `Alt+Esc` at an empty prompt and after typing a partial name
- press `F7` at an empty prompt and after typing a partial name (use `Fn+F7`
on macOS when the top row controls media features)
- press Tab at an empty prompt, then after typing a partial name
- type `df_test$` and request completion
- type `df_test[` and request completion inside brackets
- type `stats::f` and request package completion
- temporarily set `terminal.integrated.sendKeybindingsToShell` to `true`,
reload the VS Code window, and repeat the F7 checks; restore the setting
afterward

Expected:

- `Alt+Esc` opens the R Console completion window
- F7 opens the R Console completion window with either terminal keybinding
dispatch mode
- Tab at an empty prompt inserts indentation, while Tab after a partial name
requests contextual completion
- `$` completions include `alpha`, `beta`, `gamma`
- `[` completions on `df_test` include `alpha`, `beta`, `gamma`
- completion still works after several commands, not just right after startup
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vsc-r-console",
"displayName": "R Console for VS Code",
"description": "A lightweight R console for VS Code",
"version": "0.4.0",
"version": "0.4.1",
"publisher": "RConsole",
"license": "SEE LICENSE IN LICENSE",
"icon": "images/Rlogo.png",
Expand Down Expand Up @@ -121,7 +121,7 @@
"keybindings": [
{
"command": "r-console.triggerCompletion",
"key": "alt+escape",
"key": "f7",
"when": "terminalFocus && rConsole.consoleActive"
},
{
Expand All @@ -132,8 +132,7 @@
],
"configurationDefaults": {
"terminal.integrated.commandsToSkipShell": [
"r-console.insertPipeOperator",
"r-console.triggerCompletion"
"r-console.insertPipeOperator"
]
},
"configuration": {
Expand Down
8 changes: 8 additions & 0 deletions src/Terminal/keyProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type KeyAction =
| { type: "word-right" }
| { type: "tab" }
| { type: "backtab" }
| { type: "completion" }
| { type: "escape" }
| { type: "ctrl_c" }
| { type: "ctrl_d" }
Expand All @@ -29,6 +30,10 @@ const CSI_6: Map<string, KeyAction> = new Map([
["\x1b[1;5D", { type: "word-left" }],
]);

const CSI_5: Map<string, KeyAction> = new Map([
["\x1b[18~", { type: "completion" }],
]);

const CSI_4: Map<string, KeyAction> = new Map([
["\x1b[3~", { type: "delete" }],
["\x1b[1~", { type: "home" }],
Expand Down Expand Up @@ -100,6 +105,9 @@ function getCsiAction(sequence: string): KeyAction | undefined {
if (sequence.length === 6) {
return CSI_6.get(sequence);
}
if (sequence.length === 5) {
return CSI_5.get(sequence);
}
if (sequence.length === 4) {
return CSI_4.get(sequence);
}
Expand Down
3 changes: 3 additions & 0 deletions src/Terminal/rTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,9 @@ export class RTerminal implements vscode.Pseudoterminal {
}
return;
}
case "completion":
this.triggerCompletion();
return;
case "backtab": {
this.expandForEdit();
const beforeCursor = this.inputState.currentLineBeforeCursor;
Expand Down
Loading