Skip to content

Commit 8849a58

Browse files
authored
Enable incremental typechecking by default (#1047)
* enable incremental typechecking by default * changelog * also change name in package.json * change wording + default value in package.json * enable project cache config by default * adjust changelog
1 parent 5705458 commit 8849a58

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
1313
## master
1414

15+
#### :rocket: New Feature
16+
17+
- Enable incremental typechecking and project config cache by default. https://github.com/rescript-lang/rescript-vscode/pull/1047
18+
1519
## 1.58.0
1620

1721
#### :bug: Bug fix

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@
177177
"default": true,
178178
"description": "Enable signature help for variant constructor payloads."
179179
},
180-
"rescript.settings.incrementalTypechecking.enabled": {
180+
"rescript.settings.incrementalTypechecking.enable": {
181181
"type": "boolean",
182-
"default": false,
183-
"description": "(beta/experimental) Enable incremental type checking."
182+
"default": true,
183+
"description": "Enable incremental type checking."
184184
},
185185
"rescript.settings.incrementalTypechecking.acrossFiles": {
186186
"type": "boolean",
@@ -192,10 +192,10 @@
192192
"default": false,
193193
"description": "(debug) Enable debug logging (ends up in the extension output)."
194194
},
195-
"rescript.settings.cache.projectConfig.enabled": {
195+
"rescript.settings.cache.projectConfig.enable": {
196196
"type": "boolean",
197-
"default": false,
198-
"description": "(beta/experimental) Enable project config caching. Can speed up latency dramatically."
197+
"default": true,
198+
"description": "Enable project config caching. Can speed up latency dramatically."
199199
},
200200
"rescript.settings.binaryPath": {
201201
"type": [

server/src/config.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ export interface extensionConfiguration {
1717
forConstructorPayloads?: boolean;
1818
};
1919
incrementalTypechecking?: {
20-
enabled?: boolean;
20+
enable?: boolean;
2121
acrossFiles?: boolean;
2222
debugLogging?: boolean;
2323
};
2424
cache?: {
2525
projectConfig?: {
26-
enabled?: boolean;
26+
enable?: boolean;
2727
};
2828
};
2929
}
@@ -46,13 +46,13 @@ let config: { extensionConfiguration: extensionConfiguration } = {
4646
forConstructorPayloads: true,
4747
},
4848
incrementalTypechecking: {
49-
enabled: false,
49+
enable: true,
5050
acrossFiles: false,
5151
debugLogging: false,
5252
},
5353
cache: {
5454
projectConfig: {
55-
enabled: false,
55+
enable: true,
5656
},
5757
},
5858
},

server/src/server.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ let deleteProjectDiagnostics = (projectRootPath: string) => {
174174
});
175175

176176
projectsFiles.delete(projectRootPath);
177-
if (config.extensionConfiguration.incrementalTypechecking?.enabled) {
177+
if (config.extensionConfiguration.incrementalTypechecking?.enable) {
178178
ic.removeIncrementalFileFolder(projectRootPath);
179179
}
180180
}
@@ -218,9 +218,7 @@ let compilerLogsWatcher = chokidar
218218
})
219219
.on("all", (_e, changedPath) => {
220220
if (changedPath.includes("build.ninja")) {
221-
if (
222-
config.extensionConfiguration.cache?.projectConfig?.enabled === true
223-
) {
221+
if (config.extensionConfiguration.cache?.projectConfig?.enable === true) {
224222
let projectRoot = utils.findProjectRootOfFile(changedPath);
225223
if (projectRoot != null) {
226224
syncProjectConfigCache(projectRoot);
@@ -259,7 +257,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
259257
if (projectRootPath != null) {
260258
let projectRootState = projectsFiles.get(projectRootPath);
261259
if (projectRootState == null) {
262-
if (config.extensionConfiguration.incrementalTypechecking?.enabled) {
260+
if (config.extensionConfiguration.incrementalTypechecking?.enable) {
263261
ic.recreateIncrementalFileFolder(projectRootPath);
264262
}
265263
const namespaceName =
@@ -284,9 +282,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
284282
compilerLogsWatcher.add(
285283
path.join(projectRootPath, c.compilerLogPartialPath)
286284
);
287-
if (
288-
config.extensionConfiguration.cache?.projectConfig?.enabled === true
289-
) {
285+
if (config.extensionConfiguration.cache?.projectConfig?.enable === true) {
290286
compilerLogsWatcher.add(
291287
path.join(projectRootPath, c.buildNinjaPartialPath)
292288
);
@@ -354,7 +350,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
354350
let closedFile = (fileUri: string) => {
355351
let filePath = fileURLToPath(fileUri);
356352

357-
if (config.extensionConfiguration.incrementalTypechecking?.enabled) {
353+
if (config.extensionConfiguration.incrementalTypechecking?.enable) {
358354
ic.handleClosedFile(filePath);
359355
}
360356

@@ -388,7 +384,7 @@ let updateOpenedFile = (fileUri: string, fileContent: string) => {
388384
let filePath = fileURLToPath(fileUri);
389385
assert(stupidFileContentCache.has(filePath));
390386
stupidFileContentCache.set(filePath, fileContent);
391-
if (config.extensionConfiguration.incrementalTypechecking?.enabled) {
387+
if (config.extensionConfiguration.incrementalTypechecking?.enable) {
392388
ic.handleUpdateOpenedFile(filePath, fileContent, send, () => {
393389
if (config.extensionConfiguration.codeLens) {
394390
sendCodeLensRefresh();
@@ -862,7 +858,7 @@ function format(msg: p.RequestMessage): Array<p.Message> {
862858
}
863859

864860
let updateDiagnosticSyntax = (fileUri: string, fileContent: string) => {
865-
if (config.extensionConfiguration.incrementalTypechecking?.enabled) {
861+
if (config.extensionConfiguration.incrementalTypechecking?.enable) {
866862
// The incremental typechecking already sends syntax diagnostics.
867863
return;
868864
}

server/src/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@ export let runAnalysisAfterSanityCheck = (
224224
...process.env,
225225
RESCRIPT_VERSION: rescriptVersion,
226226
RESCRIPT_INCREMENTAL_TYPECHECKING:
227-
config.extensionConfiguration.incrementalTypechecking?.enabled === true
227+
config.extensionConfiguration.incrementalTypechecking?.enable === true
228228
? "true"
229229
: undefined,
230230
RESCRIPT_PROJECT_CONFIG_CACHE:
231-
config.extensionConfiguration.cache?.projectConfig?.enabled === true
231+
config.extensionConfiguration.cache?.projectConfig?.enable === true
232232
? "true"
233233
: undefined,
234234
},

0 commit comments

Comments
 (0)