mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Remove enhancedBrackets
from monarch for now
This commit is contained in:
parent
6ec574f698
commit
b3e9164e49
|
@ -9,16 +9,14 @@
|
|||
["(", ")"]
|
||||
]
|
||||
|
||||
/*
|
||||
enhancedBrackets: [
|
||||
{ tokenType:'string', openTrigger: '"', open: /@"$/, closeComplete: '"@' },
|
||||
{ tokenType:'string', openTrigger: '\'', open: /@'$/, closeComplete: '\'@' },
|
||||
{ tokenType:'string', openTrigger: '"', open: /"$/, closeComplete: '"' },
|
||||
{ tokenType: 'string', openTrigger: '\'', open: /'$/, closeComplete: '\'' }
|
||||
],
|
||||
// enhancedBrackets: [
|
||||
// { tokenType:'string', openTrigger: '"', open: /@"$/, closeComplete: '"@' },
|
||||
// { tokenType:'string', openTrigger: '\'', open: /@'$/, closeComplete: '\'@' },
|
||||
// { tokenType:'string', openTrigger: '"', open: /"$/, closeComplete: '"' },
|
||||
// { tokenType: 'string', openTrigger: '\'', open: /'$/, closeComplete: '\'' }
|
||||
// ],
|
||||
|
||||
autoClosingPairs: [['{', '}'], ['[', ']'], ['(', ')']], // Defined explicitly, to suppress the
|
||||
// default auto-closing of ' and " which is
|
||||
// override above by enhancedBrackets
|
||||
*/
|
||||
// autoClosingPairs: [['{', '}'], ['[', ']'], ['(', ')']], // Defined explicitly, to suppress the
|
||||
// // default auto-closing of ' and " which is
|
||||
// // override above by enhancedBrackets
|
||||
}
|
|
@ -8,12 +8,11 @@
|
|||
["[", "]"],
|
||||
["(", ")"]
|
||||
]
|
||||
/*
|
||||
enhancedBrackets:[
|
||||
{ openTrigger: 'n', open: /begin$/i, closeComplete: 'end', matchCase: true },
|
||||
{ openTrigger: 'e', open: /case$/i, closeComplete: 'end', matchCase: true },
|
||||
{ openTrigger: 'n', open: /when$/i, closeComplete: 'then', matchCase: true }
|
||||
],
|
||||
noindentBrackets: '()',
|
||||
*/
|
||||
|
||||
// enhancedBrackets:[
|
||||
// { openTrigger: 'n', open: /begin$/i, closeComplete: 'end', matchCase: true },
|
||||
// { openTrigger: 'e', open: /case$/i, closeComplete: 'end', matchCase: true },
|
||||
// { openTrigger: 'n', open: /when$/i, closeComplete: 'then', matchCase: true }
|
||||
// ],
|
||||
// noindentBrackets: '()',
|
||||
}
|
|
@ -6,16 +6,16 @@
|
|||
"brackets": [
|
||||
["<", ">"]
|
||||
]
|
||||
/*
|
||||
enhancedBrackets: [{
|
||||
tokenType: 'tag.tag-$1.xml',
|
||||
openTrigger: '>',
|
||||
open: /<(\w[\w\d]*)([^\/>]*(?!\/)>)[^<>]*$/i,
|
||||
closeComplete: '</$1>',
|
||||
closeTrigger: '>',
|
||||
close: /<\/(\w[\w\d]*)\s*>$/i
|
||||
}],
|
||||
|
||||
autoClosingPairs: [['\'', '\''], ['"', '"'] ]
|
||||
*/
|
||||
// enhancedBrackets: [{
|
||||
// tokenType: 'tag.tag-$1.xml',
|
||||
// openTrigger: '>',
|
||||
// open: /<(\w[\w\d]*)([^\/>]*(?!\/)>)[^<>]*$/i,
|
||||
// closeComplete: '</$1>',
|
||||
// closeTrigger: '>',
|
||||
// close: /<\/(\w[\w\d]*)\s*>$/i
|
||||
// }],
|
||||
|
||||
// autoClosingPairs: [['\'', '\''], ['"', '"'] ]
|
||||
|
||||
}
|
||||
|
|
|
@ -6,16 +6,15 @@
|
|||
"brackets": [
|
||||
["<", ">"]
|
||||
]
|
||||
/*
|
||||
enhancedBrackets: [{
|
||||
tokenType: 'tag.tag-$1.xml',
|
||||
openTrigger: '>',
|
||||
open: /<(\w[\w\d]*)([^\/>]*(?!\/)>)[^<>]*$/i,
|
||||
closeComplete: '</$1>',
|
||||
closeTrigger: '>',
|
||||
close: /<\/(\w[\w\d]*)\s*>$/i
|
||||
}],
|
||||
|
||||
autoClosingPairs: [['\'', '\''], ['"', '"'] ]
|
||||
*/
|
||||
// enhancedBrackets: [{
|
||||
// tokenType: 'tag.tag-$1.xml',
|
||||
// openTrigger: '>',
|
||||
// open: /<(\w[\w\d]*)([^\/>]*(?!\/)>)[^<>]*$/i,
|
||||
// closeComplete: '</$1>',
|
||||
// closeTrigger: '>',
|
||||
// close: /<\/(\w[\w\d]*)\s*>$/i
|
||||
// }],
|
||||
|
||||
// autoClosingPairs: [['\'', '\''], ['"', '"'] ]
|
||||
}
|
||||
|
|
|
@ -646,46 +646,46 @@ export function compile(json: MonarchTypes.ILanguage): MonarchCommonTypes.ILexer
|
|||
}
|
||||
|
||||
// Set enhanced brackets
|
||||
var enhancedBrackets : Modes.IRegexBracketPair[] = [];
|
||||
if (json.enhancedBrackets) {
|
||||
if (!(Array.isArray(<any>json.enhancedBrackets))) {
|
||||
MonarchCommonTypes.throwError(lexer, 'the \'enhancedBrackets\' attribute must be defined as an array');
|
||||
}
|
||||
// var enhancedBrackets : Modes.IRegexBracketPair[] = [];
|
||||
// if (json.enhancedBrackets) {
|
||||
// if (!(Array.isArray(<any>json.enhancedBrackets))) {
|
||||
// MonarchCommonTypes.throwError(lexer, 'the \'enhancedBrackets\' attribute must be defined as an array');
|
||||
// }
|
||||
|
||||
for (var bracketIdx in json.enhancedBrackets) {
|
||||
if (json.enhancedBrackets.hasOwnProperty(bracketIdx)) {
|
||||
var desc = <any> json.enhancedBrackets[bracketIdx];
|
||||
if (desc.hasOwnProperty('openTrigger') && typeof (desc.openTrigger) !== 'string') {
|
||||
MonarchCommonTypes.throwError(lexer, 'openTrigger in the \'enhancedBrackets\' array must be a string');
|
||||
}
|
||||
if (desc.hasOwnProperty('open') && !(desc.open instanceof RegExp)) {
|
||||
MonarchCommonTypes.throwError(lexer, 'open in the \'enhancedBrackets\' array must be a regex');
|
||||
}
|
||||
if (desc.hasOwnProperty('closeComplete') && typeof (desc.closeComplete) !== 'string') {
|
||||
MonarchCommonTypes.throwError(lexer, 'closeComplete in the \'enhancedBrackets\' array must be a string');
|
||||
}
|
||||
if (desc.hasOwnProperty('matchCase') && typeof (desc.matchCase) !== 'boolean') {
|
||||
MonarchCommonTypes.throwError(lexer, 'matchCase in the \'enhancedBrackets\' array must be a boolean');
|
||||
}
|
||||
if (desc.hasOwnProperty('closeTrigger') && typeof (desc.closeTrigger) !== 'string') {
|
||||
MonarchCommonTypes.throwError(lexer, 'closeTrigger in the \'enhancedBrackets\' array must be a string');
|
||||
}
|
||||
if (desc.hasOwnProperty('close') && !(desc.close instanceof RegExp)) {
|
||||
MonarchCommonTypes.throwError(lexer, 'close in the \'enhancedBrackets\' array must be a regex');
|
||||
}
|
||||
if (desc.hasOwnProperty('tokenType')) {
|
||||
if (typeof (desc.tokenType) !== 'string') {
|
||||
MonarchCommonTypes.throwError(lexer, 'tokenType in the \'enhancedBrackets\' array must be a string');
|
||||
}
|
||||
else {
|
||||
desc.tokenType += lexer.tokenPostfix;
|
||||
}
|
||||
}
|
||||
enhancedBrackets.push(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
lexer.enhancedBrackets = enhancedBrackets;
|
||||
// for (var bracketIdx in json.enhancedBrackets) {
|
||||
// if (json.enhancedBrackets.hasOwnProperty(bracketIdx)) {
|
||||
// var desc = <any> json.enhancedBrackets[bracketIdx];
|
||||
// if (desc.hasOwnProperty('openTrigger') && typeof (desc.openTrigger) !== 'string') {
|
||||
// MonarchCommonTypes.throwError(lexer, 'openTrigger in the \'enhancedBrackets\' array must be a string');
|
||||
// }
|
||||
// if (desc.hasOwnProperty('open') && !(desc.open instanceof RegExp)) {
|
||||
// MonarchCommonTypes.throwError(lexer, 'open in the \'enhancedBrackets\' array must be a regex');
|
||||
// }
|
||||
// if (desc.hasOwnProperty('closeComplete') && typeof (desc.closeComplete) !== 'string') {
|
||||
// MonarchCommonTypes.throwError(lexer, 'closeComplete in the \'enhancedBrackets\' array must be a string');
|
||||
// }
|
||||
// if (desc.hasOwnProperty('matchCase') && typeof (desc.matchCase) !== 'boolean') {
|
||||
// MonarchCommonTypes.throwError(lexer, 'matchCase in the \'enhancedBrackets\' array must be a boolean');
|
||||
// }
|
||||
// if (desc.hasOwnProperty('closeTrigger') && typeof (desc.closeTrigger) !== 'string') {
|
||||
// MonarchCommonTypes.throwError(lexer, 'closeTrigger in the \'enhancedBrackets\' array must be a string');
|
||||
// }
|
||||
// if (desc.hasOwnProperty('close') && !(desc.close instanceof RegExp)) {
|
||||
// MonarchCommonTypes.throwError(lexer, 'close in the \'enhancedBrackets\' array must be a regex');
|
||||
// }
|
||||
// if (desc.hasOwnProperty('tokenType')) {
|
||||
// if (typeof (desc.tokenType) !== 'string') {
|
||||
// MonarchCommonTypes.throwError(lexer, 'tokenType in the \'enhancedBrackets\' array must be a string');
|
||||
// }
|
||||
// else {
|
||||
// desc.tokenType += lexer.tokenPostfix;
|
||||
// }
|
||||
// }
|
||||
// enhancedBrackets.push(desc);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// lexer.enhancedBrackets = enhancedBrackets;
|
||||
|
||||
var standardBrackets: Modes.IBracketPair[] = [];
|
||||
for (var i = 0; i < brackets.length; ++i) {
|
||||
|
|
|
@ -43,7 +43,7 @@ export function createRichEditSupport(lexer: MonarchCommonTypes.ILexer): IRichEd
|
|||
|
||||
__electricCharacterSupport: {
|
||||
brackets: lexer.standardBrackets,
|
||||
regexBrackets: lexer.enhancedBrackets,
|
||||
// regexBrackets: lexer.enhancedBrackets,
|
||||
caseInsensitive: lexer.ignoreCase,
|
||||
embeddedElectricCharacters: lexer.outdentTriggers.split('')
|
||||
},
|
||||
|
|
|
@ -75,10 +75,10 @@ export interface ILanguage {
|
|||
* characters that could potentially cause outdentation
|
||||
*/
|
||||
outdentTriggers?: string;
|
||||
/**
|
||||
* Advanced auto completion, auto indenting, and bracket matching
|
||||
*/
|
||||
enhancedBrackets?: Modes.IRegexBracketPair[];
|
||||
// /**
|
||||
// * Advanced auto completion, auto indenting, and bracket matching
|
||||
// */
|
||||
// enhancedBrackets?: Modes.IRegexBracketPair[];
|
||||
|
||||
suggestSupport?: {
|
||||
textualCompletions?: boolean;
|
||||
|
|
|
@ -23,17 +23,17 @@ export var language = <ILanguage> {
|
|||
{ token: 'punctuation.square', open: '[', close: ']' }
|
||||
],
|
||||
|
||||
enhancedBrackets: [
|
||||
{
|
||||
openTrigger: 'l',
|
||||
open: /setlocal$/i,
|
||||
closeComplete: 'endlocal',
|
||||
matchCase: true,
|
||||
closeTrigger: 'l',
|
||||
close: /endlocal$/i,
|
||||
tokenType: 'keyword.tag-setlocal'
|
||||
}
|
||||
],
|
||||
// enhancedBrackets: [
|
||||
// {
|
||||
// openTrigger: 'l',
|
||||
// open: /setlocal$/i,
|
||||
// closeComplete: 'endlocal',
|
||||
// matchCase: true,
|
||||
// closeTrigger: 'l',
|
||||
// close: /endlocal$/i,
|
||||
// tokenType: 'keyword.tag-setlocal'
|
||||
// }
|
||||
// ],
|
||||
|
||||
keywords: /call|defined|echo|errorlevel|exist|for|goto|if|pause|set|shift|start|title|not|pushd|popd/,
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ export var language = <ILanguage> {
|
|||
{ open:'(', close:')', token:'delimiter.parenthesis'}
|
||||
],
|
||||
|
||||
enhancedBrackets: [
|
||||
{ open: /for$/ }, { open: /while$/ }, { open: /loop$/ }, { open: /if$/ }, { open: /unless$/ },
|
||||
{ open: /else$/ }, { open: /switch$/ }, { open: /try$/ }, { open: /catch$/ }, { open: /finally$/ },
|
||||
{ open: /class$/ }, { open: /->$/ }
|
||||
],
|
||||
// enhancedBrackets: [
|
||||
// { open: /for$/ }, { open: /while$/ }, { open: /loop$/ }, { open: /if$/ }, { open: /unless$/ },
|
||||
// { open: /else$/ }, { open: /switch$/ }, { open: /try$/ }, { open: /catch$/ }, { open: /finally$/ },
|
||||
// { open: /class$/ }, { open: /->$/ }
|
||||
// ],
|
||||
|
||||
// the default separators
|
||||
wordDefinition: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||
|
|
|
@ -25,12 +25,12 @@ export var language = <ILanguage> {
|
|||
{ token: 'delimiter.square', open: '[', close: ']' },
|
||||
{ token: 'delimiter.parenthesis', open: '(', close: ')' }],
|
||||
|
||||
enhancedBrackets: [
|
||||
{ tokenType:'string', openTrigger: '"', open: /@"$/, closeComplete: '"@' },
|
||||
{ tokenType:'string', openTrigger: '\'', open: /@'$/, closeComplete: '\'@' },
|
||||
{ tokenType:'string', openTrigger: '"', open: /"$/, closeComplete: '"' },
|
||||
{ tokenType: 'string', openTrigger: '\'', open: /'$/, closeComplete: '\'' }
|
||||
],
|
||||
// enhancedBrackets: [
|
||||
// { tokenType:'string', openTrigger: '"', open: /@"$/, closeComplete: '"@' },
|
||||
// { tokenType:'string', openTrigger: '\'', open: /@'$/, closeComplete: '\'@' },
|
||||
// { tokenType:'string', openTrigger: '"', open: /"$/, closeComplete: '"' },
|
||||
// { tokenType: 'string', openTrigger: '\'', open: /'$/, closeComplete: '\'' }
|
||||
// ],
|
||||
|
||||
autoClosingPairs: [['{', '}'], ['[', ']'], ['(', ')']], // Defined explicitly, to suppress the
|
||||
// default auto-closing of ' and " which is
|
||||
|
|
|
@ -156,7 +156,7 @@ export var language = <ILanguage> {
|
|||
],
|
||||
|
||||
// Cause an automatic indent to occur after lines ending in :.
|
||||
enhancedBrackets: [ { open: /.*:\s*$/, closeComplete: 'else:' } ],
|
||||
// enhancedBrackets: [ { open: /.*:\s*$/, closeComplete: 'else:' } ],
|
||||
|
||||
tokenizer: {
|
||||
root: [
|
||||
|
|
|
@ -16,11 +16,11 @@ export var language = <ILanguage> {
|
|||
{ open: '[', close: ']', token: 'delimiter.square' },
|
||||
{ open: '(', close: ')', token: 'delimiter.parenthesis' }
|
||||
],
|
||||
enhancedBrackets:[
|
||||
{ openTrigger: 'n', open: /begin$/i, closeComplete: 'end', matchCase: true },
|
||||
{ openTrigger: 'e', open: /case$/i, closeComplete: 'end', matchCase: true },
|
||||
{ openTrigger: 'n', open: /when$/i, closeComplete: 'then', matchCase: true }
|
||||
],
|
||||
// enhancedBrackets:[
|
||||
// { openTrigger: 'n', open: /begin$/i, closeComplete: 'end', matchCase: true },
|
||||
// { openTrigger: 'e', open: /case$/i, closeComplete: 'end', matchCase: true },
|
||||
// { openTrigger: 'n', open: /when$/i, closeComplete: 'then', matchCase: true }
|
||||
// ],
|
||||
noindentBrackets: '()',
|
||||
editorOptions: { tabSize: 4, insertSpaces: true },
|
||||
lineComment: '--',
|
||||
|
|
|
@ -35,7 +35,7 @@ export interface ILanguage {
|
|||
autoClosingPairs?: string[][]; // for example [['"','"']]
|
||||
wordDefinition?: RegExp; // word definition regular expression
|
||||
outdentTriggers?: string; // characters that could potentially cause outdentation
|
||||
enhancedBrackets?: IRegexBracketPair[]; // Advanced auto completion, auto indenting, and bracket matching
|
||||
// enhancedBrackets?: IRegexBracketPair[]; // Advanced auto completion, auto indenting, and bracket matching
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,14 +22,14 @@ export var language = <ILanguage> {
|
|||
// Useful regular expressions
|
||||
qualifiedName: /(?:[\w\.\-]+:)?[\w\.\-]+/,
|
||||
|
||||
enhancedBrackets: [{
|
||||
tokenType: 'tag.tag-$1.xml',
|
||||
openTrigger: '>',
|
||||
open: /<(\w[\w\d]*)([^\/>]*(?!\/)>)[^<>]*$/i,
|
||||
closeComplete: '</$1>',
|
||||
closeTrigger: '>',
|
||||
close: /<\/(\w[\w\d]*)\s*>$/i
|
||||
}],
|
||||
// enhancedBrackets: [{
|
||||
// tokenType: 'tag.tag-$1.xml',
|
||||
// openTrigger: '>',
|
||||
// open: /<(\w[\w\d]*)([^\/>]*(?!\/)>)[^<>]*$/i,
|
||||
// closeComplete: '</$1>',
|
||||
// closeTrigger: '>',
|
||||
// close: /<\/(\w[\w\d]*)\s*>$/i
|
||||
// }],
|
||||
|
||||
autoClosingPairs: [['\'', '\''], ['"', '"'] ],
|
||||
|
||||
|
|
Loading…
Reference in a new issue