当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript instantiation.ServicesAccessor类代码示例

本文整理汇总了TypeScript中vs/platform/instantiation/common/instantiation.ServicesAccessor的典型用法代码示例。如果您正苦于以下问题:TypeScript ServicesAccessor类的具体用法?TypeScript ServicesAccessor怎么用?TypeScript ServicesAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ServicesAccessor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: services

function services(accessor: ServicesAccessor): { windowService: IWindowService, historyService: IHistoryService, contextService: IWorkspaceContextService, environmentService: IEnvironmentService } {
	return {
		windowService: accessor.get(IWindowService),
		historyService: accessor.get(IHistoryService),
		contextService: accessor.get(IWorkspaceContextService),
		environmentService: accessor.get(IEnvironmentService)
	};
}
开发者ID:AllureFer,项目名称:vscode,代码行数:8,代码来源:workspaceCommands.ts

示例2: toResource

export const openFileInNewWindowCommand = (accessor: ServicesAccessor) => {
	const windowService = accessor.get(IWindowService);
	const editorService = accessor.get(IWorkbenchEditorService);

	const fileResource = toResource(editorService.getActiveEditorInput(), { supportSideBySide: true, filter: 'file' });

	windowService.openFilePicker(true, fileResource ? paths.dirname(fileResource.fsPath) : void 0);
};
开发者ID:FabianLauer,项目名称:vscode,代码行数:8,代码来源:fileCommands.ts

示例3:

	handler: (accessor: ServicesAccessor) => {
		let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
		let instantiationService: IInstantiationService = accessor.get(IInstantiationService);
		let connectionService: IConnectionManagementService = accessor.get(IConnectionManagementService);
		let objectExplorerService: IObjectExplorerService = accessor.get(IObjectExplorerService);

		let connectionProfile = TaskUtilities.getCurrentGlobalConnection(objectExplorerService, connectionService, editorService);
		let profilerInput = instantiationService.createInstance(ProfilerInput, connectionProfile);
		return editorService.openEditor(profilerInput, { pinned: true }, false).then(() => TPromise.as(true));
	}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:10,代码来源:profilerActions.contribution.ts

示例4: getOutOfWorkspaceEditorResources

export function getOutOfWorkspaceEditorResources(accessor: ServicesAccessor): URI[] {
	const editorService = accessor.get(IEditorService);
	const contextService = accessor.get(IWorkspaceContextService);
	const fileService = accessor.get(IFileService);

	const resources = editorService.editors
		.map(editor => toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }))
		.filter(resource => !!resource && !contextService.isInsideWorkspace(resource) && fileService.canHandleResource(resource));

	return resources as URI[];
}
开发者ID:PKRoma,项目名称:vscode,代码行数:11,代码来源:search.ts

示例5: getMultiSelectedResources

const revealInOSHandler = (accessor: ServicesAccessor, resource: URI) => {
	// Without resource, try to look at the active editor
	const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));

	if (resources.length) {
		const windowsService = accessor.get(IWindowsService);
		sequence(resources.map(r => () => windowsService.showItemInFolder(paths.normalize(r.fsPath, true))));
	} else {
		const messageService = accessor.get(IMessageService);
		messageService.show(severity.Info, nls.localize('openFileToReveal', "Open a file first to reveal"));
	}
};
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:12,代码来源:fileCommands.ts

示例6: getResourceForCommand

const revealInOSHandler = (accessor: ServicesAccessor, resource: URI) => {
	// Without resource, try to look at the active editor
	resource = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));

	if (resource) {
		const windowsService = accessor.get(IWindowsService);
		windowsService.showItemInFolder(paths.normalize(resource.fsPath, true));
	} else {
		const messageService = accessor.get(IMessageService);
		messageService.show(severity.Info, nls.localize('openFileToReveal', "Open a file first to reveal"));
	}
};
开发者ID:servicesgpr,项目名称:vscode,代码行数:12,代码来源:fileCommands.ts

示例7: function

CommandsRegistry.registerCommand('_workbench.previewHtml', function (
	accessor: ServicesAccessor,
	resource: URI | string,
	position?: EditorViewColumn,
	label?: string
) {
	const uri = resource instanceof URI ? resource : URI.parse(resource);
	label = label || uri.fsPath;

	let input: HtmlInput;

	const editorGroupService = accessor.get(IEditorGroupsService);

	let targetGroup: IEditorGroup = editorGroupService.getGroup(viewColumnToEditorGroup(editorGroupService, position));
	if (!targetGroup) {
		targetGroup = editorGroupService.activeGroup;
	}

	// Find already opened HTML input if any
	if (targetGroup) {
		const editors = targetGroup.editors;
		for (let i = 0; i < editors.length; i++) {
			const editor = editors[i];
			const editorResource = editor.getResource();
			if (editor instanceof HtmlInput && editorResource && editorResource.toString() === resource.toString()) {
				input = editor;
				break;
			}
		}
	}

	const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);

	const inputOptions: HtmlInputOptions = {
		allowScripts: true,
		allowSvgs: true,
		svgWhiteList: extensionsWorkbenchService.allowedBadgeProviders
	};

	// Otherwise, create new input and open it
	if (!input) {
		input = accessor.get(IInstantiationService).createInstance(HtmlInput, label, '', uri, inputOptions);
	} else {
		input.setName(label); // make sure to use passed in label
	}

	return accessor.get(IEditorService)
		.openEditor(input, { pinned: true }, viewColumnToEditorGroup(editorGroupService, position))
		.then(editor => true);
});
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:50,代码来源:html.contribution.ts

示例8: loadExperiments

export function loadExperiments(accessor?: ServicesAccessor): ITelemetryExperiments {

	// shortcut since there are currently no experiments (should introduce separate service to load only once)
	if (!accessor) {
		return {};
	}

	const storageService = accessor.get(IStorageService);
	const configurationService = accessor.get(IConfigurationService);

	let {
	} = splitExperimentsRandomness(storageService);

	return applyOverrides(defaultExperiments, configurationService);
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:15,代码来源:experiments.ts

示例9: listFocusLast

function listFocusLast(accessor: ServicesAccessor, options?: { fromFocused: boolean }): void {
	const focused = accessor.get(IListService).lastFocusedList;

	// Ensure DOM Focus
	ensureDOMFocus(focused);

	// List
	if (focused instanceof List || focused instanceof PagedList) {
		const list = focused;

		list.setFocus([list.length - 1]);
		list.reveal(list.length - 1);
	}

	// ObjectTree
	else if (focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
		const tree = focused;
		const fakeKeyboardEvent = new KeyboardEvent('keydown');
		tree.focusLast(fakeKeyboardEvent);

		const focus = tree.getFocus();

		if (focus.length > 0) {
			tree.reveal(focus[0]);
		}
	}

	// Tree
	else if (focused) {
		const tree = focused;

		tree.focusLast({ origin: 'keyboard' }, options && options.fromFocused ? tree.getFocus() : undefined);
		tree.reveal(tree.getFocus());
	}
}
开发者ID:eamodio,项目名称:vscode,代码行数:35,代码来源:listCommands.ts

示例10: function

	CommandsRegistry.registerCommand('_workbench.removeFromRecentlyOpened', function (accessor: ServicesAccessor, path: string) {
		const windowsService = accessor.get(IWindowsService);

		return windowsService.removeFromRecentlyOpened([path]).then(() => {
			return void 0;
		});
	});
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:7,代码来源:commands.ts


注:本文中的vs/platform/instantiation/common/instantiation.ServicesAccessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。