diff --git a/build/gulpfile.ts b/build/gulpfile.ts index a3e6a82d572..b7bbc216915 100644 --- a/build/gulpfile.ts +++ b/build/gulpfile.ts @@ -37,7 +37,7 @@ const compileClientTask = task.define('compile-client', task.series(util.rimraf( gulp.task(compileClientTask); const watchClientTask = useEsbuildTranspile - ? task.define('watch-client', task.parallel(compilation.watchTask('out', false, 'src', { noEmit: true }), compilation.watchApiProposalNamesTask, compilation.watchExtensionPointNamesTask, compilation.watchCodiconsTask)) + ? task.define('watch-client', task.parallel(compilation.watchTypeCheckTask('src'), compilation.watchApiProposalNamesTask, compilation.watchExtensionPointNamesTask, compilation.watchCodiconsTask)) : task.define('watch-client', task.series(util.rimraf('out'), task.parallel(compilation.watchTask('out', false), compilation.watchApiProposalNamesTask, compilation.watchExtensionPointNamesTask, compilation.watchCodiconsTask))); gulp.task(watchClientTask); diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts index 047e83eb7ff..6e64fd62fc3 100644 --- a/build/lib/compilation.ts +++ b/build/lib/compilation.ts @@ -23,6 +23,7 @@ import watch from './watch/index.ts'; import bom from 'gulp-bom'; import * as tsb from './tsb/index.ts'; import sourcemaps from 'gulp-sourcemaps'; +import { createTsgoStream } from './tsgo.ts'; import { extractExtensionPointNamesFromFile } from './extractExtensionPoints.ts'; @@ -190,6 +191,23 @@ export function watchTask(out: string, build: boolean, srcPath: string = 'src', return task; } +export function watchTypeCheckTask(src: string): task.StreamTask { + const theTask = () => { + const projectPath = path.join(import.meta.dirname, '../../', src, 'tsconfig.json'); + const watchInput = watch(`${src}/**`, { base: src, readDelay: 200 }); + const tsgoStream = watchInput.pipe(util.debounce(() => { + const stream = createTsgoStream(projectPath, { taskName: 'watch-client-noEmit', noEmit: true }); + const result = es.through(); + stream.on('end', () => result.emit('end')); + stream.on('error', () => result.emit('end')); + return result; + })); + return tsgoStream; + }; + theTask.taskName = `watch-typecheck-${path.basename(src)}`; + return theTask; +} + const REPO_SRC_FOLDER = path.join(import.meta.dirname, '../../src'); class MonacoGenerator { diff --git a/build/lib/tsgo.ts b/build/lib/tsgo.ts index 36d925d4313..57272e62539 100644 --- a/build/lib/tsgo.ts +++ b/build/lib/tsgo.ts @@ -18,11 +18,9 @@ export function spawnTsgo(projectPath: string, config: { taskName: string; noEmi function runReporter(output: string) { const lines = (output || '').split('\n'); const errorLines = lines.filter(line => /error \w+:/.test(line)); - if (errorLines.length > 0) { - fancyLog(`Finished ${ansiColors.green(config.taskName)} ${projectPath} with ${errorLines.length} errors.`); - for (const line of errorLines) { - fancyLog(line); - } + fancyLog(`Finished ${ansiColors.green(config.taskName)} ${projectPath} with ${errorLines.length} errors.`); + for (const line of errorLines) { + fancyLog(line); } } diff --git a/src/tsconfig.json b/src/tsconfig.json index bfda0ebafc1..815c7bfe183 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -8,6 +8,7 @@ "allowJs": true, "resolveJsonModule": true, "isolatedModules": false, + "skipLibCheck": true, "outDir": "../out/vs", "types": [ "@webgpu/types",