mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-07 07:16:41 +01:00
Introduce a --inspect-search CLI argument, and enter debug mode by default when built locally
This commit is contained in:
Vendored
+9
-2
@@ -38,8 +38,8 @@
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"protocol": "inspector",
|
||||
"name": "Attach to Search process",
|
||||
"port": 7890,
|
||||
"name": "Attach to Search Process",
|
||||
"port": 5876,
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/out/**/*.js"
|
||||
]
|
||||
@@ -177,6 +177,13 @@
|
||||
"Launch VS Code",
|
||||
"Attach to Main Process"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Search and Renderer processes",
|
||||
"configurations": [
|
||||
"Launch VS Code",
|
||||
"Attach to Search Process"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -28,9 +28,11 @@ export interface ParsedArgs {
|
||||
'extensions-dir'?: string;
|
||||
extensionDevelopmentPath?: string;
|
||||
extensionTestsPath?: string;
|
||||
debugPluginHost?: string;
|
||||
debugBrkPluginHost?: string;
|
||||
debugId?: string;
|
||||
debugPluginHost?: string;
|
||||
debugSearch?: string;
|
||||
debugBrkSearch?: string;
|
||||
'list-extensions'?: boolean;
|
||||
'show-versions'?: boolean;
|
||||
'install-extension'?: string | string[];
|
||||
@@ -42,6 +44,15 @@ export interface ParsedArgs {
|
||||
|
||||
export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');
|
||||
|
||||
export interface IDebugParams {
|
||||
port: number;
|
||||
break: boolean;
|
||||
}
|
||||
|
||||
export interface IExtensionHostDebugParams extends IDebugParams {
|
||||
debugId: string;
|
||||
}
|
||||
|
||||
export interface IEnvironmentService {
|
||||
_serviceBrand: any;
|
||||
|
||||
@@ -71,7 +82,8 @@ export interface IEnvironmentService {
|
||||
extensionDevelopmentPath: string;
|
||||
extensionTestsPath: string;
|
||||
|
||||
debugExtensionHost: { port: number; break: boolean; debugId: string };
|
||||
debugExtensionHost: IExtensionHostDebugParams;
|
||||
debugSearch: IDebugParams;
|
||||
|
||||
|
||||
logExtensionHostCommunication: boolean;
|
||||
|
||||
@@ -23,6 +23,8 @@ const options: minimist.Opts = {
|
||||
'debugId',
|
||||
'debugPluginHost',
|
||||
'debugBrkPluginHost',
|
||||
'debugSearch',
|
||||
'debugBrkSearch',
|
||||
'open-url',
|
||||
'enable-proposed-api'
|
||||
],
|
||||
@@ -60,6 +62,8 @@ const options: minimist.Opts = {
|
||||
'extensions-dir': 'extensionHomePath',
|
||||
'debugPluginHost': 'inspect-extensions',
|
||||
'debugBrkPluginHost': 'inspect-brk-extensions',
|
||||
'debugSearch': 'inspect-search',
|
||||
'debugBrkSearch': 'inspect-brk-search',
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { IEnvironmentService, ParsedArgs, IDebugParams, IExtensionHostDebugParams } from 'vs/platform/environment/common/environment';
|
||||
import * as crypto from 'crypto';
|
||||
import * as paths from 'vs/base/node/paths';
|
||||
import * as os from 'os';
|
||||
@@ -111,7 +111,10 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
get skipGettingStarted(): boolean { return this._args['skip-getting-started']; }
|
||||
|
||||
@memoize
|
||||
get debugExtensionHost(): { port: number; break: boolean; debugId: string } { return parseExtensionHostPort(this._args, this.isBuilt); }
|
||||
get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); }
|
||||
|
||||
@memoize
|
||||
get debugSearch(): IDebugParams { return parseSearchPort(this._args, this.isBuilt); }
|
||||
|
||||
get isBuilt(): boolean { return !process.env['VSCODE_DEV']; }
|
||||
get verbose(): boolean { return this._args.verbose; }
|
||||
@@ -160,11 +163,19 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
}
|
||||
}
|
||||
|
||||
export function parseExtensionHostPort(args: ParsedArgs, isBuild: boolean): { port: number; break: boolean; debugId: string } {
|
||||
const portStr = args.debugBrkPluginHost || args.debugPluginHost;
|
||||
const port = Number(portStr) || (!isBuild ? 5870 : null);
|
||||
const brk = port ? Boolean(!!args.debugBrkPluginHost) : false;
|
||||
return { port, break: brk, debugId: args.debugId };
|
||||
export function parseExtensionHostPort(args: ParsedArgs, isBuild: boolean): IExtensionHostDebugParams {
|
||||
return parseDebugPort(args.debugPluginHost, args.debugBrkPluginHost, 5870, isBuild, args.debugId);
|
||||
}
|
||||
|
||||
export function parseSearchPort(args: ParsedArgs, isBuild: boolean): IDebugParams {
|
||||
return parseDebugPort(args.debugSearch, args.debugBrkSearch, 5876, isBuild);
|
||||
}
|
||||
|
||||
export function parseDebugPort(debugArg: string, debugBrkArg: string, defaultBuildPort: number, isBuild: boolean, debugId?: string): IExtensionHostDebugParams {
|
||||
const portStr = debugBrkArg || debugArg;
|
||||
const port = Number(portStr) || (!isBuild ? defaultBuildPort : null);
|
||||
const brk = port ? Boolean(!!debugBrkArg) : false;
|
||||
return { port, break: brk, debugId };
|
||||
}
|
||||
|
||||
function parsePathArg(arg: string, process: NodeJS.Process): string {
|
||||
|
||||
@@ -10,7 +10,7 @@ import objects = require('vs/base/common/objects');
|
||||
import scorer = require('vs/base/common/scorer');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Client } from 'vs/base/parts/ipc/node/ipc.cp';
|
||||
import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp';
|
||||
import { IProgress, LineMatch, FileMatch, ISearchComplete, ISearchProgressItem, QueryType, IFileMatch, ISearchQuery, ISearchConfiguration, ISearchService, pathIncludedInQuery, ISearchResultProvider } from 'vs/platform/search/common/search';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -18,7 +18,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IRawSearch, IFolderSearch, ISerializedSearchComplete, ISerializedSearchProgressItem, ISerializedFileMatch, IRawSearchService } from './search';
|
||||
import { ISearchChannel, SearchChannelClient } from './searchIpc';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IEnvironmentService, IDebugParams } from 'vs/platform/environment/common/environment';
|
||||
import { ResourceMap } from 'vs/base/common/map';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
@@ -35,7 +35,7 @@ export class SearchService implements ISearchService {
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
this.diskSearch = new DiskSearch(!environmentService.isBuilt || environmentService.verbose);
|
||||
this.diskSearch = new DiskSearch(!environmentService.isBuilt || environmentService.verbose, /*timeout=*/undefined, environmentService.debugSearch);
|
||||
this.registerSearchResultProvider(this.diskSearch);
|
||||
}
|
||||
|
||||
@@ -212,25 +212,34 @@ export class DiskSearch implements ISearchResultProvider {
|
||||
|
||||
private raw: IRawSearchService;
|
||||
|
||||
constructor(verboseLogging: boolean, timeout: number = 60 * 60 * 1000) {
|
||||
constructor(verboseLogging: boolean, timeout: number = 60 * 60 * 1000, searchDebug?: IDebugParams) {
|
||||
const opts: IIPCOptions = {
|
||||
serverName: 'Search',
|
||||
timeout: timeout,
|
||||
args: ['--type=searchService'],
|
||||
// See https://github.com/Microsoft/vscode/issues/27665
|
||||
// Pass in fresh execArgv to the forked process such that it doesn't inherit them from `process.execArgv`.
|
||||
// e.g. Launching the extension host process with `--inspect-brk=xxx` and then forking a process from the extension host
|
||||
// results in the forked process inheriting `--inspect-brk=xxx`.
|
||||
freshExecArgv: true,
|
||||
env: {
|
||||
AMD_ENTRYPOINT: 'vs/workbench/services/search/node/searchApp',
|
||||
PIPE_LOGGING: 'true',
|
||||
VERBOSE_LOGGING: verboseLogging
|
||||
}
|
||||
};
|
||||
|
||||
if (searchDebug) {
|
||||
if (searchDebug.break && searchDebug.port) {
|
||||
opts.debugBrk = searchDebug.port;
|
||||
} else if (!searchDebug.break && searchDebug.port) {
|
||||
opts.debug = searchDebug.port;
|
||||
}
|
||||
}
|
||||
|
||||
const client = new Client(
|
||||
uri.parse(require.toUrl('bootstrap')).fsPath,
|
||||
{
|
||||
serverName: 'Search',
|
||||
timeout: timeout,
|
||||
args: ['--type=searchService'],
|
||||
// See https://github.com/Microsoft/vscode/issues/27665
|
||||
// Pass in fresh execArgv to the forked process such that it doesn't inherit them from `process.execArgv`.
|
||||
// e.g. Launching the extension host process with `--inspect-brk=xxx` and then forking a process from the extension host
|
||||
// results in the forked process inheriting `--inspect-brk=xxx`.
|
||||
freshExecArgv: true,
|
||||
env: {
|
||||
AMD_ENTRYPOINT: 'vs/workbench/services/search/node/searchApp',
|
||||
PIPE_LOGGING: 'true',
|
||||
VERBOSE_LOGGING: verboseLogging
|
||||
}
|
||||
}
|
||||
);
|
||||
opts);
|
||||
|
||||
const channel = getNextTickChannel(client.getChannel<ISearchChannel>('search'));
|
||||
this.raw = new SearchChannelClient(channel);
|
||||
|
||||
Reference in New Issue
Block a user