提交 8f18471e 编写于 作者: B Benjamin Pasero

introduce debugBrkFileWatcherPort (for #5819)

上级 3b300f7f
......@@ -123,6 +123,7 @@ export interface IEnvironment {
disableExtensions: boolean;
logExtensionHostCommunication: boolean;
debugBrkFileWatcherPort: number;
verboseLogging: boolean;
enablePerformance: boolean;
......
......@@ -20,6 +20,7 @@ export interface ParsedArgs extends minimist.ParsedArgs {
performance: boolean;
verbose: boolean;
logExtensionHostCommunication: boolean;
debugBrkFileWatcherPort: string;
'disable-extensions': boolean;
extensionHomePath: string;
extensionDevelopmentPath: string;
......
......@@ -28,6 +28,7 @@ export interface ICommandLineArguments {
verboseLogging: boolean;
debugExtensionHostPort: number;
debugBrkExtensionHost: boolean;
debugBrkFileWatcherPort: number;
logExtensionHostCommunication: boolean;
disableExtensions: boolean;
extensionsHomePath: string;
......@@ -169,6 +170,7 @@ export class EnvService implements IEnvironmentService {
const debugExtensionHostPort = getNumericValue(argv.debugPluginHost, 5870, this.isBuilt ? void 0 : 5870);
const pathArguments = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
const timestamp = parseInt(argv.timestamp);
const debugBrkFileWatcherPort = getNumericValue(argv.debugBrkFileWatcherPort, void 0);
this._cliArgs = Object.freeze({
pathArguments: pathArguments,
......@@ -178,6 +180,7 @@ export class EnvService implements IEnvironmentService {
debugExtensionHostPort: debugBrkExtensionHostPort || debugExtensionHostPort,
debugBrkExtensionHost: !!debugBrkExtensionHostPort,
logExtensionHostCommunication: argv.logExtensionHostCommunication,
debugBrkFileWatcherPort: debugBrkFileWatcherPort,
openNewWindow: argv['new-window'],
openInSameWindow: argv['reuse-window'],
gotoLineMode: argv.goto,
......
......@@ -403,6 +403,7 @@ export class VSCodeWindow {
if (this.isPluginDevelopmentHost && cli) {
configuration.verboseLogging = cli.verboseLogging;
configuration.logExtensionHostCommunication = cli.logExtensionHostCommunication;
configuration.debugBrkFileWatcherPort = cli.debugBrkFileWatcherPort;
configuration.debugExtensionHostPort = cli.debugExtensionHostPort;
configuration.debugBrkExtensionHost = cli.debugBrkExtensionHost;
configuration.extensionsHomePath = cli.extensionsHomePath;
......
......@@ -918,6 +918,7 @@ export class WindowsManager implements IWindowsService {
configuration.extensionDevelopmentPath = currentWindowConfig.extensionDevelopmentPath;
configuration.verboseLogging = currentWindowConfig.verboseLogging;
configuration.logExtensionHostCommunication = currentWindowConfig.logExtensionHostCommunication;
configuration.debugBrkFileWatcherPort = currentWindowConfig.debugBrkFileWatcherPort;
configuration.debugBrkExtensionHost = currentWindowConfig.debugBrkExtensionHost;
configuration.debugExtensionHostPort = currentWindowConfig.debugExtensionHostPort;
configuration.extensionsHomePath = currentWindowConfig.extensionsHomePath;
......
......@@ -41,10 +41,11 @@ export class FileService implements IFileService {
private messageService: IMessageService
) {
const configuration = this.configurationService.getConfiguration<IFilesConfiguration>();
const env = this.contextService.getConfiguration().env;
// adjust encodings (TODO@Ben knowledge on settings location ('.vscode') is hardcoded)
let encodingOverride: IEncodingOverride[] = [];
encodingOverride.push({ resource: uri.file(this.contextService.getConfiguration().env.appSettingsHome), encoding: encoding.UTF8 });
encodingOverride.push({ resource: uri.file(env.appSettingsHome), encoding: encoding.UTF8 });
if (this.contextService.getWorkspace()) {
encodingOverride.push({ resource: uri.file(paths.join(this.contextService.getWorkspace().resource.fsPath, '.vscode')), encoding: encoding.UTF8 });
}
......@@ -60,9 +61,14 @@ export class FileService implements IFileService {
encoding: configuration.files && configuration.files.encoding,
encodingOverride: encodingOverride,
watcherIgnoredPatterns: watcherIgnoredPatterns,
verboseLogging: this.contextService.getConfiguration().env.verboseLogging
verboseLogging: env.verboseLogging,
debugBrkFileWatcherPort: env.debugBrkFileWatcherPort
};
if (typeof env.debugBrkFileWatcherPort === 'number') {
console.warn(`File Watcher STOPPED on first line for debugging on port ${env.debugBrkFileWatcherPort}`);
}
// create service
let workspace = this.contextService.getWorkspace();
this.raw = new NodeFileService(workspace ? workspace.resource.fsPath : void 0, fileServiceConfig, this.eventService);
......
......@@ -47,6 +47,7 @@ export interface IFileServiceOptions {
watcherIgnoredPatterns?: string[];
disableWatcher?: boolean;
verboseLogging?: boolean;
debugBrkFileWatcherPort?: number;
}
function etag(stat: fs.Stats): string;
......@@ -128,7 +129,7 @@ export class FileService implements files.IFileService {
}
private setupUnixWorkspaceWatching(): void {
this.workspaceWatcherToDispose = new UnixWatcherService(this.basePath, this.options.watcherIgnoredPatterns, this.eventEmitter, this.options.errorLogger, this.options.verboseLogging).startWatching();
this.workspaceWatcherToDispose = new UnixWatcherService(this.basePath, this.options.watcherIgnoredPatterns, this.eventEmitter, this.options.errorLogger, this.options.verboseLogging, this.options.debugBrkFileWatcherPort).startWatching();
}
public resolveFile(resource: uri, options?: files.IResolveFileOptions): TPromise<files.IFileStat> {
......
......@@ -24,18 +24,24 @@ export class FileWatcher {
private ignored: string[],
private eventEmitter: IEventService,
private errorLogger: (msg: string) => void,
private verboseLogging: boolean)
{
private verboseLogging: boolean,
private debugBrkFileWatcherPort: number
) {
this.isDisposed = false;
this.restartCounter = 0;
}
public startWatching(): () => void {
const args = ['--type=watcherService'];
if (typeof this.debugBrkFileWatcherPort === 'number') {
args.push(`--debug-brk=${this.debugBrkFileWatcherPort}`);
}
const client = new Client(
uri.parse(require.toUrl('bootstrap')).fsPath,
{
serverName: 'Watcher',
args: ['--type=watcherService'],
args,
env: {
AMD_ENTRYPOINT: 'vs/workbench/services/files/node/watcher/unix/watcherApp',
PIPE_LOGGING: 'true',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册