watcher - enable `nsfw` by default on macOS and Windows and add a setting to disable that (#132483)

上级 4f8e9699
......@@ -36,6 +36,7 @@ export interface IWatcherOptions {
export interface IDiskFileSystemProviderOptions {
bufferSize?: number;
watcher?: IWatcherOptions;
enableLegacyRecursiveWatcher?: boolean;
}
export class DiskFileSystemProvider extends Disposable implements
......@@ -609,8 +610,18 @@ export class DiskFileSystemProvider extends Disposable implements
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;
} else {
enableLegacyWatcher = product.quality === 'stable' && isLinux;
}
// Single Folder Watcher (stable only)
if (product.quality === 'stable' && this.recursiveFoldersToWatch.length === 1) {
if (enableLegacyWatcher && this.recursiveFoldersToWatch.length === 1) {
if (isWindows) {
watcherImpl = WindowsWatcherService;
} else {
......
......@@ -101,6 +101,7 @@ export class NsfwWatcherService extends Disposable implements IWatcherService {
// - the path uses wrong casing
// - the path is a symbolic link
// We have to detect this case and massage the events to correct this.
// Note: Other platforms do not seem to have these path issues.
let realBasePathDiffers = false;
let realBasePathLength = request.path.length;
if (isMacintosh) {
......
......@@ -289,6 +289,8 @@ export interface INativeWindowConfiguration extends IWindowConfiguration, Native
maximized?: boolean;
accessibilitySupport?: boolean;
enableLegacyRecursiveWatcher?: boolean; // TODO@bpasero remove me once watcher is settled
perfMarks: PerformanceMark[];
filesToWait?: IPathsToWaitFor;
......
......@@ -1255,6 +1255,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
os: { release: release(), hostname: hostname() },
zoomLevel: typeof windowConfig?.zoomLevel === 'number' ? windowConfig.zoomLevel : undefined,
enableLegacyRecursiveWatcher: this.configurationService.getValue('files.legacyWatcher'),
autoDetectHighContrast: windowConfig?.autoDetectHighContrast ?? true,
accessibilitySupport: app.accessibilitySupportEnabled,
colorScheme: {
......
......@@ -17,7 +17,7 @@ import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/file
import { BinaryFileEditor } from 'vs/workbench/contrib/files/browser/editors/binaryFileEditor';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { isNative, isWeb, isWindows } from 'vs/base/common/platform';
import { isLinux, isNative, isWeb, isWindows } from 'vs/base/common/platform';
import { ExplorerViewletViewsContribution } from 'vs/workbench/contrib/files/browser/explorerViewlet';
import { IEditorPaneRegistry, EditorPaneDescriptor } from 'vs/workbench/browser/editor';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
......@@ -34,6 +34,7 @@ import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { IExplorerService } from 'vs/workbench/contrib/files/browser/files';
import { FileEditorInputSerializer, FileEditorWorkingCopyEditorHandler } from 'vs/workbench/contrib/files/browser/editors/fileEditorHandler';
import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry';
import product from 'vs/platform/product/common/product';
class FileUriLabelContribution implements IWorkbenchContribution {
......@@ -247,6 +248,11 @@ configurationRegistry.registerConfiguration({
'markdownDescription': nls.localize('watcherExclude', "Configure glob patterns of file paths to exclude from file watching. Patterns must match on absolute paths, i.e. prefix with `**/` or the full path to match properly and suffix with `/**` to match files within a path (for example `**/build/output/**` or `/Users/name/workspaces/project/build/output/**`). Changing this setting requires a restart. When you experience Code consuming lots of CPU time on startup, you can exclude large folders to reduce the initial load."),
'scope': ConfigurationScope.RESOURCE
},
'files.legacyWatcher': {
'type': 'boolean',
'default': product.quality === 'stable' && isLinux,
'description': nls.localize('legacyWatcher', "Controls the mechanism used for file watching. Only change this when you see issues related to file watching."),
},
'files.hotExit': hotExitConfiguration,
'files.defaultLanguage': {
'type': 'string',
......
......@@ -25,7 +25,8 @@ interface IConfiguration extends IWindowsConfiguration {
update: { mode: string; };
debug: { console: { wordWrap: boolean } };
editor: { accessibilitySupport: 'on' | 'off' | 'auto' };
security: { workspace: { trust: { enabled: boolean } } }
security: { workspace: { trust: { enabled: boolean } } };
files: { legacyWatcher: boolean };
}
export class SettingsChangeRelauncher extends Disposable implements IWorkbenchContribution {
......@@ -37,6 +38,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
private updateMode: string | undefined;
private accessibilitySupport: 'on' | 'off' | 'auto' | undefined;
private workspaceTrustEnabled: boolean | undefined;
private legacyFileWatcher: boolean | undefined = undefined;
constructor(
@IHostService private readonly hostService: IHostService,
......@@ -98,6 +100,12 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
this.workspaceTrustEnabled = config.security.workspace.trust.enabled;
changed = true;
}
// Legacy File Watcher
if (typeof config.files?.legacyWatcher === 'boolean' && config.files.legacyWatcher !== this.legacyFileWatcher) {
this.legacyFileWatcher = config.files.legacyWatcher;
changed = true;
}
}
// Notify only when changed and we are the focused window (avoids notification spam across windows)
......
......@@ -26,7 +26,7 @@ class DesktopMain extends SharedDesktopMain {
protected registerFileSystemProviders(environmentService: INativeWorkbenchEnvironmentService, fileService: IFileService, logService: ILogService, nativeHostService: INativeHostService): void {
// Local Files
const diskFileSystemProvider = this._register(new DiskFileSystemProvider(logService, nativeHostService));
const diskFileSystemProvider = this._register(new DiskFileSystemProvider(logService, nativeHostService, { enableLegacyRecursiveWatcher: this.configuration.enableLegacyRecursiveWatcher }));
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
// User Data Provider
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册