當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript WorkspaceConfiguration.get方法代碼示例

本文整理匯總了TypeScript中vscode.WorkspaceConfiguration.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript WorkspaceConfiguration.get方法的具體用法?TypeScript WorkspaceConfiguration.get怎麽用?TypeScript WorkspaceConfiguration.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vscode.WorkspaceConfiguration的用法示例。


在下文中一共展示了WorkspaceConfiguration.get方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: loadConfig

    /*-------------------------------------------------------------------------
     * Private Method
     *-----------------------------------------------------------------------*/
    private loadConfig() {
        const confDocomment: WorkspaceConfiguration = workspace.getConfiguration(Configuration.KEY_DOCOMMENT);
        const confEditor: WorkspaceConfiguration = workspace.getConfiguration(Configuration.KEY_EDITOR);

        this._config = new Configuration();
        this._config.activateOnEnter = confDocomment.get<boolean>(Configuration.ACTIVATE_ON_ENTER, false);
        this._config.insertSpaces = confEditor.get<boolean>(Configuration.INSERT_SPACES, false);
        this._config.tabSize = confEditor.get<number>(Configuration.TAB_SIZE, 4);
    }
開發者ID:ivanz,項目名稱:vscode-docomment,代碼行數:12,代碼來源:DocommentController.ts

示例2: computeConfiguration

 // Convert VS Code specific settings to a format acceptable by the server. Since
 // both client and server do use JSON the conversion is trivial.
 computeConfiguration(params: ConfigurationParams, _token: CancellationToken, _next: Function): any[] {
   if (!params.items) {
     return [];
   }
   let result: (IArgdownSettings | null)[] = [];
   for (let item of params.items) {
     // The server asks the client for configuration settings without a section
     // If a section is present we return null to indicate that the configuration
     // is not supported.
     if (item.section) {
       result.push(null);
       continue;
     }
     let config: WorkspaceConfiguration;
     if (item.scopeUri && this.client) {
       config = workspace.getConfiguration("argdown", this.client.protocol2CodeConverter.asUri(item.scopeUri));
     } else {
       config = workspace.getConfiguration("argdown");
     }
     result.push({
       configFile: config.get("configFile")
     });
   }
   return result;
 }
開發者ID:christianvoigt,項目名稱:argdown,代碼行數:27,代碼來源:LanguageServerConfiguration.ts

示例3: updateConfiguration

	public updateConfiguration(config: WorkspaceConfiguration): void {
		let newConfig = config.get('format', Configuration.def());

		if (!Configuration.equals(this.config, newConfig)) {
			this.config = newConfig;
			this.formatOptions = Object.create(null);
		}
	}
開發者ID:m-khosravi,項目名稱:vscode,代碼行數:8,代碼來源:formattingProvider.ts

示例4: readChannel

    /**
     * Tries to fetch the `rust-client.channel` configuration value. If missing,
     * falls back on active toolchain specified by rustup (at `rustupPath`),
     * finally defaulting to `nightly` if all fails.
     */
    private static readChannel(rustupPath: string, configuration: WorkspaceConfiguration, wsPath: string): string {
        const channel = configuration.get<string | null>('rust-client.channel', null);
        if (channel !== null) {
            return channel;
        } else {
            try {
                return getActiveChannel(rustupPath, wsPath);
            }
            // rustup might not be installed at the time the configuration is
            // initially loaded, so silently ignore the error and return a default value
            catch (e) {
                return 'nightly';
            }

        }
    }
開發者ID:digitaltoad,項目名稱:dotfiles,代碼行數:21,代碼來源:configuration.ts

示例5: nullToUndefined

	private getConfig<T>(key: string, defaultValue: T): NullAsUndefined<T> {
		return nullToUndefined(this.config.get<T>(key, defaultValue));
	}
開發者ID:DanTup,項目名稱:Dart-Code,代碼行數:3,代碼來源:config.ts

示例6: readRevealOutputChannelOn

 private static readRevealOutputChannelOn(configuration: WorkspaceConfiguration) {
     const setting = configuration.get<string>('rust-client.revealOutputChannelOn', 'never');
     return fromStringToRevealOutputChannelOn(setting);
 }
開發者ID:digitaltoad,項目名稱:dotfiles,代碼行數:4,代碼來源:configuration.ts

示例7:

	private getConfig<T>(key: string): T {
		return this.config.get<T>(key);
	}
開發者ID:ikhwanhayat,項目名稱:Dart-Code,代碼行數:3,代碼來源:config.ts

示例8: getTemplatesDir

 /**
  * Returns the templates directory location.
  * If no user configuration is found, the extension will look for
  * templates in USER_DATA_DIR/Code/FileTemplates.
  * Otherwise it will look for the path defined in the extension configuration.
  * @return {string}
  */
 public getTemplatesDir(): string {
     return this.config.get('templates_dir', this.getDefaultTemplatesDir());
 }
開發者ID:brpaz,項目名稱:vscode-file-templates-ext,代碼行數:10,代碼來源:templatesManager.ts

示例9:

workspace.onDidChangeConfiguration(e => {
	config = workspace.getConfiguration('format');
	onType = config.get<boolean>('onType', true);
	disabled = config.get<Array<string>>('disabled');
	workspaceDisabled = config.get<boolean>('workspaceDisabled', false);
});
開發者ID:TheColorRed,項目名稱:vscode-format,代碼行數:6,代碼來源:extension.ts

示例10: provideOnTypeFormattingEdits

import {
	workspace, DocumentFormattingEditProvider, Selection,
	OnTypeFormattingEditProvider, WorkspaceConfiguration,
	languages, ExtensionContext, TextEdit, Position, DocumentFilter,
	TextDocument, FormattingOptions, CancellationToken, Range,
	TextEditor, commands
} from 'vscode';

import { Format } from './format';

// Get global configuration settings
var config: WorkspaceConfiguration = workspace.getConfiguration('format');
var onType: boolean = config.get<boolean>('onType', true);
var disabled: Array<string> = config.get<Array<string>>('disabled');
var workspaceDisabled: boolean = config.get<boolean>('workspaceDisabled', false);

// Update the configuration settings if the configuration changes
workspace.onDidChangeConfiguration(e => {
	config = workspace.getConfiguration('format');
	onType = config.get<boolean>('onType', true);
	disabled = config.get<Array<string>>('disabled');
	workspaceDisabled = config.get<boolean>('workspaceDisabled', false);
});

workspace.onDidOpenTextDocument(document => {
	console.log(`Document Id: ${document.languageId}`);
})

// Format the code on type
class DocumentTypeFormat implements OnTypeFormattingEditProvider {
	public provideOnTypeFormattingEdits(document: TextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): Thenable<TextEdit[]> {
開發者ID:TheColorRed,項目名稱:vscode-format,代碼行數:31,代碼來源:extension.ts


注:本文中的vscode.WorkspaceConfiguration.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。