提交 8516b9a6 编写于 作者: J Johannes Rieken

no EOLEdit for now, no replacement yet

上级 6a062eea
......@@ -2048,34 +2048,6 @@ declare module 'vscode' {
constructor(range: Range, newText: string);
}
/**
* Represents a change of the [eol-sequence](#TextDocument.eol) that is used in a document.
*/
export class EndOfLineEdit {
/**
* Use the line feed `\n` character.
*/
static readonly LF: EndOfLineEdit;
/**
* Use the carriage return line feed `\r\n` sequence.
*/
static readonly CRLF: EndOfLineEdit;
/**
* The new end of line sequence
*/
newEol: EndOfLine;
/**
* Create a new EndOfLineEdit.
*
* @param newEol A new end of line sequence.
*/
constructor(newEol: EndOfLine);
}
/**
* A workspace edit represents textual changes for many documents.
*/
......@@ -3990,7 +3962,7 @@ declare module 'vscode' {
*
* @param thenable A thenable that resolves to [pre-save-edits](#TextEdit).
*/
waitUntil(thenable: Thenable<TextEdit[] | EndOfLineEdit>): void;
waitUntil(thenable: Thenable<TextEdit[]>): void;
/**
* Allows to pause the event loop until the provided thenable resolved.
......
......@@ -486,7 +486,6 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ
SymbolKind: extHostTypes.SymbolKind,
TextDocumentSaveReason: extHostTypes.TextDocumentSaveReason,
TextEdit: extHostTypes.TextEdit,
EndOfLineEdit: extHostTypes.EndOfLineEdit,
TextEditorCursorStyle: EditorCommon.TextEditorCursorStyle,
TextEditorLineNumbersStyle: extHostTypes.TextEditorLineNumbersStyle,
TextEditorRevealType: extHostTypes.TextEditorRevealType,
......
......@@ -11,8 +11,8 @@ import { sequence, always } from 'vs/base/common/async';
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, EndOfLineEdit } from 'vs/workbench/api/node/extHostTypes';
import { fromRange, TextDocumentSaveReason, fromEOL } from 'vs/workbench/api/node/extHostTypeConverters';
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 { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
......@@ -101,7 +101,7 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
private _deliverEventAsync(listener: Function, thisArg: any, stubEvent: vscode.TextDocumentWillSaveEvent): TPromise<any> {
const promises: TPromise<vscode.TextEdit[] | vscode.EndOfLineEdit>[] = [];
const promises: TPromise<vscode.TextEdit[]>[] = [];
const { document, reason } = stubEvent;
const { version } = document;
......@@ -127,7 +127,7 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
// freeze promises after event call
Object.freeze(promises);
return new TPromise<(vscode.TextEdit[] | vscode.EndOfLineEdit)[]>((resolve, reject) => {
return new TPromise<vscode.TextEdit[][]>((resolve, reject) => {
// join on all listener promises, reject after timeout
const handle = setTimeout(() => reject(new Error('timeout')), this._thresholds.timeout);
return always(TPromise.join(promises), () => clearTimeout(handle)).then(resolve, reject);
......@@ -137,13 +137,7 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
let edits: IResourceEdit[] = [];
for (const value of values) {
if (value instanceof EndOfLineEdit) {
edits.push({
resource: <URI>document.uri,
eol: fromEOL(value.newEol)
});
} else if (Array.isArray(value) && (<vscode.TextEdit[]>value).every(e => e instanceof TextEdit)) {
if (Array.isArray(value) && (<vscode.TextEdit[]>value).every(e => e instanceof TextEdit)) {
for (const { newText, range } of value) {
edits.push({
resource: <URI>document.uri,
......
......@@ -404,19 +404,6 @@ export enum EndOfLine {
CRLF = 2
}
export class EndOfLineEdit {
static readonly LF: EndOfLineEdit = Object.freeze({ newEol: EndOfLine.LF });
static readonly CRLF: EndOfLineEdit = Object.freeze({ newEol: EndOfLine.CRLF });
newEol: EndOfLine;
constructor(newEol: EndOfLine) {
this.newEol = newEol;
}
}
export class TextEdit {
static isTextEdit(thing: any): thing is TextEdit {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册