mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:58:55 -05:00
Use tsgo to run type checks on client in watch mode
This reduces the time to get `src` transpiled and fully type checked to around 15seconds on my machine
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"allowJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": false,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "../out/vs",
|
||||
"types": [
|
||||
"@webgpu/types",
|
||||
|
||||
Reference in New Issue
Block a user