Skip to content

Commit 9791632

Browse files
Merge pull request #27 from Release-Candidate/dont_check_for_unsaved_changes_on_autocomplete
Don't check for unsaved changes on autocomplete, only when explicitly…
2 parents c09d540 + fd34a3e commit 9791632

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Chez Scheme REPL for Visual Studio Code Changelog
22

3+
## Version 0.7.2 (2024-07-15)
4+
5+
Special thanks to [migraine-user](https://github.com/migraine-user) for helping with these:
6+
7+
### Bugfixes
8+
9+
- Do not check for unsaved changes for auto-completions, only when explicitly evaluating expressions.
10+
311
## Version 0.7.1 (2024-07-13)
412

513
Special thanks to [migraine-user](https://github.com/migraine-user) for helping with these:

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-scheme-repl",
33
"displayName": "Chez Scheme REPL",
4-
"version": "0.7.1",
4+
"version": "0.7.2",
55
"preview": false,
66
"publisher": "release-candidate",
77
"description": "Support for Chez Scheme: Highlighting, autocompletion, documentation on hover and syntax checks.",

src/evalREPL.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ export async function evalGetIds(
7474
const out = await runREPLCommand(
7575
env.config,
7676
document,
77-
c.evalIdentifiers(prefix)
77+
c.evalIdentifiers(prefix),
78+
false
7879
);
7980
if (out.error || out.stderr) {
8081
env.outChannel.appendLine(
@@ -103,7 +104,7 @@ export async function loadFile(
103104
env: h.Env,
104105
editor: vscode.TextEditor
105106
): Promise<void> {
106-
const out = await runREPLCommand(env.config, editor.document, "");
107+
const out = await runREPLCommand(env.config, editor.document, "", false);
107108
if (out.error) {
108109
env.outChannel.appendLine(
109110
`Error checking file ${editor.document.fileName}:\n${out.error}\nStderr: ${out.stderr}\nStdout: ${out.stdout}`
@@ -304,7 +305,8 @@ async function evalSexp(
304305
const out = await runREPLCommand(
305306
env.config,
306307
data.editor.document,
307-
data.exp.sexp
308+
data.exp.sexp,
309+
true
308310
);
309311
env.outChannel.appendLine(
310312
`Sent ${data.exp.sexp} to REPL using command ${c.cfgSection}.${data.vscodeCommand} Range ${data.range.start.line} - ${data.range.end.line}`
@@ -398,19 +400,23 @@ function matchREPLResponse(group: string): RegExp {
398400
* @param config The extension's configuration.
399401
* @param document The source code containing the sexp to evaluate.
400402
* @param exp The sexp to evaluate.
403+
* @param checkForSave If `true`, check if the file has unsaved changes, and if
404+
* so, ask the user to save them.
401405
* @returns The output of the Chez REPL after loading the file of `editor` and
402406
* evaluating `exp`.
403407
*/
408+
// eslint-disable-next-line max-params
404409
async function runREPLCommand(
405410
config: vscode.WorkspaceConfiguration,
406411
document: vscode.TextDocument,
407-
exp: string
412+
exp: string,
413+
checkForSave: boolean
408414
): Promise<h.Output> {
409415
const root = await h.askForWorkspace("Scheme");
410416
if (document.isUntitled) {
411417
await document.save();
412418
}
413-
if (document.isDirty) {
419+
if (checkForSave && document.isDirty) {
414420
const response = await vscode.window.showWarningMessage(
415421
"The file has unsaved changes, these will not be send to the REPL.",
416422
"Save changes and eval",

0 commit comments

Comments
 (0)