提交 49ff1263 编写于 作者: J Johannes Rieken

Revert "fix #31124"

This reverts commit 552957ee.
上级 e1e3051d
......@@ -212,25 +212,6 @@ export class OneSnippet {
}
}
class WhitespaceAwareSnippetResolver extends EditorSnippetVariableResolver {
constructor(
model: IModel,
selection: Selection,
private _snippetStart: IPosition
) {
super(model, selection);
}
resolve(name: string): string {
let ret = super.resolve(name);
if (ret) {
ret = SnippetSession.adjustWhitespace(this._model, this._snippetStart, ret);
}
return ret;
}
}
export class SnippetSession {
static adjustWhitespace(model: IModel, position: IPosition, template: string): string {
......@@ -315,7 +296,7 @@ export class SnippetSession {
const snippet = new SnippetParser()
.parse(adjustedTemplate, true, enforceFinalTabstop)
.resolveVariables(new WhitespaceAwareSnippetResolver(model, selection, start));
.resolveVariables(new EditorSnippetVariableResolver(model, selection));
const offset = model.getOffsetAt(start) + delta;
delta += snippet.text.length - model.getValueLengthInRange(snippetSelection);
......
......@@ -24,8 +24,8 @@ export class EditorSnippetVariableResolver {
});
constructor(
protected readonly _model: IModel,
protected readonly _selection: Selection
private readonly _model: IModel,
private readonly _selection: Selection
) {
//
}
......
......@@ -462,30 +462,5 @@ suite('SnippetSession', function () {
assert.equal(editor.getModel().getValue(), 'test 1\ntest 2\ntest 3\ntest 4\n');
});
test('Snippet variable text isn\'t whitespace normalised, #31124', function () {
editor.getModel().setValue([
'start',
'\t-one',
'\t-two',
'end'
].join('\n'));
editor.getModel().updateOptions({ insertSpaces: false });
editor.setSelection(new Selection(2, 2, 3, 6));
new SnippetSession(editor, '<div>\n\t$TM_SELECTED_TEXT\n</div>$0').insert();
const expected = [
'start',
'\t<div>',
'\t\t-one',
'\t\t-two',
'\t</div>',
'end'
].join('\n');
assert.equal(editor.getModel().getValue(), expected);
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册