mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
extHost.protocol should not depend on extHostTypes, #70319
This commit is contained in:
@@ -8,12 +8,12 @@ import { SerializedError } from 'vs/base/common/errors';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
|
||||
import { TextEditorCursorStyle, RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
|
||||
import { IPosition } from 'vs/editor/common/core/position';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { ISelection, Selection } from 'vs/editor/common/core/selection';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { ISingleEditOperation } from 'vs/editor/common/model';
|
||||
import { ISingleEditOperation, EndOfLineSequence } from 'vs/editor/common/model';
|
||||
import { IModelChangedEvent } from 'vs/editor/common/model/mirrorTextModel';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { CharacterPair, CommentRule, EnterAction } from 'vs/editor/common/modes/languageConfiguration';
|
||||
@@ -29,7 +29,6 @@ import { IPatternInfo, IRawFileMatch2, IRawQuery, IRawTextQuery, ISearchComplete
|
||||
import { StatusbarAlignment as MainThreadStatusBarAlignment } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ThemeColor } from 'vs/platform/theme/common/themeService';
|
||||
import { EndOfLine, IFileOperationOptions, TextEditorLineNumbersStyle } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { EditorViewColumn } from 'vs/workbench/api/shared/editor';
|
||||
import { TaskDTO, TaskExecutionDTO, TaskFilterDTO, TaskHandleDTO, TaskProcessEndedDTO, TaskProcessStartedDTO, TaskSystemInfoDTO, TaskSetDTO } from 'vs/workbench/api/shared/tasks';
|
||||
import { ITreeItem, IRevealOptions } from 'vs/workbench/common/views';
|
||||
@@ -194,7 +193,7 @@ export interface ITextEditorConfigurationUpdate {
|
||||
indentSize?: number | 'tabSize';
|
||||
insertSpaces?: boolean | 'auto';
|
||||
cursorStyle?: TextEditorCursorStyle;
|
||||
lineNumbers?: TextEditorLineNumbersStyle;
|
||||
lineNumbers?: RenderLineNumbersType;
|
||||
}
|
||||
|
||||
export interface IResolvedTextEditorConfiguration {
|
||||
@@ -202,7 +201,7 @@ export interface IResolvedTextEditorConfiguration {
|
||||
indentSize: number;
|
||||
insertSpaces: boolean;
|
||||
cursorStyle: TextEditorCursorStyle;
|
||||
lineNumbers: TextEditorLineNumbersStyle;
|
||||
lineNumbers: RenderLineNumbersType;
|
||||
}
|
||||
|
||||
export enum TextEditorRevealType {
|
||||
@@ -218,7 +217,7 @@ export interface IUndoStopOptions {
|
||||
}
|
||||
|
||||
export interface IApplyEditsOptions extends IUndoStopOptions {
|
||||
setEndOfLine: EndOfLine;
|
||||
setEndOfLine: EndOfLineSequence;
|
||||
}
|
||||
|
||||
export interface ITextDocumentShowOptions {
|
||||
@@ -868,7 +867,12 @@ export interface WorkspaceSymbolsDto extends IdObject {
|
||||
export interface ResourceFileEditDto {
|
||||
oldUri?: UriComponents;
|
||||
newUri?: UriComponents;
|
||||
options?: IFileOperationOptions;
|
||||
options?: {
|
||||
overwrite?: boolean;
|
||||
ignoreIfExists?: boolean;
|
||||
ignoreIfNotExists?: boolean;
|
||||
recursive?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ResourceTextEditDto {
|
||||
|
||||
@@ -158,7 +158,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
|
||||
this._indentSize = source.indentSize;
|
||||
this._insertSpaces = source.insertSpaces;
|
||||
this._cursorStyle = source.cursorStyle;
|
||||
this._lineNumbers = source.lineNumbers;
|
||||
this._lineNumbers = TypeConverters.TextEditorLineNumbersStyle.to(source.lineNumbers);
|
||||
}
|
||||
|
||||
public get tabSize(): number | string {
|
||||
@@ -295,7 +295,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
|
||||
}
|
||||
this._lineNumbers = value;
|
||||
warnOnError(this._proxy.$trySetOptions(this._id, {
|
||||
lineNumbers: value
|
||||
lineNumbers: TypeConverters.TextEditorLineNumbersStyle.from(value)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
|
||||
if (this._lineNumbers !== newOptions.lineNumbers) {
|
||||
this._lineNumbers = newOptions.lineNumbers;
|
||||
hasUpdate = true;
|
||||
bulkConfigurationUpdate.lineNumbers = newOptions.lineNumbers;
|
||||
bulkConfigurationUpdate.lineNumbers = TypeConverters.TextEditorLineNumbersStyle.from(newOptions.lineNumbers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ export class ExtHostTextEditor implements vscode.TextEditor {
|
||||
});
|
||||
|
||||
return this._proxy.$tryApplyEdits(this._id, editData.documentVersionId, edits, {
|
||||
setEndOfLine: editData.setEndOfLine,
|
||||
setEndOfLine: TypeConverters.EndOfLine.from(editData.setEndOfLine),
|
||||
undoStopBefore: editData.undoStopBefore,
|
||||
undoStopAfter: editData.undoStopAfter
|
||||
});
|
||||
|
||||
@@ -118,7 +118,7 @@ export class ExtHostEditors implements ExtHostEditorsShape {
|
||||
if (data.options) {
|
||||
this._onDidChangeTextEditorOptions.fire({
|
||||
textEditor: textEditor,
|
||||
options: data.options
|
||||
options: { ...data.options, lineNumbers: TypeConverters.TextEditorLineNumbersStyle.to(data.options.lineNumbers) }
|
||||
});
|
||||
}
|
||||
if (data.selections) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import { parse } from 'vs/base/common/marshalling';
|
||||
import { cloneAndChange } from 'vs/base/common/objects';
|
||||
import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
export interface PositionLike {
|
||||
line: number;
|
||||
@@ -883,6 +884,31 @@ export namespace TextDocumentSaveReason {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace TextEditorLineNumbersStyle {
|
||||
export function from(style: vscode.TextEditorLineNumbersStyle): RenderLineNumbersType {
|
||||
switch (style) {
|
||||
case types.TextEditorLineNumbersStyle.Off:
|
||||
return RenderLineNumbersType.Off;
|
||||
case types.TextEditorLineNumbersStyle.Relative:
|
||||
return RenderLineNumbersType.Relative;
|
||||
case types.TextEditorLineNumbersStyle.On:
|
||||
default:
|
||||
return RenderLineNumbersType.On;
|
||||
}
|
||||
}
|
||||
export function to(style: RenderLineNumbersType): vscode.TextEditorLineNumbersStyle {
|
||||
switch (style) {
|
||||
case RenderLineNumbersType.Off:
|
||||
return types.TextEditorLineNumbersStyle.Off;
|
||||
case RenderLineNumbersType.Relative:
|
||||
return types.TextEditorLineNumbersStyle.Relative;
|
||||
case RenderLineNumbersType.On:
|
||||
default:
|
||||
return types.TextEditorLineNumbersStyle.On;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace EndOfLine {
|
||||
|
||||
export function from(eol: vscode.EndOfLine): EndOfLineSequence | undefined {
|
||||
|
||||
Reference in New Issue
Block a user