Skip to content

Commit 47d7aaf

Browse files
committed
make the new completion mode dependent on a setting
1 parent 5c2761d commit 47d7aaf

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@
206206
],
207207
"default": null,
208208
"description": "Path to the directory where platform-specific ReScript binaries are. You can use it if you haven't or don't want to use the installed ReScript from node_modules in your project."
209+
},
210+
"rescript.settings.newCompletion": {
211+
"type": "boolean",
212+
"default": false,
213+
"description": "(experimental) Enable new completion engine"
209214
}
210215
}
211216
},

server/src/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface extensionConfiguration {
1111
codeLens?: boolean;
1212
binaryPath?: string | null;
1313
platformPath?: string | null;
14+
newCompletion?: boolean;
1415
signatureHelp?: {
1516
enabled?: boolean;
1617
forConstructorPayloads?: boolean;
@@ -39,6 +40,7 @@ let config: { extensionConfiguration: extensionConfiguration } = {
3940
codeLens: false,
4041
binaryPath: null,
4142
platformPath: null,
43+
newCompletion: false,
4244
signatureHelp: {
4345
enabled: true,
4446
forConstructorPayloads: true,

server/src/server.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,15 @@ async function completion(msg: p.RequestMessage) {
680680
let code = getOpenedFileContent(params.textDocument.uri);
681681
let tmpname = utils.createFileInTempDir();
682682
fs.writeFileSync(tmpname, code, { encoding: "utf-8" });
683-
await new Promise<void>((resolve) => {
684-
ic.triggerIncrementalCompilationOfFile(filePath, code, send, () => {
685-
resolve();
683+
684+
if (config.extensionConfiguration.newCompletion) {
685+
await new Promise<void>((resolve) => {
686+
ic.triggerIncrementalCompilationOfFile(filePath, code, send, () => {
687+
resolve();
688+
});
686689
});
687-
});
690+
}
691+
688692
let response = utils.runAnalysisCommand(
689693
filePath,
690694
[

server/src/utils.ts

+4
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ export let runAnalysisAfterSanityCheck = (
229229
config.extensionConfiguration.cache?.projectConfig?.enable === true
230230
? "true"
231231
: undefined,
232+
RESCRIPT_NEW_ANALYSIS_ENGINE:
233+
config.extensionConfiguration.newCompletion === true
234+
? "true"
235+
: undefined,
232236
},
233237
};
234238

0 commit comments

Comments
 (0)