Skip to content

Commit 596e186

Browse files
authored
Reduced completion suggestion delay (#20)
1 parent e2b7a2e commit 596e186

5 files changed

Lines changed: 22 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

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

5+
## [0.3.1] - 2026-06-29
6+
7+
### Fixed
8+
9+
- Reduced the delay when opening console suggestions by avoiding duplicate workspace refreshes when Tab is pressed.
10+
511
## [0.3.0] - 2026-06-24
612

713
### Fixed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vsc-r-console",
33
"displayName": "R Console for VS Code",
44
"description": "A lightweight R console for VS Code",
5-
"version": "0.3.0",
5+
"version": "0.3.1",
66
"publisher": "RConsole",
77
"license": "SEE LICENSE IN LICENSE",
88
"icon": "images/Rlogo.png",

src/Terminal/rTerminal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,11 +1649,11 @@ export class RTerminal implements vscode.Pseudoterminal {
16491649
}
16501650

16511651
private async handleAutocomplete(): Promise<void> {
1652-
this.sessionWatcher?.refresh();
16531652
await this.lang.handleAutocomplete({
16541653
input: this.getInputSnapshot(),
16551654
getCurrentInput: () => this.getInputSnapshot(),
16561655
getWorkspaceData: () => this.sessionWatcher?.getWorkspaceData(),
1656+
refreshWorkspaceData: () => this.sessionWatcher?.refresh(),
16571657
applyCompletion: (selection) => {
16581658
this.applyCompletion(selection);
16591659
},

src/Terminal/rTerminal/lang.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type AutocompleteRequest = {
4141
input: InputSnapshot;
4242
getCurrentInput: () => InputSnapshot;
4343
getWorkspaceData: () => WorkspaceData | undefined;
44+
refreshWorkspaceData: () => void;
4445
applyCompletion: (selection: CompletionPickItem) => void;
4546
};
4647

@@ -64,6 +65,7 @@ export class RTermLang {
6465
input,
6566
getCurrentInput,
6667
getWorkspaceData,
68+
refreshWorkspaceData,
6769
applyCompletion,
6870
}: AutocompleteRequest): Promise<void> {
6971
if (this.completionInProgress) {
@@ -81,6 +83,14 @@ export class RTermLang {
8183

8284
this.completionInProgress = true;
8385
try {
86+
const shouldRequestWorkspaceData = this.shouldRequestWorkspaceData(context);
87+
const workspaceDataRequest = shouldRequestWorkspaceData
88+
? this.options.requestWorkspaceData?.()
89+
: undefined;
90+
if (!shouldRequestWorkspaceData) {
91+
refreshWorkspaceData();
92+
}
93+
8494
await this.ensureConsoleLspStarted();
8595

8696
const latestInput = getCurrentInput();
@@ -91,8 +101,8 @@ export class RTermLang {
91101
return;
92102
}
93103

94-
const sessionData = this.shouldRequestWorkspaceData(context)
95-
? (await this.options.requestWorkspaceData?.()) ?? getWorkspaceData()
104+
const sessionData = shouldRequestWorkspaceData
105+
? (await workspaceDataRequest) ?? getWorkspaceData()
96106
: getWorkspaceData();
97107
const doc = this.getOrUpdateCompletionDocument(latestInput.text);
98108
if (!doc) {

0 commit comments

Comments
 (0)