diff --git a/extensions/css/client/src/cssMain.ts b/extensions/css/client/src/cssMain.ts index 4eed918351f22be36fdd87f3711597a28a2b82b8..21fadbc51440dc844b7ce709d3d875ecfc0b1cbb 100644 --- a/extensions/css/client/src/cssMain.ts +++ b/extensions/css/client/src/cssMain.ts @@ -59,13 +59,15 @@ export function activate(context: ExtensionContext) { blockComment: ['/*', '*/'] }, brackets: [['{', '}'], ['[', ']'], ['(', ')']], - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"', notIn: ['string'] }, - { open: '\'', close: '\'', notIn: ['string'] } - ] + __characterPairSupport: { + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"', notIn: ['string'] }, + { open: '\'', close: '\'', notIn: ['string'] } + ] + } }); languages.setLanguageConfiguration('less', { @@ -75,14 +77,16 @@ export function activate(context: ExtensionContext) { lineComment: '//' }, brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']], - autoClosingPairs: [ - { open: '"', close: '"', notIn: ['string', 'comment'] }, - { open: '\'', close: '\'', notIn: ['string', 'comment'] }, - { open: '{', close: '}', notIn: ['string', 'comment'] }, - { open: '[', close: ']', notIn: ['string', 'comment'] }, - { open: '(', close: ')', notIn: ['string', 'comment'] }, - { open: '<', close: '>', notIn: ['string', 'comment'] }, - ] + __characterPairSupport: { + autoClosingPairs: [ + { open: '"', close: '"', notIn: ['string', 'comment'] }, + { open: '\'', close: '\'', notIn: ['string', 'comment'] }, + { open: '{', close: '}', notIn: ['string', 'comment'] }, + { open: '[', close: ']', notIn: ['string', 'comment'] }, + { open: '(', close: ')', notIn: ['string', 'comment'] }, + { open: '<', close: '>', notIn: ['string', 'comment'] }, + ] + } }); languages.setLanguageConfiguration('scss', { @@ -92,14 +96,16 @@ export function activate(context: ExtensionContext) { lineComment: '//' }, brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']], - autoClosingPairs: [ - { open: '"', close: '"', notIn: ['string', 'comment'] }, - { open: '\'', close: '\'', notIn: ['string', 'comment'] }, - { open: '{', close: '}', notIn: ['string', 'comment'] }, - { open: '[', close: ']', notIn: ['string', 'comment'] }, - { open: '(', close: ')', notIn: ['string', 'comment'] }, - { open: '<', close: '>', notIn: ['string', 'comment'] }, - ] + __characterPairSupport: { + autoClosingPairs: [ + { open: '"', close: '"', notIn: ['string', 'comment'] }, + { open: '\'', close: '\'', notIn: ['string', 'comment'] }, + { open: '{', close: '}', notIn: ['string', 'comment'] }, + { open: '[', close: ']', notIn: ['string', 'comment'] }, + { open: '(', close: ')', notIn: ['string', 'comment'] }, + { open: '<', close: '>', notIn: ['string', 'comment'] }, + ] + } }); commands.registerCommand('_css.applyCodeAction', applyCodeAction); diff --git a/extensions/json/client/src/jsonMain.ts b/extensions/json/client/src/jsonMain.ts index 790b12f086b1d2a38221642dafcf08208182e7d3..458734d609654e834c1c2ad683693035fbd27dbe 100644 --- a/extensions/json/client/src/jsonMain.ts +++ b/extensions/json/client/src/jsonMain.ts @@ -90,14 +90,16 @@ export function activate(context: ExtensionContext) { languages.setLanguageConfiguration('json', { wordPattern: /(-?\d*\.\d\w*)|([^\[\{\]\}\:\"\,\s]+)/g, - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"', notIn: ['string'] }, - { open: '\'', close: '\'', notIn: ['string', 'comment'] }, - { open: '`', close: '`', notIn: ['string', 'comment'] } - ] + __characterPairSupport: { + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"', notIn: ['string'] }, + { open: '\'', close: '\'', notIn: ['string', 'comment'] }, + { open: '`', close: '`', notIn: ['string', 'comment'] } + ] + } }); }); } diff --git a/extensions/php/src/phpMain.ts b/extensions/php/src/phpMain.ts index d09cdcaee51e08c0ff973fd27296563ef9a9ad0e..56d41d39a4474a947c4f97180ca2af8aa7bd384d 100644 --- a/extensions/php/src/phpMain.ts +++ b/extensions/php/src/phpMain.ts @@ -28,12 +28,14 @@ export function activate(context: ExtensionContext): any { languages.setLanguageConfiguration('php', { wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"', notIn: ['string'] }, - { open: '\'', close: '\'', notIn: ['string', 'comment'] } - ] + __characterPairSupport: { + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"', notIn: ['string'] }, + { open: '\'', close: '\'', notIn: ['string', 'comment'] } + ] + } }); } \ No newline at end of file diff --git a/extensions/typescript/src/typescriptMain.ts b/extensions/typescript/src/typescriptMain.ts index 9a7e581b38f287cec181cd63f1c362bd2096a1f6..5305ae01e8636fbdf6a34b8f1fc25cb28239a377 100644 --- a/extensions/typescript/src/typescriptMain.ts +++ b/extensions/typescript/src/typescriptMain.ts @@ -210,14 +210,16 @@ class LanguageProvider { docComment: { scope: 'comment.documentation', open: '/**', lineStart: ' * ', close: ' */' } }, - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"', notIn: ['string'] }, - { open: '\'', close: '\'', notIn: ['string', 'comment'] }, - { open: '`', close: '`', notIn: ['string', 'comment'] } - ] + __characterPairSupport: { + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"', notIn: ['string'] }, + { open: '\'', close: '\'', notIn: ['string', 'comment'] }, + { open: '`', close: '`', notIn: ['string', 'comment'] } + ] + } }); }); } diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 3ac18189e7e9a84ed5708c82a6dcddc7d9ac8092..84bc601ed672c0e25422f5db40bb083cf5e00b38 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -2447,26 +2447,6 @@ declare namespace vscode { */ onEnterRules?: OnEnterRule[]; - /** - * The language's auto closing pairs. The 'close' character is automatically inserted with the - * 'open' character is typed. If not set, the configured brackets will be used. - */ - autoClosingPairs?: { - open: string; - close: string; - notIn?: string[]; - }[]; - - /** - * The language's surrounding pairs. When the 'open' character is typed on a selection, the - * selected string is surrounded by the open and close characters. If not set, the autoclosing pairs - * settings will be used. - */ - surroundingPairs?: { - open: string; - close: string; - }[]; - /** * **Deprecated** Do not use. * @@ -2490,7 +2470,7 @@ declare namespace vscode { /** * **Deprecated** Do not use. * - * @deprecated Use autoClosingPairs and surroundingPairs instead. + * @deprecated Use the language configuration file instead. */ __characterPairSupport?: { autoClosingPairs: { diff --git a/src/vs/workbench/api/node/extHostLanguageFeatures.ts b/src/vs/workbench/api/node/extHostLanguageFeatures.ts index 03844829489b9a416d84eadc887d9ba33e172474..ea7968bc36f89201de82b81ea3e04d354042f034 100644 --- a/src/vs/workbench/api/node/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/node/extHostLanguageFeatures.ts @@ -837,12 +837,6 @@ export class ExtHostLanguageFeatures { this._documents.setWordDefinitionFor(languageId, null); } - // backward compatibility, migrate deprecated setting - if (configuration.__characterPairSupport && !configuration.autoClosingPairs) { - configuration.autoClosingPairs = configuration.__characterPairSupport.autoClosingPairs; - delete configuration.__characterPairSupport; - } - const handle = this._nextHandle(); this._proxy.$setLanguageConfiguration(handle, languageId, configuration); return this._createDisposable(handle); diff --git a/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts b/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts index 40c1d608ce300976cc069af1d9f164ac44189197..1afe4059d94452b6eb2e91c2de813074f78056df 100644 --- a/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts +++ b/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts @@ -16,7 +16,7 @@ import {CancellationToken} from 'vs/base/common/cancellation'; import {Position as EditorPosition} from 'vs/editor/common/core/position'; import {Range as EditorRange} from 'vs/editor/common/core/range'; import {ExtHostContext, ExtHostLanguageFeaturesShape} from './extHostProtocol'; -import {LanguageConfigurationRegistry} from 'vs/editor/common/modes/languageConfigurationRegistry'; +import {LanguageConfigurationRegistry, LanguageConfiguration} from 'vs/editor/common/modes/languageConfigurationRegistry'; export class MainThreadLanguageFeatures { @@ -203,7 +203,12 @@ export class MainThreadLanguageFeatures { // --- configuration - $setLanguageConfiguration(handle: number, languageId:string, configuration: vscode.LanguageConfiguration): TPromise { + $setLanguageConfiguration(handle: number, languageId: string, configuration: vscode.LanguageConfiguration): TPromise { + + if (configuration.__characterPairSupport) { + ( configuration).autoClosingPairs = configuration.__characterPairSupport.autoClosingPairs; + } + this._registrations[handle] = LanguageConfigurationRegistry.register(languageId, configuration); return undefined; }