diff --git a/CHANGELOG.md b/CHANGELOG.md index 0561c8abc..c983fc7bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ## master +#### :rocket: New Feature + +- Enable incremental typechecking and project config cache by default. https://github.com/rescript-lang/rescript-vscode/pull/1047 + ## 1.58.0 #### :bug: Bug fix diff --git a/package.json b/package.json index 1753346e1..a5735b63c 100644 --- a/package.json +++ b/package.json @@ -177,10 +177,10 @@ "default": true, "description": "Enable signature help for variant constructor payloads." }, - "rescript.settings.incrementalTypechecking.enabled": { + "rescript.settings.incrementalTypechecking.enable": { "type": "boolean", - "default": false, - "description": "(beta/experimental) Enable incremental type checking." + "default": true, + "description": "Enable incremental type checking." }, "rescript.settings.incrementalTypechecking.acrossFiles": { "type": "boolean", @@ -192,10 +192,10 @@ "default": false, "description": "(debug) Enable debug logging (ends up in the extension output)." }, - "rescript.settings.cache.projectConfig.enabled": { + "rescript.settings.cache.projectConfig.enable": { "type": "boolean", - "default": false, - "description": "(beta/experimental) Enable project config caching. Can speed up latency dramatically." + "default": true, + "description": "Enable project config caching. Can speed up latency dramatically." }, "rescript.settings.binaryPath": { "type": [ diff --git a/server/src/config.ts b/server/src/config.ts index 567f05585..ef8e4c773 100644 --- a/server/src/config.ts +++ b/server/src/config.ts @@ -17,13 +17,13 @@ export interface extensionConfiguration { forConstructorPayloads?: boolean; }; incrementalTypechecking?: { - enabled?: boolean; + enable?: boolean; acrossFiles?: boolean; debugLogging?: boolean; }; cache?: { projectConfig?: { - enabled?: boolean; + enable?: boolean; }; }; } @@ -46,13 +46,13 @@ let config: { extensionConfiguration: extensionConfiguration } = { forConstructorPayloads: true, }, incrementalTypechecking: { - enabled: false, + enable: true, acrossFiles: false, debugLogging: false, }, cache: { projectConfig: { - enabled: false, + enable: true, }, }, }, diff --git a/server/src/server.ts b/server/src/server.ts index 31f413b0e..c7e0cf2c0 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -174,7 +174,7 @@ let deleteProjectDiagnostics = (projectRootPath: string) => { }); projectsFiles.delete(projectRootPath); - if (config.extensionConfiguration.incrementalTypechecking?.enabled) { + if (config.extensionConfiguration.incrementalTypechecking?.enable) { ic.removeIncrementalFileFolder(projectRootPath); } } @@ -218,9 +218,7 @@ let compilerLogsWatcher = chokidar }) .on("all", (_e, changedPath) => { if (changedPath.includes("build.ninja")) { - if ( - config.extensionConfiguration.cache?.projectConfig?.enabled === true - ) { + if (config.extensionConfiguration.cache?.projectConfig?.enable === true) { let projectRoot = utils.findProjectRootOfFile(changedPath); if (projectRoot != null) { syncProjectConfigCache(projectRoot); @@ -259,7 +257,7 @@ let openedFile = (fileUri: string, fileContent: string) => { if (projectRootPath != null) { let projectRootState = projectsFiles.get(projectRootPath); if (projectRootState == null) { - if (config.extensionConfiguration.incrementalTypechecking?.enabled) { + if (config.extensionConfiguration.incrementalTypechecking?.enable) { ic.recreateIncrementalFileFolder(projectRootPath); } const namespaceName = @@ -284,9 +282,7 @@ let openedFile = (fileUri: string, fileContent: string) => { compilerLogsWatcher.add( path.join(projectRootPath, c.compilerLogPartialPath) ); - if ( - config.extensionConfiguration.cache?.projectConfig?.enabled === true - ) { + if (config.extensionConfiguration.cache?.projectConfig?.enable === true) { compilerLogsWatcher.add( path.join(projectRootPath, c.buildNinjaPartialPath) ); @@ -354,7 +350,7 @@ let openedFile = (fileUri: string, fileContent: string) => { let closedFile = (fileUri: string) => { let filePath = fileURLToPath(fileUri); - if (config.extensionConfiguration.incrementalTypechecking?.enabled) { + if (config.extensionConfiguration.incrementalTypechecking?.enable) { ic.handleClosedFile(filePath); } @@ -388,7 +384,7 @@ let updateOpenedFile = (fileUri: string, fileContent: string) => { let filePath = fileURLToPath(fileUri); assert(stupidFileContentCache.has(filePath)); stupidFileContentCache.set(filePath, fileContent); - if (config.extensionConfiguration.incrementalTypechecking?.enabled) { + if (config.extensionConfiguration.incrementalTypechecking?.enable) { ic.handleUpdateOpenedFile(filePath, fileContent, send, () => { if (config.extensionConfiguration.codeLens) { sendCodeLensRefresh(); @@ -862,7 +858,7 @@ function format(msg: p.RequestMessage): Array { } let updateDiagnosticSyntax = (fileUri: string, fileContent: string) => { - if (config.extensionConfiguration.incrementalTypechecking?.enabled) { + if (config.extensionConfiguration.incrementalTypechecking?.enable) { // The incremental typechecking already sends syntax diagnostics. return; } diff --git a/server/src/utils.ts b/server/src/utils.ts index 2b22f0b4f..0b8d3ef3d 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -224,11 +224,11 @@ export let runAnalysisAfterSanityCheck = ( ...process.env, RESCRIPT_VERSION: rescriptVersion, RESCRIPT_INCREMENTAL_TYPECHECKING: - config.extensionConfiguration.incrementalTypechecking?.enabled === true + config.extensionConfiguration.incrementalTypechecking?.enable === true ? "true" : undefined, RESCRIPT_PROJECT_CONFIG_CACHE: - config.extensionConfiguration.cache?.projectConfig?.enabled === true + config.extensionConfiguration.cache?.projectConfig?.enable === true ? "true" : undefined, },