add TextEdit#newEol, adopt for workspace edit and onWillSave-event

This commit is contained in:
Johannes Rieken
2017-03-24 16:13:58 +01:00
parent 0219720936
commit 1849ad23a7
12 changed files with 153 additions and 69 deletions

View File

@@ -12,7 +12,7 @@ import { illegalState } from 'vs/base/common/errors';
import { TPromise } from 'vs/base/common/winjs.base';
import { MainThreadWorkspaceShape, ExtHostDocumentSaveParticipantShape } from 'vs/workbench/api/node/extHost.protocol';
import { TextEdit } from 'vs/workbench/api/node/extHostTypes';
import { fromRange, TextDocumentSaveReason } from 'vs/workbench/api/node/extHostTypeConverters';
import { fromRange, TextDocumentSaveReason, EndOfLine } from 'vs/workbench/api/node/extHostTypeConverters';
import { IResourceEdit } from 'vs/editor/common/services/bulkEdit';
import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
@@ -138,11 +138,12 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
for (const value of values) {
if (Array.isArray(value) && (<vscode.TextEdit[]>value).every(e => e instanceof TextEdit)) {
for (const { newText, range } of value) {
for (const { newText, newEol, range } of value) {
edits.push({
resource: <URI>document.uri,
range: fromRange(range),
newText
range: range && fromRange(range),
newText,
newEol: EndOfLine.from(newEol)
});
}
}