Fix for @12195 Adding a div causes an extra stray bracket in Razor

This commit is contained in:
Erich Gamma 2016-09-29 14:34:12 +02:00
parent 7067b5927c
commit 8a6ba3b28b
4 changed files with 13 additions and 7 deletions

View file

@ -14,8 +14,7 @@
{ "open": "[", "close": "]"},
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "<", "close": ">" }
{ "open": "\"", "close": "\"" }
],
"surroundingPairs": [
{ "open": "'", "close": "'" },

View file

@ -13,8 +13,7 @@
{ "open": "[", "close": "]"},
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "<", "close": ">" }
{ "open": "\"", "close": "\"" }
],
"surroundingPairs": [
{ "open": "'", "close": "'" },

View file

@ -13,8 +13,7 @@
{ "open": "[", "close": "]"},
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "<", "close": ">" }
{ "open": "\"", "close": "\"" }
],
"surroundingPairs": [
{ "open": "'", "close": "'" },

View file

@ -80,7 +80,7 @@ export class EditorAccessor implements emmet.Editor {
let startPosition = this.getPositionFromOffset(start);
let endPosition = this.getPositionFromOffset(end);
// test if < or </ are located before the replace range. Either replace these too, or block the expansion
// test if < or </ are located before or > after the replace range. Either replace these too, or block the expansion
var currentLine = this._editor.getModel().getLineContent(startPosition.lineNumber).substr(0, startPosition.column - 1); // content before the replaced range
var match = currentLine.match(/<[/]?$/);
if (match) {
@ -91,6 +91,15 @@ export class EditorAccessor implements emmet.Editor {
}
}
// test if > is located after the replace range. Either replace these too, or block the expansion
if (this._editor.getModel().getLineContent(endPosition.lineNumber).substr(endPosition.column-1, endPosition.column) ==='>') {
if (strings.endsWith(value, '>')) {
endPosition = { lineNumber: endPosition.lineNumber, column: endPosition.column + 1 };
} else {
return; // ignore
}
}
// If this is the first edit in this "transaction", push an undo stop before them
if (!this._hasMadeEdits) {
this._hasMadeEdits = true;