Skip to content

Commit 3777897

Browse files
committed
Fix host configuration for server
1 parent 11cd926 commit 3777897

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/server/editorServices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ namespace ts.server {
253253

254254
export function convertWatchOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): WatchOptions | undefined {
255255
let result: WatchOptions | undefined;
256+
debugger;
256257
watchOptionsConverters.forEach((mappedValues, id) => {
257258
const propertyValue = protocolOptions[id];
258259
if (propertyValue === undefined) return;

src/testRunner/unittests/tsserver/watchEnvironment.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ namespace ts.projectSystem {
567567
});
568568

569569
describe("excludeDirectories", () => {
570-
function setup(_configureHost?: boolean) {
570+
function setup(configureHost?: boolean) {
571571
const configFile: File = {
572572
path: `${tscWatch.projectRoot}/tsconfig.json`,
573573
content: JSON.stringify({ include: ["src"], watchOptions: { excludeDirectories: ["node_modules"] } })
@@ -587,6 +587,11 @@ namespace ts.projectSystem {
587587
const files = [libFile, main, bar, foo, configFile];
588588
const host = createServerHost(files, { currentDirectory: tscWatch.projectRoot });
589589
const service = createProjectService(host);
590+
if (configureHost) {
591+
service.setHostConfiguration({
592+
watchOptions: { excludeDirectories: ["node_modules"] }
593+
});
594+
}
590595
service.openClientFile(main.path);
591596
return { host, configFile };
592597
}
@@ -611,11 +616,8 @@ namespace ts.projectSystem {
611616
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
612617
checkWatchedDirectoriesDetailed(
613618
host,
614-
arrayToMap(
615-
[`${tscWatch.projectRoot}/src`, `${tscWatch.projectRoot}/node_modules`],
616-
identity,
617-
f => f === `${tscWatch.projectRoot}/node_modules` ? 1 : 2,
618-
),
619+
[`${tscWatch.projectRoot}/src`],
620+
2,
619621
/*recursive*/ true,
620622
);
621623
});

0 commit comments

Comments
 (0)