本文整理汇总了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;
}
示例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');
}
示例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);
}
示例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);
}
示例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;
}
示例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) + '';
}
});
示例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) + '';
}
});
示例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;
}
示例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;
}
示例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;
}