提交 7cb8e451 编写于 作者: J Johannes Rieken

remove autoClosingPairs, surroundingPair in favour of deprecated api and...

remove autoClosingPairs, surroundingPair in favour of deprecated api and language config file, fixes #8737
上级 fa7ce995
...@@ -59,13 +59,15 @@ export function activate(context: ExtensionContext) { ...@@ -59,13 +59,15 @@ export function activate(context: ExtensionContext) {
blockComment: ['/*', '*/'] blockComment: ['/*', '*/']
}, },
brackets: [['{', '}'], ['[', ']'], ['(', ')']], brackets: [['{', '}'], ['[', ']'], ['(', ')']],
autoClosingPairs: [ __characterPairSupport: {
{ open: '{', close: '}' }, autoClosingPairs: [
{ open: '[', close: ']' }, { open: '{', close: '}' },
{ open: '(', close: ')' }, { open: '[', close: ']' },
{ open: '"', close: '"', notIn: ['string'] }, { open: '(', close: ')' },
{ open: '\'', close: '\'', notIn: ['string'] } { open: '"', close: '"', notIn: ['string'] },
] { open: '\'', close: '\'', notIn: ['string'] }
]
}
}); });
languages.setLanguageConfiguration('less', { languages.setLanguageConfiguration('less', {
...@@ -75,14 +77,16 @@ export function activate(context: ExtensionContext) { ...@@ -75,14 +77,16 @@ export function activate(context: ExtensionContext) {
lineComment: '//' lineComment: '//'
}, },
brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']], brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']],
autoClosingPairs: [ __characterPairSupport: {
{ open: '"', close: '"', notIn: ['string', 'comment'] }, 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'] },
{ 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', { languages.setLanguageConfiguration('scss', {
...@@ -92,14 +96,16 @@ export function activate(context: ExtensionContext) { ...@@ -92,14 +96,16 @@ export function activate(context: ExtensionContext) {
lineComment: '//' lineComment: '//'
}, },
brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']], brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']],
autoClosingPairs: [ __characterPairSupport: {
{ open: '"', close: '"', notIn: ['string', 'comment'] }, 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'] },
{ 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); commands.registerCommand('_css.applyCodeAction', applyCodeAction);
......
...@@ -90,14 +90,16 @@ export function activate(context: ExtensionContext) { ...@@ -90,14 +90,16 @@ export function activate(context: ExtensionContext) {
languages.setLanguageConfiguration('json', { languages.setLanguageConfiguration('json', {
wordPattern: /(-?\d*\.\d\w*)|([^\[\{\]\}\:\"\,\s]+)/g, wordPattern: /(-?\d*\.\d\w*)|([^\[\{\]\}\:\"\,\s]+)/g,
autoClosingPairs: [ __characterPairSupport: {
{ open: '{', close: '}' }, autoClosingPairs: [
{ open: '[', close: ']' }, { open: '{', close: '}' },
{ open: '(', close: ')' }, { open: '[', close: ']' },
{ open: '"', close: '"', notIn: ['string'] }, { open: '(', close: ')' },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] }, { open: '"', close: '"', notIn: ['string'] },
{ open: '`', close: '`', notIn: ['string', 'comment'] } { open: '\'', close: '\'', notIn: ['string', 'comment'] },
] { open: '`', close: '`', notIn: ['string', 'comment'] }
]
}
}); });
}); });
} }
......
...@@ -28,12 +28,14 @@ export function activate(context: ExtensionContext): any { ...@@ -28,12 +28,14 @@ export function activate(context: ExtensionContext): any {
languages.setLanguageConfiguration('php', { languages.setLanguageConfiguration('php', {
wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
autoClosingPairs: [ __characterPairSupport: {
{ open: '{', close: '}' }, autoClosingPairs: [
{ open: '[', close: ']' }, { open: '{', close: '}' },
{ open: '(', close: ')' }, { open: '[', close: ']' },
{ open: '"', close: '"', notIn: ['string'] }, { open: '(', close: ')' },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] } { open: '"', close: '"', notIn: ['string'] },
] { open: '\'', close: '\'', notIn: ['string', 'comment'] }
]
}
}); });
} }
\ No newline at end of file
...@@ -210,14 +210,16 @@ class LanguageProvider { ...@@ -210,14 +210,16 @@ class LanguageProvider {
docComment: { scope: 'comment.documentation', open: '/**', lineStart: ' * ', close: ' */' } docComment: { scope: 'comment.documentation', open: '/**', lineStart: ' * ', close: ' */' }
}, },
autoClosingPairs: [ __characterPairSupport: {
{ open: '{', close: '}' }, autoClosingPairs: [
{ open: '[', close: ']' }, { open: '{', close: '}' },
{ open: '(', close: ')' }, { open: '[', close: ']' },
{ open: '"', close: '"', notIn: ['string'] }, { open: '(', close: ')' },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] }, { open: '"', close: '"', notIn: ['string'] },
{ open: '`', close: '`', notIn: ['string', 'comment'] } { open: '\'', close: '\'', notIn: ['string', 'comment'] },
] { open: '`', close: '`', notIn: ['string', 'comment'] }
]
}
}); });
}); });
} }
......
...@@ -2447,26 +2447,6 @@ declare namespace vscode { ...@@ -2447,26 +2447,6 @@ declare namespace vscode {
*/ */
onEnterRules?: OnEnterRule[]; 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. * **Deprecated** Do not use.
* *
...@@ -2490,7 +2470,7 @@ declare namespace vscode { ...@@ -2490,7 +2470,7 @@ declare namespace vscode {
/** /**
* **Deprecated** Do not use. * **Deprecated** Do not use.
* *
* @deprecated Use autoClosingPairs and surroundingPairs instead. * @deprecated Use the language configuration file instead.
*/ */
__characterPairSupport?: { __characterPairSupport?: {
autoClosingPairs: { autoClosingPairs: {
......
...@@ -837,12 +837,6 @@ export class ExtHostLanguageFeatures { ...@@ -837,12 +837,6 @@ export class ExtHostLanguageFeatures {
this._documents.setWordDefinitionFor(languageId, null); 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(); const handle = this._nextHandle();
this._proxy.$setLanguageConfiguration(handle, languageId, configuration); this._proxy.$setLanguageConfiguration(handle, languageId, configuration);
return this._createDisposable(handle); return this._createDisposable(handle);
......
...@@ -16,7 +16,7 @@ import {CancellationToken} from 'vs/base/common/cancellation'; ...@@ -16,7 +16,7 @@ import {CancellationToken} from 'vs/base/common/cancellation';
import {Position as EditorPosition} from 'vs/editor/common/core/position'; import {Position as EditorPosition} from 'vs/editor/common/core/position';
import {Range as EditorRange} from 'vs/editor/common/core/range'; import {Range as EditorRange} from 'vs/editor/common/core/range';
import {ExtHostContext, ExtHostLanguageFeaturesShape} from './extHostProtocol'; 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 { export class MainThreadLanguageFeatures {
...@@ -203,7 +203,12 @@ export class MainThreadLanguageFeatures { ...@@ -203,7 +203,12 @@ export class MainThreadLanguageFeatures {
// --- configuration // --- configuration
$setLanguageConfiguration(handle: number, languageId:string, configuration: vscode.LanguageConfiguration): TPromise<any> { $setLanguageConfiguration(handle: number, languageId: string, configuration: vscode.LanguageConfiguration): TPromise<any> {
if (configuration.__characterPairSupport) {
(<LanguageConfiguration> configuration).autoClosingPairs = configuration.__characterPairSupport.autoClosingPairs;
}
this._registrations[handle] = LanguageConfigurationRegistry.register(languageId, configuration); this._registrations[handle] = LanguageConfigurationRegistry.register(languageId, configuration);
return undefined; return undefined;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册