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


TypeScript ServicesAccessor.get方法代码示例

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


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

示例1: 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.pickFileAndOpen({ forceNewWindow: true, dialogOptions: { defaultPath: fileResource ? paths.dirname(fileResource.fsPath) : void 0 } });
};
开发者ID:armanio123,项目名称:vscode,代码行数:8,代码来源:fileCommands.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:diarmaidm,项目名称:vscode,代码行数:8,代码来源:fileCommands.ts

示例3: 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:liunian,项目名称:vscode,代码行数:8,代码来源:workspaceCommands.ts

示例4:

	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

示例5: 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

示例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: 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

示例8: 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

示例9: 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

示例10: getWebViewEditor

	private getWebViewEditor(accessor: ServicesAccessor): WebviewEditor {
		const activeEditor = accessor.get(IWorkbenchEditorService).getActiveEditor() as WebviewEditor;
		if (activeEditor.isWebviewEditor) {
			return activeEditor;
		}
		return null;
	}
开发者ID:elibarzilay,项目名称:vscode,代码行数:7,代码来源:webviewEditor.ts


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