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


TypeScript IConfigurationService.getConfiguration方法代码示例

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


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

示例1: getFontFamily

	/**
	 * Set the terminal font to `terminal.integrated.fontFamily` if it is set, otherwise fallback to
	 * `editor.fontFamily`.
	 */
	public getFontFamily(): string {
		let terminalConfig = this.configurationService.getConfiguration<ITerminalConfiguration>();
		let fontFamily = terminalConfig.terminal.integrated.fontFamily;
		if (!fontFamily) {
			let editorConfig = this.configurationService.getConfiguration<IConfiguration>();
			fontFamily = editorConfig.editor.fontFamily;
		}
		return fontFamily;
	}
开发者ID:CPoirot3,项目名称:vscode,代码行数:13,代码来源:terminalConfigHelper.ts

示例2: getFont

	/**
	 * Gets the font information based on the terminal.integrated.fontFamily,
	 * terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties
	 */
	public getFont(): ITerminalFont {
		let terminalConfig = this.configurationService.getConfiguration<ITerminalConfiguration>().terminal.integrated;
		let editorConfig = this.configurationService.getConfiguration<IConfiguration>();

		let fontFamily = terminalConfig.fontFamily || editorConfig.editor.fontFamily;
		let fontSize = this.toInteger(terminalConfig.fontSize, 0) || editorConfig.editor.fontSize;
		let lineHeight = this.toInteger(terminalConfig.lineHeight, 0);

		return this.measureFont(fontFamily, fontSize + 'px', lineHeight === 0 ? 'normal' : lineHeight + 'px');
	}
开发者ID:simgish,项目名称:vscode,代码行数:14,代码来源:terminalConfigHelper.ts

示例3: getFont

	/**
	 * Gets the font information based on the terminal.integrated.fontFamily,
	 * terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties
	 */
	public getFont(): ITerminalFont {
		let terminalConfig = this.configurationService.getConfiguration<ITerminalConfiguration>().terminal.integrated;
		let editorConfig = this.configurationService.getConfiguration<IConfiguration>();

		let fontFamily = terminalConfig.fontFamily || editorConfig.editor.fontFamily;
		let fontSize = this.toInteger(terminalConfig.fontSize, 0) || editorConfig.editor.fontSize;
		if (fontSize <= 0) {
			fontSize = DefaultConfig.editor.fontSize;
		}
		let lineHeight = this.toInteger(terminalConfig.lineHeight, DEFAULT_LINE_HEIGHT);

		return this.measureFont(fontFamily, fontSize, lineHeight <= 0 ? DEFAULT_LINE_HEIGHT : lineHeight);
	}
开发者ID:bobmagicii,项目名称:vscode,代码行数:17,代码来源:terminalConfigHelper.ts

示例4: getFont

	/**
	 * Gets the font information based on the terminal.integrated.fontFamily,
	 * terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties
	 */
	public getFont(): ITerminalFont {
		let terminalConfig = this.configurationService.getConfiguration<ITerminalConfiguration>().terminal.integrated;
		let editorConfig = this.configurationService.getConfiguration<IConfiguration>();

		let fontFamily = terminalConfig.fontFamily || editorConfig.editor.fontFamily;
		let fontSize = this.toInteger(terminalConfig.fontSize, 0) || editorConfig.editor.fontSize;
		let lineHeight = this.toInteger(terminalConfig.lineHeight, 0) || editorConfig.editor.lineHeight;

		if (lineHeight === 0) {
			lineHeight = Math.round(GOLDEN_LINE_HEIGHT_RATIO * fontSize);
		}

		return this.neasureFont(fontFamily, fontSize, lineHeight);
	}
开发者ID:caozhaocao,项目名称:vscode,代码行数:18,代码来源:terminalConfigHelper.ts

示例5: applyOverrides

export function applyOverrides(configurationService: IConfigurationService, experiments: ITelemetryExperiments): ITelemetryExperiments {
	const config: any = configurationService.getConfiguration('telemetry');
	const experimentsConfig = config && config.experiments || {};
	Object.keys(experiments).forEach(key => {
		if (key in experimentsConfig) {
			experiments[key] = experimentsConfig[key];
		}
	});
	return experiments;
}
开发者ID:asotog,项目名称:vscode,代码行数:10,代码来源:telemetry.ts

示例6: Function

		return value.replace(regexp, (match: string, name: string) => {
			let config = this.configurationService.getConfiguration();
			let newValue = new Function('_', 'try {return _.' + name + ';} catch (ex) { return "";}')(config);
			if (Types.isString(newValue)) {
				// Prevent infinite recursion and also support nested references (or tokens)
				return newValue === originalValue ? '' : this.resolveString(newValue);
			} else {
				return this.resolve(newValue) + '';
			}
		});
开发者ID:GYGit,项目名称:vscode,代码行数:10,代码来源:configVariables.ts

示例7: Function

		return value.replace(regexp, (match: string, name: string) => {
			let config = this.configurationService.getConfiguration();
			let newValue = new Function('_', 'try {return _.' + name + ';} catch (ex) { return "";}')(config);
			if (Types.isString(newValue)) {
				return newValue;
			}
			else {
				return this.resolve(newValue) + '';
			}
		});
开发者ID:1Hgm,项目名称:vscode,代码行数:10,代码来源:configVariables.ts

示例8: getShell

	public getShell(): string {
		let config = this.configurationService.getConfiguration<ITerminalConfiguration>();
		if (this.platform === Platform.Windows) {
			return config.terminal.integrated.shell.windows;
		}
		if (this.platform === Platform.Mac) {
			return config.terminal.integrated.shell.osx;
		}
		return config.terminal.integrated.shell.linux;
	}
开发者ID:caozhaocao,项目名称:vscode,代码行数:10,代码来源:terminalConfigHelper.ts

示例9: getShell

	public getShell(): IShell {
		let config = this.configurationService.getConfiguration<ITerminalConfiguration>();
		let shell: IShell = {
			executable: '',
			args: []
		};
		if (this.platform === Platform.Windows) {
			shell.executable = config.terminal.integrated.shell.windows;
		} else if (this.platform === Platform.Mac) {
			shell.executable = config.terminal.integrated.shell.osx;
			shell.args = config.terminal.integrated.shellArgs.osx;
		} else if (this.platform === Platform.Linux) {
			shell.executable = config.terminal.integrated.shell.linux;
			shell.args = config.terminal.integrated.shellArgs.linux;
		}
		return shell;
	}
开发者ID:simgish,项目名称:vscode,代码行数:17,代码来源:terminalConfigHelper.ts

示例10: prepareCommand

	private static prepareCommand(args: DebugProtocol.RunInTerminalRequestArguments, configurationService: IConfigurationService): string {

		// get the shell configuration for the current platform
		let shell: string;
		const shell_config = configurationService.getConfiguration<IIntegratedTerminalConfiguration>().terminal.integrated.shell;
		if (platform.isWindows) {
			shell = shell_config.windows;
		} else if (platform.isLinux) {
			shell = shell_config.linux;
		} else if (platform.isMacintosh) {
			shell = shell_config.osx;
		}

		shell = shell.toLowerCase();

		let command = '';
		if (shell.indexOf('powershell') >= 0) {

			const quote = (s: string) => {
				s = s.replace(/\'/g, '\'\'');
				return s.indexOf(' ') >= 0 || s.indexOf('\'') >= 0 || s.indexOf('"') >= 0 ? `'${s}'` : s;
			};

			if (args.cwd) {
				command += `cd '${args.cwd}'; `;
			}
			if (args.env) {
				for (let key in args.env) {
					command += `$env:${key}='${args.env[key]}'; `;
				}
			}
			for (let a of args.args) {
				command += `${quote(a)} `;
			}

		} else if (shell.indexOf('cmd.exe') >= 0) {

			const quote = (s: string) => {
				s = s.replace(/\"/g, '""');
				return (s.indexOf(' ') >= 0 || s.indexOf('"') >= 0) ? `"${s}"` : s;
			};

			if (args.cwd) {
				command += `cd ${quote(args.cwd)} && `;
			}
			if (args.env) {
				command += 'cmd /C "';
				for (let key in args.env) {
					command += `set "${key}=${args.env[key]}" && `;
				}
			}
			for (let a of args.args) {
				command += `${quote(a)} `;
			}
			if (args.env) {
				command += '"';
			}

		} else {
			// fallback: unix shell

			const quote = (s: string) => {
				s = s.replace(/\"/g, '\\"');
				return s.indexOf(' ') >= 0 ? `"${s}"` : s;
			};

			if (args.cwd) {
				command += `cd ${quote(args.cwd)} ; `;
			}
			if (args.env) {
				command += 'env';
				for (let key in args.env) {
					command += ` ${quote(key + '=' + args.env[key])}`;
				}
				command += ' ';
			}
			for (let a of args.args) {
				command += `${quote(a)} `;
			}

		}

		return command;
	}
开发者ID:asotog,项目名称:vscode,代码行数:84,代码来源:terminalSupport.ts


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