Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove TSC_NONPOLLING_WATCHER env variable and provide default watchOptions #1326

Merged
merged 1 commit into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,7 @@ function constructArgs(ctx: vscode.ExtensionContext): string[] {

function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.NodeModule {
// Environment variables for server process
const prodEnv = {
// Force TypeScript to use the non-polling version of the file watchers.
TSC_NONPOLLING_WATCHER: true,
};
const prodEnv = {};
const devEnv = {
...prodEnv,
NG_DEBUG: true,
Expand Down
3 changes: 0 additions & 3 deletions integration/lsp/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ export function createConnection(serverOptions: ServerOptions): MessageConnectio
}
const server = fork(SERVER_PATH, argv, {
cwd: PROJECT_PATH,
env: {
TSC_NONPOLLING_WATCHER: 'true',
},
// uncomment to debug server process
// execArgv: ['--inspect-brk=9330']
});
Expand Down
4 changes: 0 additions & 4 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,4 @@ if (logger.loggingEnabled()) {
if (process.env.NG_DEBUG === 'true') {
session.info('Angular Language Service is running under DEBUG mode');
}
if (process.env.TSC_NONPOLLING_WATCHER !== 'true') {
session.warn(`Using less efficient polling watcher. Set TSC_NONPOLLING_WATCHER to true.`);
}

session.listen();
6 changes: 6 additions & 0 deletions server/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ export class Session {
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#smarter-auto-imports
includePackageJsonAutoImports: 'off',
},
watchOptions: {
// Used as watch options when not specified by user's `tsconfig`.
watchFile: ts.WatchFileKind.UseFsEvents,
watchDirectory: ts.WatchDirectoryKind.UseFsEvents,
fallbackPolling: ts.PollingWatchKind.DynamicPriority,
}
});

const pluginConfig: PluginConfig = {
Expand Down