當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。