mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
no EOLEdit for now, no replacement yet
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user