allow bulk edit to change EOL sequences

This commit is contained in:
Johannes Rieken
2017-03-09 16:00:56 +01:00
parent f52053a78e
commit ac0e3c615b
7 changed files with 52 additions and 32 deletions

View File

@@ -13,7 +13,7 @@ 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 { IResourceEdit } from 'vs/editor/common/services/bulkEdit';
import { IResourceTextEdit } from 'vs/editor/common/services/bulkEdit';
import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
import * as vscode from 'vscode';
@@ -103,8 +103,8 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
const promises: TPromise<any | vscode.TextEdit[]>[] = [];
const {document, reason} = stubEvent;
const {version} = document;
const { document, reason } = stubEvent;
const { version } = document;
const event = Object.freeze(<vscode.TextDocumentWillSaveEvent>{
document,
@@ -134,10 +134,10 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
}).then(values => {
const edits: IResourceEdit[] = [];
const edits: IResourceTextEdit[] = [];
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, range } of value) {
edits.push({
resource: <URI>document.uri,
range: fromRange(range),