Skip to content

Commit

Permalink
Enable parcel-watcher as new default watcher (#132483)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Oct 11, 2021
1 parent 5dcc080 commit 85c5eb7
Show file tree
Hide file tree
Showing 24 changed files with 1,214 additions and 185 deletions.
48 changes: 24 additions & 24 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"restrictions": [
"vs/nls",
"**/vs/base/{common,node}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -170,7 +170,7 @@
"vs/nls",
"**/vs/base/{common,node}/**",
"**/vs/base/parts/*/{common,node}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -189,7 +189,7 @@
"vs/css!./**/*",
"**/vs/base/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/base/parts/*/{common,browser,node,electron-sandbox,electron-browser}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -198,7 +198,7 @@
"vs/nls",
"**/vs/base/{common,node,electron-main}/**",
"**/vs/base/parts/*/{common,node,electron-main}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -255,7 +255,7 @@
"**/vs/base/{common,node}/**",
"**/vs/base/parts/*/{common,node}/**",
"**/vs/platform/*/{common,node}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -276,7 +276,7 @@
"**/vs/base/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/base/parts/*/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/platform/*/{common,browser,node,electron-sandbox,electron-browser}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -286,7 +286,7 @@
"**/vs/base/{common,node,electron-main}/**",
"**/vs/base/parts/*/{common,node,electron-main}/**",
"**/vs/platform/*/{common,node,electron-main}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -513,7 +513,7 @@
"**/vs/workbench/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/workbench/api/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/workbench/services/*/{common,browser,node,electron-sandbox,electron-browser}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -528,7 +528,7 @@
"vs/workbench/contrib/files/browser/editors/fileEditorInput",
"**/vs/workbench/services/**",
"**/vs/workbench/test/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -592,7 +592,7 @@
"**/vs/workbench/{common,node}/**",
"**/vs/workbench/api/{common,node}/**",
"**/vs/workbench/services/**/{common,node}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -623,7 +623,7 @@
"**/vs/workbench/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/workbench/api/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/workbench/services/**/{common,browser,node,electron-sandbox,electron-browser}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -742,7 +742,7 @@
"**/vs/workbench/api/{common,node}/**",
"**/vs/workbench/services/**/{common,node}/**",
"**/vs/workbench/contrib/**/{common,node}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -775,7 +775,7 @@
"**/vs/workbench/api/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/workbench/services/**/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/workbench/contrib/**/{common,browser,node,electron-sandbox,electron-browser}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -798,7 +798,7 @@
"**/vs/base/parts/**/{common,node}/**",
"**/vs/platform/**/{common,node}/**",
"**/vs/code/**/{common,node}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -810,7 +810,7 @@
"**/vs/base/parts/**/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/platform/**/{common,browser,node,electron-sandbox,electron-browser}/**",
"**/vs/code/**/{common,browser,node,electron-sandbox,electron-browser}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -821,7 +821,7 @@
"**/vs/base/parts/**/{common,node,electron-main}/**",
"**/vs/platform/**/{common,node,electron-main}/**",
"**/vs/code/**/{common,node,electron-main}/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -833,7 +833,7 @@
"**/vs/platform/**/{common,node}/**",
"**/vs/workbench/**/{common,node}/**",
"**/vs/server/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down Expand Up @@ -904,28 +904,28 @@
"target": "**/test/smoke/**",
"restrictions": [
"**/test/smoke/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
"target": "**/test/automation/**",
"restrictions": [
"**/test/automation/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
"target": "**/test/integration/**",
"restrictions": [
"**/test/integration/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
"target": "**/test/monaco/**",
"restrictions": [
"**/test/monaco/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand All @@ -943,21 +943,21 @@
"target": "**/{node,electron-browser,electron-main}/**/*.test.ts",
"restrictions": [
"**/vs/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
"target": "**/{node,electron-browser,electron-main}/**/test/**",
"restrictions": [
"**/vs/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
"target": "**/test/{node,electron-browser,electron-main}/**",
"restrictions": [
"**/vs/**",
"@vscode/*", "*" // node modules
"@vscode/*", "@parcel/*", "*" // node modules
]
},
{
Expand Down
6 changes: 6 additions & 0 deletions build/.moduleignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ vscode-nsfw/src/**
vscode-nsfw/includes/**
!vscode-nsfw/build/Release/*.node

@parcel/watcher/binding.gyp
@parcel/watcher/build/**
@parcel/watcher/prebuilds/**
@parcel/watcher/src/**
!@parcel/watcher/build/Release/*.node

vsda/build/**
vsda/ci/**
vsda/src/**
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines/linux/product-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ steps:
# Set compiler toolchain
export CC=$PWD/.build/CR_Clang/bin/clang
export CXX=$PWD/.build/CR_Clang/bin/clang++
export CXXFLAGS="-nostdinc++ -D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS -isystem$PWD/.build/libcxx_headers/include -isystem$PWD/.build/libcxxabi_headers/include -fPIC -flto=thin -fsplit-lto-unit"
export CXXFLAGS="-nostdinc++ -D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS -D__NO_INLINE__ -isystem$PWD/.build/libcxx_headers/include -isystem$PWD/.build/libcxxabi_headers/include -fPIC -flto=thin -fsplit-lto-unit"
export LDFLAGS="-stdlib=libc++ -fuse-ld=lld -flto=thin -fsplit-lto-unit -L$PWD/.build/libcxx-objects -lc++abi"
fi
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
},
"dependencies": {
"@microsoft/applicationinsights-web": "^2.6.4",
"@parcel/watcher": "2.0.0",
"@vscode/sqlite3": "4.0.12",
"@vscode/vscode-languagedetection": "1.0.21",
"applicationinsights": "1.0.8",
Expand Down
1 change: 1 addition & 0 deletions remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@microsoft/applicationinsights-web": "^2.6.4",
"@parcel/watcher": "2.0.0",
"@vscode/vscode-languagedetection": "1.0.21",
"applicationinsights": "1.0.8",
"chokidar": "3.5.1",
Expand Down
18 changes: 18 additions & 0 deletions remote/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@
resolved "https://registry.yarnpkg.com/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.4.tgz#40e1c0ad20743fcee1604a7df2c57faf0aa1af87"
integrity sha512-Ot53G927ykMF8cQ3/zq4foZtdk+Tt1YpX7aUTHxBU7UHNdkEiBvBfZSq+rnlUmKCJ19VatwPG4mNzvcGpBj4og==

"@parcel/[email protected]":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.0.0.tgz#ebe992a4838b35c3da9a568eb95a71cb26ddf551"
integrity sha512-ByalKmRRXNNAhwZ0X1r0XeIhh1jG8zgdlvjgHk9ZV3YxiersEGNQkwew+RfqJbIL4gOJfvC2ey6lg5kaeRainw==
dependencies:
node-addon-api "^3.2.1"
node-gyp-build "^4.3.0"

"@tootallnate/once@1", "@tootallnate/once@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
Expand Down Expand Up @@ -444,11 +452,21 @@ node-addon-api@^3.0.2:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.1.0.tgz#98b21931557466c6729e51cb77cd39c965f42239"
integrity sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw==

node-addon-api@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161"
integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==

node-addon-api@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.2.0.tgz#117cbb5a959dff0992e1c586ae0393573e4d2a87"
integrity sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q==

node-gyp-build@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3"
integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==

[email protected]:
version "0.11.0-beta7"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.11.0-beta7.tgz#aed0888b5032d96c54d8473455e6adfae3bbebbe"
Expand Down
5 changes: 5 additions & 0 deletions src/vs/platform/environment/test/node/nativeModules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ suite('Native Modules (all platforms)', () => {
assert.ok(typeof nsfWatcher === 'function', testErrorMessage('nsfw'));
});

test('parcel', async () => {
const parcelWatcher = await import('@parcel/watcher');
assert.ok(typeof parcelWatcher.subscribe === 'function', testErrorMessage('parcel'));
});

test('sqlite3', async () => {
const sqlite3 = await import('@vscode/sqlite3');
assert.ok(typeof sqlite3.Database === 'function', testErrorMessage('@vscode/sqlite3'));
Expand Down
42 changes: 20 additions & 22 deletions src/vs/platform/files/node/diskFileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { createFileSystemProviderError, FileDeleteOptions, FileOpenOptions, File
import { readFileIntoStream } from 'vs/platform/files/common/io';
import { FileWatcher as NodeJSWatcherService } from 'vs/platform/files/node/watcher/nodejs/watcherService';
import { FileWatcher as NsfwWatcherService } from 'vs/platform/files/node/watcher/nsfw/watcherService';
import { FileWatcher as ParcelWatcherService } from 'vs/platform/files/node/watcher/parcel/watcherService';
import { FileWatcher as UnixWatcherService } from 'vs/platform/files/node/watcher/unix/watcherService';
import { IDiskFileChange, ILogMessage, IWatchRequest, toFileChanges } from 'vs/platform/files/node/watcher/watcher';
import { FileWatcher as WindowsWatcherService } from 'vs/platform/files/node/watcher/win32/watcherService';
Expand All @@ -36,7 +37,7 @@ export interface IWatcherOptions {
export interface IDiskFileSystemProviderOptions {
bufferSize?: number;
watcher?: IWatcherOptions;
enableLegacyRecursiveWatcher?: boolean;
legacyWatcher?: string;
}

export class DiskFileSystemProvider extends Disposable implements
Expand Down Expand Up @@ -532,7 +533,7 @@ export class DiskFileSystemProvider extends Disposable implements
private readonly _onDidChangeFile = this._register(new Emitter<readonly IFileChange[]>());
readonly onDidChangeFile = this._onDidChangeFile.event;

private recursiveWatcher: WindowsWatcherService | UnixWatcherService | NsfwWatcherService | undefined;
private recursiveWatcher: WindowsWatcherService | UnixWatcherService | NsfwWatcherService | ParcelWatcherService | undefined;
private readonly recursiveFoldersToWatch: IWatchRequest[] = [];
private recursiveWatchRequestDelayer = this._register(new ThrottledDelayer<void>(0));

Expand Down Expand Up @@ -577,7 +578,7 @@ export class DiskFileSystemProvider extends Disposable implements
private doRefreshRecursiveWatchers(): void {

// Reuse existing
if (this.recursiveWatcher instanceof NsfwWatcherService) {
if (this.recursiveWatcher instanceof NsfwWatcherService || this.recursiveWatcher instanceof ParcelWatcherService) {
this.recursiveWatcher.watch(this.recursiveFoldersToWatch);
}

Expand All @@ -597,7 +598,7 @@ export class DiskFileSystemProvider extends Disposable implements
onLogMessage: (msg: ILogMessage) => void,
verboseLogging: boolean,
watcherOptions?: IWatcherOptions
): WindowsWatcherService | UnixWatcherService | NsfwWatcherService
): WindowsWatcherService | UnixWatcherService | NsfwWatcherService | ParcelWatcherService
};

let watcherOptions: IWatcherOptions | undefined = undefined;
Expand All @@ -608,30 +609,27 @@ export class DiskFileSystemProvider extends Disposable implements
watcherOptions = this.options?.watcher;
}

// can use efficient watcher
else {

// Conditionally fallback to our legacy file watcher:
// - If provided as option from the outside (i.e. via settings)
// - Linux: until we support ignore patterns (unless insiders)
let enableLegacyWatcher: boolean;
if (this.options?.enableLegacyRecursiveWatcher) {
enableLegacyWatcher = true;
let enableLegacyWatcher = false;
if (this.options?.legacyWatcher === 'on' || this.options?.legacyWatcher === 'off') {
enableLegacyWatcher = this.options.legacyWatcher === 'on'; // setting always wins
} else {
enableLegacyWatcher = product.quality === 'stable' && isLinux;
if (product.quality === 'stable') {
// in stable use legacy for single folder workspaces
// TODO@bpasero remove me eventually
enableLegacyWatcher = this.recursiveFoldersToWatch.length === 1;
}
}

// Legacy Watcher
if (enableLegacyWatcher && this.recursiveFoldersToWatch.length === 1) {
if (isWindows) {
watcherImpl = WindowsWatcherService;
} else {
if (enableLegacyWatcher) {
if (isLinux) {
watcherImpl = UnixWatcherService;
} else {
watcherImpl = NsfwWatcherService;
}
}

// Standard Watcher
else {
watcherImpl = NsfwWatcherService;
} else {
watcherImpl = ParcelWatcherService;
}
}

Expand Down
Loading

0 comments on commit 85c5eb7

Please sign in to comment.