本文整理汇总了TypeScript中vscode-nls.config函数的典型用法代码示例。如果您正苦于以下问题:TypeScript config函数的具体用法?TypeScript config怎么用?TypeScript config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: activate
export function activate(context: ExtensionContext): void {
nls.config({locale: env.language});
let MODE_ID_TS = 'typescript';
let MODE_ID_TSX = 'typescriptreact';
let MODE_ID_JS = 'javascript';
let MODE_ID_JSX = 'javascriptreact';
let clientHost = new TypeScriptServiceClientHost();
let client = clientHost.serviceClient;
context.subscriptions.push(commands.registerCommand('typescript.reloadProjects', () => {
clientHost.reloadProjects();
}));
context.subscriptions.push(commands.registerCommand('javascript.reloadProjects', () => {
clientHost.reloadProjects();
}));
window.onDidChangeActiveTextEditor(VersionStatus.showHideStatus, null, context.subscriptions);
// Register the supports for both TS and TSX so that we can have separate grammars but share the mode
client.onReady().then(() => {
registerSupports(MODE_ID_TS, clientHost, client);
registerSupports(MODE_ID_TSX, clientHost, client);
registerSupports(MODE_ID_JS, clientHost, client);
registerSupports(MODE_ID_JSX, clientHost, client);
}, () => {
// Nothing to do here. The client did show a message;
});
}
示例2: activate
export function activate(context: ExtensionContext): any {
nls.config({locale: env.language});
// add providers
context.subscriptions.push(languages.registerCompletionItemProvider('php', new PHPCompletionItemProvider(), '.', '$'));
context.subscriptions.push(languages.registerHoverProvider('php', new PHPHoverProvider()));
context.subscriptions.push(languages.registerSignatureHelpProvider('php', new PHPSignatureHelpProvider(), '(', ','));
let validator = new PHPValidationProvider();
validator.activate(context.subscriptions);
// need to set in the extension host as well as the completion provider uses it.
languages.setLanguageConfiguration('php', {
wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
__characterPairSupport: {
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"', notIn: ['string'] },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] }
]
}
});
}
示例3: activate
export function activate(context: ExtensionContext): any {
nls.config({ locale: env.language });
configureHttpRequest();
workspace.onDidChangeConfiguration(e => configureHttpRequest());
context.subscriptions.push(addJSONProviders(httpRequest.xhr));
}
示例4: activate
export function activate(context: ExtensionContext): any {
nls.config({locale: env.language});
// add providers
context.subscriptions.push(languages.registerCompletionItemProvider('php', new PHPCompletionItemProvider(), '.', '$'));
context.subscriptions.push(languages.registerHoverProvider('php', new PHPHoverProvider()));
context.subscriptions.push(languages.registerSignatureHelpProvider('php', new PHPSignatureHelpProvider(), '(', ','));
let validator = new PHPValidationProvider();
validator.activate(context.subscriptions);
// need to set in the extension host as well as the completion provider uses it.
languages.setLanguageConfiguration('php', {
wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
});
}
示例5: activate
export function activate(context: ExtensionContext): void {
nls.config({locale: env.language});
let MODE_ID_TS = 'typescript';
let MODE_ID_TSX = 'typescriptreact';
let MODE_ID_JS = 'javascript';
let MODE_ID_JSX = 'javascriptreact';
let clientHost = new TypeScriptServiceClientHost([
{
id: 'typescript',
diagnosticSource: 'ts',
modeIds: [MODE_ID_TS, MODE_ID_TSX]
},
{
id: 'javascript',
diagnosticSource: 'js',
modeIds: [MODE_ID_JS, MODE_ID_JSX]
}
]);
let client = clientHost.serviceClient;
context.subscriptions.push(commands.registerCommand('typescript.reloadProjects', () => {
clientHost.reloadProjects();
}));
context.subscriptions.push(commands.registerCommand('javascript.reloadProjects', () => {
clientHost.reloadProjects();
}));
window.onDidChangeActiveTextEditor(VersionStatus.showHideStatus, null, context.subscriptions);
client.onReady().then(() => {
context.subscriptions.push(ProjectStatus.create(client,
path => new Promise(resolve => setTimeout(() => resolve(clientHost.handles(path)), 750)),
context.workspaceState));
}, () => {
// Nothing to do here. The client did show a message;
});
}
示例6: init
'use strict';
import { ExtensionContext, workspace, window, Disposable } from 'vscode';
import { findGit, Git } from './git';
import { Model } from './model';
import { GitSCMProvider } from './scmProvider';
import { CommandCenter } from './commands';
import { CheckoutStatusBar, SyncStatusBar } from './statusbar';
import { filterEvent, anyEvent } from './util';
import { GitContentProvider } from './contentProvider';
import { AutoFetcher } from './autofetch';
import { MergeDecorator } from './merge';
import { CommitController } from './commit';
import * as nls from 'vscode-nls';
const localize = nls.config()();
async function init(disposables: Disposable[]): Promise<void> {
const outputChannel = window.createOutputChannel('Git');
disposables.push(outputChannel);
const config = workspace.getConfiguration('git');
const enabled = config.get<boolean>('enabled') === true;
const rootPath = workspace.rootPath;
if (!rootPath || !enabled) {
const commandCenter = new CommandCenter(undefined, outputChannel);
disposables.push(commandCenter);
return;
}
示例7: init
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vscode-nls';
const localize = nls.config(process.env.VSCODE_NLS_CONFIG)();
import { ExtensionContext, workspace, window, Disposable, commands, Uri, OutputChannel } from 'vscode';
import { findGit, Git, IGit } from './git';
import { Model } from './model';
import { CommandCenter } from './commands';
import { GitContentProvider } from './contentProvider';
import { GitDecorations } from './decorationProvider';
import { Askpass } from './askpass';
import { toDisposable } from './util';
import TelemetryReporter from 'vscode-extension-telemetry';
import { API, createApi } from './api';
async function init(context: ExtensionContext, outputChannel: OutputChannel, disposables: Disposable[]): Promise<Model> {
const { name, version, aiKey } = require(context.asAbsolutePath('./package.json')) as { name: string, version: string, aiKey: string };
const telemetryReporter: TelemetryReporter = new TelemetryReporter(name, version, aiKey);
disposables.push(telemetryReporter);
const pathHint = workspace.getConfiguration('git').get<string>('path');
const info = await findGit(pathHint, path => outputChannel.appendLine(localize('looking', "Looking for git in: {0}", path)));
const askpass = new Askpass();
const env = await askpass.getEnv();
const git = new Git({ gitPath: info.path, version: info.version, env });
const model = new Model(git, context.globalState);
示例8:
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------------------------
* Includes code from typescript-sublime-plugin project, obtained from
* https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScript%20Indent.tmPreferences
* ------------------------------------------------------------------------------------------ */
'use strict';
import { env, languages, commands, workspace, window, Uri, ExtensionContext, Memento, IndentAction, Diagnostic, DiagnosticCollection, Range, DocumentFilter, Disposable } from 'vscode';
// This must be the first statement otherwise modules might got loaded with
// the wrong locale.
import * as nls from 'vscode-nls';
nls.config({ locale: env.language });
import * as path from 'path';
import * as Proto from './protocol';
import TypeScriptServiceClient from './typescriptServiceClient';
import { ITypescriptServiceClientHost } from './typescriptService';
import HoverProvider from './features/hoverProvider';
import DefinitionProvider from './features/definitionProvider';
import TypeDefinitionProvider from './features/TypeDefinitionProvider';
import DocumentHighlightProvider from './features/documentHighlightProvider';
import ReferenceProvider from './features/referenceProvider';
import DocumentSymbolProvider from './features/documentSymbolProvider';
import SignatureHelpProvider from './features/signatureHelpProvider';
示例9: RequestType
import { DocumentContext } from 'vscode-html-languageservice';
import { TextDocument, Diagnostic, DocumentLink, SymbolInformation } from 'vscode-languageserver-types';
import { getLanguageModes, LanguageModes, Settings } from './modes/languageModes';
import { GetConfigurationRequest } from 'vscode-languageserver-protocol/lib/protocol.configuration.proposed';
import { DocumentColorRequest, ServerCapabilities as CPServerCapabilities, ColorInformation } from 'vscode-languageserver-protocol/lib/protocol.colorProvider.proposed';
import { format } from './modes/formatting';
import { pushAll } from './utils/arrays';
import * as url from 'url';
import * as path from 'path';
import uri from 'vscode-uri';
import * as nls from 'vscode-nls';
nls.config(process.env['VSCODE_NLS_CONFIG']);
namespace TagCloseRequest {
export const type: RequestType<TextDocumentPositionParams, string, any, any> = new RequestType('html/tag');
}
// Create a connection for the server
let connection: IConnection = createConnection();
console.log = connection.console.log.bind(connection.console);
console.error = connection.console.error.bind(connection.console);
// Create a simple text document manager. The text document manager
// supports full document sync only
let documents: TextDocuments = new TextDocuments();
// Make the text document manager listen on the connection
示例10: activate
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import PHPCompletionItemProvider from './features/completionItemProvider';
import PHPHoverProvider from './features/hoverProvider';
import PHPSignatureHelpProvider from './features/signatureHelpProvider';
import PHPValidationProvider from './features/validationProvider';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
nls.config({ locale: vscode.env.language });
export function activate(context: vscode.ExtensionContext): any {
let validator = new PHPValidationProvider(context.workspaceState);
validator.activate(context.subscriptions);
// add providers
context.subscriptions.push(vscode.languages.registerCompletionItemProvider('php', new PHPCompletionItemProvider(), '.', '$'));
context.subscriptions.push(vscode.languages.registerHoverProvider('php', new PHPHoverProvider()));
context.subscriptions.push(vscode.languages.registerSignatureHelpProvider('php', new PHPSignatureHelpProvider(), '(', ','));
// need to set in the extension host as well as the completion provider uses it.
vscode.languages.setLanguageConfiguration('php', {
wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
});
}