mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 00:35:30 +01:00
Eliminate extraneuous model interfaces
This commit is contained in:
@@ -62,12 +62,15 @@ export interface ICommandHandler {
|
||||
#include(vs/editor/standalone/browser/colorizer): IColorizerOptions, IColorizerElementOptions
|
||||
#include(vs/base/common/scrollable): ScrollbarVisibility
|
||||
#include(vs/platform/theme/common/themeService): ThemeColor
|
||||
#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier;editorOptions.=>): ISelection, IScrollEvent
|
||||
#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier;editorOptions.=>): IScrollEvent
|
||||
#includeAll(vs/editor/common/model/textModelEvents):
|
||||
#includeAll(vs/editor/common/controller/cursorEvents):
|
||||
#includeAll(vs/editor/common/config/editorOptions):
|
||||
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
|
||||
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
|
||||
|
||||
//compatibility:
|
||||
export type IReadOnlyModel = IModel;
|
||||
}
|
||||
|
||||
declare module monaco.languages {
|
||||
|
||||
@@ -20,11 +20,11 @@ export class ReplaceCommand implements editorCommon.ICommand {
|
||||
this.insertsAutoWhitespace = insertsAutoWhitespace;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
builder.addTrackedEditOperation(this._range, this._text);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
let inverseEditOperations = helper.getInverseEditOperations();
|
||||
let srcRange = inverseEditOperations[0].range;
|
||||
return new Selection(
|
||||
@@ -48,11 +48,11 @@ export class ReplaceCommandWithoutChangingPosition implements editorCommon.IComm
|
||||
this.insertsAutoWhitespace = insertsAutoWhitespace;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
builder.addTrackedEditOperation(this._range, this._text);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
let inverseEditOperations = helper.getInverseEditOperations();
|
||||
let srcRange = inverseEditOperations[0].range;
|
||||
return new Selection(
|
||||
@@ -80,11 +80,11 @@ export class ReplaceCommandWithOffsetCursorState implements editorCommon.IComman
|
||||
this.insertsAutoWhitespace = insertsAutoWhitespace;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
builder.addTrackedEditOperation(this._range, this._text);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
let inverseEditOperations = helper.getInverseEditOperations();
|
||||
let srcRange = inverseEditOperations[0].range;
|
||||
return new Selection(
|
||||
@@ -109,12 +109,12 @@ export class ReplaceCommandThatPreservesSelection implements editorCommon.IComma
|
||||
this._initialSelection = initialSelection;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
builder.addEditOperation(this._range, this._text);
|
||||
this._selectionId = builder.trackSelection(this._initialSelection);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this._selectionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as strings from 'vs/base/common/strings';
|
||||
import { CursorColumns } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection, SelectionDirection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, IModel } from 'vs/editor/common/editorCommon';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
|
||||
@@ -62,7 +62,7 @@ export class ShiftCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
const startLine = this._selection.startLineNumber;
|
||||
|
||||
let endLine = this._selection.endLineNumber;
|
||||
@@ -216,7 +216,7 @@ export class ShiftCommand implements ICommand {
|
||||
this._selectionId = builder.trackSelection(this._selection);
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
if (this._useLastEditRangeForCursorEndPosition) {
|
||||
let lastOp = helper.getInverseEditOperations()[0];
|
||||
return new Selection(lastOp.range.endLineNumber, lastOp.range.endColumn, lastOp.range.endLineNumber, lastOp.range.endColumn);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, IModel } from 'vs/editor/common/editorCommon';
|
||||
|
||||
export class SurroundSelectionCommand implements ICommand {
|
||||
private _range: Selection;
|
||||
@@ -19,7 +19,7 @@ export class SurroundSelectionCommand implements ICommand {
|
||||
this._charAfterSelection = charAfterSelection;
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
builder.addTrackedEditOperation(new Range(
|
||||
this._range.startLineNumber,
|
||||
this._range.startColumn,
|
||||
@@ -35,7 +35,7 @@ export class SurroundSelectionCommand implements ICommand {
|
||||
), this._charAfterSelection);
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
let inverseEditOperations = helper.getInverseEditOperations();
|
||||
let firstOperationRange = inverseEditOperations[0].range;
|
||||
let secondOperationRange = inverseEditOperations[1].range;
|
||||
|
||||
@@ -22,7 +22,7 @@ export class TrimTrailingWhitespaceCommand implements editorCommon.ICommand {
|
||||
this.cursors = cursors;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
let ops = trimTrailingWhitespace(model, this.cursors);
|
||||
for (let i = 0, len = ops.length; i < len; i++) {
|
||||
let op = ops[i];
|
||||
@@ -33,7 +33,7 @@ export class TrimTrailingWhitespaceCommand implements editorCommon.ICommand {
|
||||
this.selectionId = builder.trackSelection(this.selection);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this.selectionId);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export class TrimTrailingWhitespaceCommand implements editorCommon.ICommand {
|
||||
/**
|
||||
* Generate commands for trimming trailing whitespace on a model and ignore lines on which cursors are sitting.
|
||||
*/
|
||||
export function trimTrailingWhitespace(model: editorCommon.ITextModel, cursors: Position[]): editorCommon.IIdentifiedSingleEditOperation[] {
|
||||
export function trimTrailingWhitespace(model: editorCommon.IModel, cursors: Position[]): editorCommon.IIdentifiedSingleEditOperation[] {
|
||||
// Sort cursors ascending
|
||||
cursors.sort((a, b) => {
|
||||
if (a.lineNumber === b.lineNumber) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ReplaceCommand, ReplaceCommandWithoutChangingPosition, ReplaceCommandWithOffsetCursorState } from 'vs/editor/common/commands/replaceCommand';
|
||||
import { CursorColumns, CursorConfiguration, ICursorSimpleModel, EditOperationResult, EditOperationType } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { ICommand, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, IModel } from 'vs/editor/common/editorCommon';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ShiftCommand } from 'vs/editor/common/commands/shiftCommand';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
@@ -136,7 +136,7 @@ export class TypeOperations {
|
||||
}
|
||||
}
|
||||
|
||||
private static _goodIndentForLine(config: CursorConfiguration, model: ITokenizedModel, lineNumber: number): string {
|
||||
private static _goodIndentForLine(config: CursorConfiguration, model: IModel, lineNumber: number): string {
|
||||
let action: IndentAction | EnterAction;
|
||||
let indentation: string;
|
||||
|
||||
@@ -207,7 +207,7 @@ export class TypeOperations {
|
||||
return new ReplaceCommand(selection, typeText, insertsAutoWhitespace);
|
||||
}
|
||||
|
||||
public static tab(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[]): ICommand[] {
|
||||
public static tab(config: CursorConfiguration, model: IModel, selections: Selection[]): ICommand[] {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
const selection = selections[i];
|
||||
@@ -248,7 +248,7 @@ export class TypeOperations {
|
||||
return commands;
|
||||
}
|
||||
|
||||
public static replacePreviousChar(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], txt: string, replaceCharCnt: number): EditOperationResult {
|
||||
public static replacePreviousChar(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: IModel, selections: Selection[], txt: string, replaceCharCnt: number): EditOperationResult {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
const selection = selections[i];
|
||||
@@ -278,7 +278,7 @@ export class TypeOperations {
|
||||
}
|
||||
}
|
||||
|
||||
private static _enter(config: CursorConfiguration, model: ITokenizedModel, keepPosition: boolean, range: Range): ICommand {
|
||||
private static _enter(config: CursorConfiguration, model: IModel, keepPosition: boolean, range: Range): ICommand {
|
||||
if (!model.isCheapToTokenize(range.getStartPosition().lineNumber)) {
|
||||
let lineText = model.getLineContent(range.startLineNumber);
|
||||
let indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1);
|
||||
@@ -375,7 +375,7 @@ export class TypeOperations {
|
||||
}
|
||||
}
|
||||
|
||||
private static _isAutoIndentType(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[]): boolean {
|
||||
private static _isAutoIndentType(config: CursorConfiguration, model: IModel, selections: Selection[]): boolean {
|
||||
if (!config.autoIndent) {
|
||||
return false;
|
||||
}
|
||||
@@ -389,7 +389,7 @@ export class TypeOperations {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static _runAutoIndentType(config: CursorConfiguration, model: ITokenizedModel, range: Range, ch: string): ICommand {
|
||||
private static _runAutoIndentType(config: CursorConfiguration, model: IModel, range: Range, ch: string): ICommand {
|
||||
let currentIndentation = LanguageConfigurationRegistry.getIndentationAtPosition(model, range.startLineNumber, range.startColumn);
|
||||
let actualIndentation = LanguageConfigurationRegistry.getIndentActionForType(model, range, ch, {
|
||||
shiftIndent: (indentation) => {
|
||||
@@ -425,7 +425,7 @@ export class TypeOperations {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static _isAutoClosingCloseCharType(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], ch: string): boolean {
|
||||
private static _isAutoClosingCloseCharType(config: CursorConfiguration, model: IModel, selections: Selection[], ch: string): boolean {
|
||||
if (!config.autoClosingBrackets || !config.autoClosingPairsClose.hasOwnProperty(ch)) {
|
||||
return false;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ export class TypeOperations {
|
||||
return cnt;
|
||||
}
|
||||
|
||||
private static _runAutoClosingCloseCharType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
private static _runAutoClosingCloseCharType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: IModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
const selection = selections[i];
|
||||
@@ -482,7 +482,7 @@ export class TypeOperations {
|
||||
});
|
||||
}
|
||||
|
||||
private static _isAutoClosingOpenCharType(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], ch: string): boolean {
|
||||
private static _isAutoClosingOpenCharType(config: CursorConfiguration, model: IModel, selections: Selection[], ch: string): boolean {
|
||||
if (!config.autoClosingBrackets || !config.autoClosingPairsOpen.hasOwnProperty(ch)) {
|
||||
return false;
|
||||
}
|
||||
@@ -550,7 +550,7 @@ export class TypeOperations {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static _runAutoClosingOpenCharType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
private static _runAutoClosingOpenCharType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: IModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
const selection = selections[i];
|
||||
@@ -563,7 +563,7 @@ export class TypeOperations {
|
||||
});
|
||||
}
|
||||
|
||||
private static _isSurroundSelectionType(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], ch: string): boolean {
|
||||
private static _isSurroundSelectionType(config: CursorConfiguration, model: IModel, selections: Selection[], ch: string): boolean {
|
||||
if (!config.autoClosingBrackets || !config.surroundingPairs.hasOwnProperty(ch)) {
|
||||
return false;
|
||||
}
|
||||
@@ -597,7 +597,7 @@ export class TypeOperations {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static _runSurroundSelectionType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
private static _runSurroundSelectionType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: IModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
const selection = selections[i];
|
||||
@@ -610,14 +610,14 @@ export class TypeOperations {
|
||||
});
|
||||
}
|
||||
|
||||
private static _isTypeInterceptorElectricChar(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[]) {
|
||||
private static _isTypeInterceptorElectricChar(config: CursorConfiguration, model: IModel, selections: Selection[]) {
|
||||
if (selections.length === 1 && model.isCheapToTokenize(selections[0].getEndPosition().lineNumber)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static _typeInterceptorElectricChar(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITokenizedModel, selection: Selection, ch: string): EditOperationResult {
|
||||
private static _typeInterceptorElectricChar(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: IModel, selection: Selection, ch: string): EditOperationResult {
|
||||
if (!config.electricChars.hasOwnProperty(ch) || !selection.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -680,7 +680,7 @@ export class TypeOperations {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static typeWithInterceptors(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
public static typeWithInterceptors(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: IModel, selections: Selection[], ch: string): EditOperationResult {
|
||||
|
||||
if (ch === '\n') {
|
||||
let commands: ICommand[] = [];
|
||||
@@ -747,7 +747,7 @@ export class TypeOperations {
|
||||
});
|
||||
}
|
||||
|
||||
public static typeWithoutInterceptors(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITokenizedModel, selections: Selection[], str: string): EditOperationResult {
|
||||
public static typeWithoutInterceptors(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: IModel, selections: Selection[], str: string): EditOperationResult {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
commands[i] = new ReplaceCommand(selections[i], str);
|
||||
@@ -758,7 +758,7 @@ export class TypeOperations {
|
||||
});
|
||||
}
|
||||
|
||||
public static lineInsertBefore(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[]): ICommand[] {
|
||||
public static lineInsertBefore(config: CursorConfiguration, model: IModel, selections: Selection[]): ICommand[] {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
let lineNumber = selections[i].positionLineNumber;
|
||||
@@ -775,7 +775,7 @@ export class TypeOperations {
|
||||
return commands;
|
||||
}
|
||||
|
||||
public static lineInsertAfter(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[]): ICommand[] {
|
||||
public static lineInsertAfter(config: CursorConfiguration, model: IModel, selections: Selection[]): ICommand[] {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
const lineNumber = selections[i].positionLineNumber;
|
||||
@@ -785,7 +785,7 @@ export class TypeOperations {
|
||||
return commands;
|
||||
}
|
||||
|
||||
public static lineBreakInsert(config: CursorConfiguration, model: ITokenizedModel, selections: Selection[]): ICommand[] {
|
||||
public static lineBreakInsert(config: CursorConfiguration, model: IModel, selections: Selection[]): ICommand[] {
|
||||
let commands: ICommand[] = [];
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
commands[i] = this._enter(config, model, true, selections[i]);
|
||||
|
||||
@@ -336,7 +336,7 @@ export interface ICommand {
|
||||
* @param model The model the command will execute on.
|
||||
* @param builder A helper to collect the needed edit operations and to track selections.
|
||||
*/
|
||||
getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void;
|
||||
getEditOperations(model: IModel, builder: IEditOperationBuilder): void;
|
||||
|
||||
/**
|
||||
* Compute the cursor state after the edit operations were applied.
|
||||
@@ -344,7 +344,7 @@ export interface ICommand {
|
||||
* @param helper A helper to get inverse edit operations and to get previously tracked selections.
|
||||
* @return The cursor state after the command executed.
|
||||
*/
|
||||
computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection;
|
||||
computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -474,10 +474,46 @@ export interface ITextModelUpdateOptions {
|
||||
trimAutoWhitespace?: boolean;
|
||||
}
|
||||
|
||||
export class FindMatch {
|
||||
_findMatchBrand: void;
|
||||
|
||||
public readonly range: Range;
|
||||
public readonly matches: string[];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(range: Range, matches: string[]) {
|
||||
this.range = range;
|
||||
this.matches = matches;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A textual read-only model.
|
||||
* @internal
|
||||
*/
|
||||
export interface ITextModel {
|
||||
export interface IFoundBracket {
|
||||
range: Range;
|
||||
open: string;
|
||||
close: string;
|
||||
isOpen: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the behavior of decorations when typing/editing near their edges.
|
||||
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
|
||||
*/
|
||||
export enum TrackedRangeStickiness {
|
||||
AlwaysGrowsWhenTypingAtEdges = 0,
|
||||
NeverGrowsWhenTypingAtEdges = 1,
|
||||
GrowsOnlyWhenTypingBefore = 2,
|
||||
GrowsOnlyWhenTypingAfter = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* A model.
|
||||
*/
|
||||
export interface IModel {
|
||||
|
||||
/**
|
||||
* If true, the text model might contain RTL.
|
||||
@@ -724,24 +760,7 @@ export interface ITextModel {
|
||||
* @return The range where the previous match is. It is null if no previous match has been found.
|
||||
*/
|
||||
findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch;
|
||||
}
|
||||
|
||||
export class FindMatch {
|
||||
_findMatchBrand: void;
|
||||
|
||||
public readonly range: Range;
|
||||
public readonly matches: string[];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(range: Range, matches: string[]) {
|
||||
this.range = range;
|
||||
this.matches = matches;
|
||||
}
|
||||
}
|
||||
|
||||
export interface IReadOnlyModel extends ITextModel {
|
||||
/**
|
||||
* Gets the resource associated with this editor model.
|
||||
*/
|
||||
@@ -773,22 +792,6 @@ export interface IReadOnlyModel extends ITextModel {
|
||||
* @return The word under or besides `position`. Will never be null.
|
||||
*/
|
||||
getWordUntilPosition(position: IPosition): IWordAtPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface IFoundBracket {
|
||||
range: Range;
|
||||
open: string;
|
||||
close: string;
|
||||
isOpen: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A model that is tokenized.
|
||||
*/
|
||||
export interface ITokenizedModel extends ITextModel {
|
||||
|
||||
/**
|
||||
* Force tokenization information for `lineNumber` to be accurate.
|
||||
@@ -894,23 +897,7 @@ export interface ITokenizedModel extends ITextModel {
|
||||
* @internal
|
||||
*/
|
||||
getLinesIndentGuides(startLineNumber: number, endLineNumber: number): number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the behavior of decorations when typing/editing near their edges.
|
||||
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
|
||||
*/
|
||||
export enum TrackedRangeStickiness {
|
||||
AlwaysGrowsWhenTypingAtEdges = 0,
|
||||
NeverGrowsWhenTypingAtEdges = 1,
|
||||
GrowsOnlyWhenTypingBefore = 2,
|
||||
GrowsOnlyWhenTypingAfter = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* A model that can have decorations.
|
||||
*/
|
||||
export interface ITextModelWithDecorations {
|
||||
/**
|
||||
* Change the decorations. The callback will be called with a change accessor
|
||||
* that becomes invalid as soon as the callback finishes executing.
|
||||
@@ -1006,12 +993,6 @@ export interface ITextModelWithDecorations {
|
||||
* @internal
|
||||
*/
|
||||
_setTrackedRange(id: string, newRange: Range, newStickiness: TrackedRangeStickiness): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An editable text model.
|
||||
*/
|
||||
export interface IEditableTextModel extends ITextModel {
|
||||
|
||||
/**
|
||||
* Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
|
||||
@@ -1071,12 +1052,7 @@ export interface IEditableTextModel extends ITextModel {
|
||||
* @internal
|
||||
*/
|
||||
redo(): Selection[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A model.
|
||||
*/
|
||||
export interface IModel extends IReadOnlyModel, IEditableTextModel, ITokenizedModel, ITextModelWithDecorations {
|
||||
/**
|
||||
* @deprecated Please use `onDidChangeContent` instead.
|
||||
* An event emitted when the contents of the model have changed.
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
'use strict';
|
||||
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ICursorStateComputer, IEditableTextModel, IIdentifiedSingleEditOperation } from 'vs/editor/common/editorCommon';
|
||||
import { ICursorStateComputer, IIdentifiedSingleEditOperation } from 'vs/editor/common/editorCommon';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
|
||||
interface IEditOperation {
|
||||
operations: IIdentifiedSingleEditOperation[];
|
||||
@@ -29,12 +30,12 @@ export interface IUndoRedoResult {
|
||||
|
||||
export class EditStack {
|
||||
|
||||
private model: IEditableTextModel;
|
||||
private model: TextModel;
|
||||
private currentOpenStackElement: IStackElement;
|
||||
private past: IStackElement[];
|
||||
private future: IStackElement[];
|
||||
|
||||
constructor(model: IEditableTextModel) {
|
||||
constructor(model: TextModel) {
|
||||
this.model = model;
|
||||
this.currentOpenStackElement = null;
|
||||
this.past = [];
|
||||
|
||||
@@ -59,7 +59,7 @@ export interface ITextModelCreationData {
|
||||
readonly options: editorCommon.TextModelResolvedOptions;
|
||||
}
|
||||
|
||||
export class TextModel extends Disposable implements editorCommon.IModel, editorCommon.IEditableTextModel, editorCommon.ITextModelWithDecorations, editorCommon.ITokenizedModel, editorCommon.ITextModel {
|
||||
export class TextModel extends Disposable implements editorCommon.IModel {
|
||||
|
||||
private static readonly MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB
|
||||
private static readonly MODEL_TOKENIZATION_LIMIT = 20 * 1024 * 1024; // 20 MB
|
||||
|
||||
@@ -181,7 +181,7 @@ export interface HoverProvider {
|
||||
* position will be merged by the editor. A hover can have a range which defaults
|
||||
* to the word range at the position when omitted.
|
||||
*/
|
||||
provideHover(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): Hover | Thenable<Hover>;
|
||||
provideHover(model: editorCommon.IModel, position: Position, token: CancellationToken): Hover | Thenable<Hover>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +292,7 @@ export interface CodeActionProvider {
|
||||
/**
|
||||
* Provide commands for the given document and range.
|
||||
*/
|
||||
provideCodeActions(model: editorCommon.IReadOnlyModel, range: Range, token: CancellationToken): CodeAction[] | Thenable<CodeAction[]>;
|
||||
provideCodeActions(model: editorCommon.IModel, range: Range, token: CancellationToken): CodeAction[] | Thenable<CodeAction[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,7 +362,7 @@ export interface SignatureHelpProvider {
|
||||
/**
|
||||
* Provide help for the signature at the given position and document.
|
||||
*/
|
||||
provideSignatureHelp(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): SignatureHelp | Thenable<SignatureHelp>;
|
||||
provideSignatureHelp(model: editorCommon.IModel, position: Position, token: CancellationToken): SignatureHelp | Thenable<SignatureHelp>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,7 +406,7 @@ export interface DocumentHighlightProvider {
|
||||
* Provide a set of document highlights, like all occurrences of a variable or
|
||||
* all exit-points of a function.
|
||||
*/
|
||||
provideDocumentHighlights(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable<DocumentHighlight[]>;
|
||||
provideDocumentHighlights(model: editorCommon.IModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable<DocumentHighlight[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -427,7 +427,7 @@ export interface ReferenceProvider {
|
||||
/**
|
||||
* Provide a set of project-wide references for the given position and document.
|
||||
*/
|
||||
provideReferences(model: editorCommon.IReadOnlyModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable<Location[]>;
|
||||
provideReferences(model: editorCommon.IModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable<Location[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -460,7 +460,7 @@ export interface DefinitionProvider {
|
||||
/**
|
||||
* Provide the definition of the symbol at the given position and document.
|
||||
*/
|
||||
provideDefinition(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
provideDefinition(model: editorCommon.IModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,7 +471,7 @@ export interface ImplementationProvider {
|
||||
/**
|
||||
* Provide the implementation of the symbol at the given position and document.
|
||||
*/
|
||||
provideImplementation(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
provideImplementation(model: editorCommon.IModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -482,7 +482,7 @@ export interface TypeDefinitionProvider {
|
||||
/**
|
||||
* Provide the type definition of the symbol at the given position and document.
|
||||
*/
|
||||
provideTypeDefinition(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
provideTypeDefinition(model: editorCommon.IModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -592,7 +592,7 @@ export interface DocumentSymbolProvider {
|
||||
/**
|
||||
* Provide symbol information for the given document.
|
||||
*/
|
||||
provideDocumentSymbols(model: editorCommon.IReadOnlyModel, token: CancellationToken): SymbolInformation[] | Thenable<SymbolInformation[]>;
|
||||
provideDocumentSymbols(model: editorCommon.IModel, token: CancellationToken): SymbolInformation[] | Thenable<SymbolInformation[]>;
|
||||
}
|
||||
|
||||
export interface TextEdit {
|
||||
@@ -622,7 +622,7 @@ export interface DocumentFormattingEditProvider {
|
||||
/**
|
||||
* Provide formatting edits for a whole document.
|
||||
*/
|
||||
provideDocumentFormattingEdits(model: editorCommon.IReadOnlyModel, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
provideDocumentFormattingEdits(model: editorCommon.IModel, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
}
|
||||
/**
|
||||
* The document formatting provider interface defines the contract between extensions and
|
||||
@@ -636,7 +636,7 @@ export interface DocumentRangeFormattingEditProvider {
|
||||
* or larger range. Often this is done by adjusting the start and end
|
||||
* of the range to full syntax nodes.
|
||||
*/
|
||||
provideDocumentRangeFormattingEdits(model: editorCommon.IReadOnlyModel, range: Range, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
provideDocumentRangeFormattingEdits(model: editorCommon.IModel, range: Range, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
}
|
||||
/**
|
||||
* The document formatting provider interface defines the contract between extensions and
|
||||
@@ -651,7 +651,7 @@ export interface OnTypeFormattingEditProvider {
|
||||
* what range the position to expand to, like find the matching `{`
|
||||
* when `}` has been entered.
|
||||
*/
|
||||
provideOnTypeFormattingEdits(model: editorCommon.IReadOnlyModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
provideOnTypeFormattingEdits(model: editorCommon.IModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -673,7 +673,7 @@ export interface ILink {
|
||||
* A provider of links.
|
||||
*/
|
||||
export interface LinkProvider {
|
||||
provideLinks(model: editorCommon.IReadOnlyModel, token: CancellationToken): ILink[] | Thenable<ILink[]>;
|
||||
provideLinks(model: editorCommon.IModel, token: CancellationToken): ILink[] | Thenable<ILink[]>;
|
||||
resolveLink?: (link: ILink, token: CancellationToken) => ILink | Thenable<ILink>;
|
||||
}
|
||||
|
||||
@@ -748,11 +748,11 @@ export interface DocumentColorProvider {
|
||||
/**
|
||||
* Provides the color ranges for a specific model.
|
||||
*/
|
||||
provideDocumentColors(model: editorCommon.IReadOnlyModel, token: CancellationToken): IColorInformation[] | Thenable<IColorInformation[]>;
|
||||
provideDocumentColors(model: editorCommon.IModel, token: CancellationToken): IColorInformation[] | Thenable<IColorInformation[]>;
|
||||
/**
|
||||
* Provide the string representations for a color.
|
||||
*/
|
||||
provideColorPresentations(model: editorCommon.IReadOnlyModel, colorInfo: IColorInformation, token: CancellationToken): IColorPresentation[] | Thenable<IColorPresentation[]>;
|
||||
provideColorPresentations(model: editorCommon.IModel, colorInfo: IColorInformation, token: CancellationToken): IColorPresentation[] | Thenable<IColorPresentation[]>;
|
||||
}
|
||||
|
||||
export interface IResourceEdit {
|
||||
@@ -765,7 +765,7 @@ export interface WorkspaceEdit {
|
||||
rejectReason?: string;
|
||||
}
|
||||
export interface RenameProvider {
|
||||
provideRenameEdits(model: editorCommon.IReadOnlyModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable<WorkspaceEdit>;
|
||||
provideRenameEdits(model: editorCommon.IModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable<WorkspaceEdit>;
|
||||
}
|
||||
|
||||
|
||||
@@ -782,8 +782,8 @@ export interface ICodeLensSymbol {
|
||||
}
|
||||
export interface CodeLensProvider {
|
||||
onDidChange?: Event<this>;
|
||||
provideCodeLenses(model: editorCommon.IReadOnlyModel, token: CancellationToken): ICodeLensSymbol[] | Thenable<ICodeLensSymbol[]>;
|
||||
resolveCodeLens?(model: editorCommon.IReadOnlyModel, codeLens: ICodeLensSymbol, token: CancellationToken): ICodeLensSymbol | Thenable<ICodeLensSymbol>;
|
||||
provideCodeLenses(model: editorCommon.IModel, token: CancellationToken): ICodeLensSymbol[] | Thenable<ICodeLensSymbol[]>;
|
||||
resolveCodeLens?(model: editorCommon.IModel, codeLens: ICodeLensSymbol, token: CancellationToken): ICodeLensSymbol | Thenable<ICodeLensSymbol>;
|
||||
}
|
||||
|
||||
// --- feature registries ------
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IOnEnterSupportOptions, OnEnterSupport } from 'vs/editor/common/modes/s
|
||||
import { IndentRulesSupport, IndentConsts } from 'vs/editor/common/modes/supports/indentRules';
|
||||
import { RichEditBrackets } from 'vs/editor/common/modes/supports/richEditBrackets';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -544,7 +544,7 @@ export class LanguageConfigurationRegistryImpl {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getIndentForEnter(model: ITokenizedModel, range: Range, indentConverter: IIndentConverter, autoIndent: boolean): { beforeEnter: string, afterEnter: string } {
|
||||
public getIndentForEnter(model: IModel, range: Range, indentConverter: IIndentConverter, autoIndent: boolean): { beforeEnter: string, afterEnter: string } {
|
||||
model.forceTokenization(range.startLineNumber);
|
||||
let lineTokens = model.getLineTokens(range.startLineNumber);
|
||||
|
||||
@@ -642,7 +642,7 @@ export class LanguageConfigurationRegistryImpl {
|
||||
* We should always allow intentional indentation. It means, if users change the indentation of `lineNumber` and the content of
|
||||
* this line doesn't match decreaseIndentPattern, we should not adjust the indentation.
|
||||
*/
|
||||
public getIndentActionForType(model: ITokenizedModel, range: Range, ch: string, indentConverter: IIndentConverter): string {
|
||||
public getIndentActionForType(model: IModel, range: Range, ch: string, indentConverter: IIndentConverter): string {
|
||||
let scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn);
|
||||
let indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId);
|
||||
if (!indentRulesSupport) {
|
||||
@@ -683,7 +683,7 @@ export class LanguageConfigurationRegistryImpl {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getIndentMetadata(model: ITokenizedModel, lineNumber: number): number {
|
||||
public getIndentMetadata(model: IModel, lineNumber: number): number {
|
||||
let indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id);
|
||||
if (!indentRulesSupport) {
|
||||
return null;
|
||||
@@ -708,13 +708,13 @@ export class LanguageConfigurationRegistryImpl {
|
||||
return value.onEnter || null;
|
||||
}
|
||||
|
||||
public getRawEnterActionAtPosition(model: ITokenizedModel, lineNumber: number, column: number): EnterAction {
|
||||
public getRawEnterActionAtPosition(model: IModel, lineNumber: number, column: number): EnterAction {
|
||||
let r = this.getEnterAction(model, new Range(lineNumber, column, lineNumber, column));
|
||||
|
||||
return r ? r.enterAction : null;
|
||||
}
|
||||
|
||||
public getEnterAction(model: ITokenizedModel, range: Range): { enterAction: EnterAction; indentation: string; } {
|
||||
public getEnterAction(model: IModel, range: Range): { enterAction: EnterAction; indentation: string; } {
|
||||
let indentation = this.getIndentationAtPosition(model, range.startLineNumber, range.startColumn);
|
||||
|
||||
let scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn);
|
||||
@@ -780,7 +780,7 @@ export class LanguageConfigurationRegistryImpl {
|
||||
};
|
||||
}
|
||||
|
||||
public getIndentationAtPosition(model: ITokenizedModel, lineNumber: number, column: number): string {
|
||||
public getIndentationAtPosition(model: IModel, lineNumber: number, column: number): string {
|
||||
let lineText = model.getLineContent(lineNumber);
|
||||
let indentation = strings.getLeadingWhitespace(lineText);
|
||||
if (indentation.length > column - 1) {
|
||||
@@ -790,7 +790,7 @@ export class LanguageConfigurationRegistryImpl {
|
||||
return indentation;
|
||||
}
|
||||
|
||||
private getScopedLineTokens(model: ITokenizedModel, lineNumber: number, columnNumber?: number) {
|
||||
private getScopedLineTokens(model: IModel, lineNumber: number, columnNumber?: number) {
|
||||
model.forceTokenization(lineNumber);
|
||||
let lineTokens = model.getLineTokens(lineNumber);
|
||||
let column = isNaN(columnNumber) ? model.getLineMaxColumn(lineNumber) - 1 : columnNumber - 1;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { LanguageSelector, score } from 'vs/editor/common/modes/languageSelector';
|
||||
|
||||
interface Entry<T> {
|
||||
@@ -58,11 +58,11 @@ export default class LanguageFeatureRegistry<T> {
|
||||
};
|
||||
}
|
||||
|
||||
has(model: IReadOnlyModel): boolean {
|
||||
has(model: IModel): boolean {
|
||||
return this.all(model).length > 0;
|
||||
}
|
||||
|
||||
all(model: IReadOnlyModel): T[] {
|
||||
all(model: IModel): T[] {
|
||||
if (!model || model.isTooLargeForHavingARichMode()) {
|
||||
return [];
|
||||
}
|
||||
@@ -80,13 +80,13 @@ export default class LanguageFeatureRegistry<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
ordered(model: IReadOnlyModel): T[] {
|
||||
ordered(model: IModel): T[] {
|
||||
const result: T[] = [];
|
||||
this._orderedForEach(model, entry => result.push(entry.provider));
|
||||
return result;
|
||||
}
|
||||
|
||||
orderedGroups(model: IReadOnlyModel): T[][] {
|
||||
orderedGroups(model: IModel): T[][] {
|
||||
const result: T[][] = [];
|
||||
let lastBucket: T[];
|
||||
let lastBucketScore: number;
|
||||
@@ -104,7 +104,7 @@ export default class LanguageFeatureRegistry<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
private _orderedForEach(model: IReadOnlyModel, callback: (provider: Entry<T>) => any): void {
|
||||
private _orderedForEach(model: IModel, callback: (provider: Entry<T>) => any): void {
|
||||
|
||||
if (!model || model.isTooLargeForHavingARichMode()) {
|
||||
return;
|
||||
@@ -122,7 +122,7 @@ export default class LanguageFeatureRegistry<T> {
|
||||
|
||||
private _lastCandidate: { uri: string; language: string; };
|
||||
|
||||
private _updateScores(model: IReadOnlyModel): void {
|
||||
private _updateScores(model: IModel): void {
|
||||
|
||||
let candidate = {
|
||||
uri: model.uri.toString(),
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, IModel } from 'vs/editor/common/editorCommon';
|
||||
|
||||
export class MoveCaretCommand implements ICommand {
|
||||
|
||||
@@ -24,7 +24,7 @@ export class MoveCaretCommand implements ICommand {
|
||||
this._isMovingLeft = isMovingLeft;
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
var s = this._selection;
|
||||
this._selectionId = builder.trackSelection(s);
|
||||
if (s.startLineNumber !== s.endLineNumber) {
|
||||
@@ -63,7 +63,7 @@ export class MoveCaretCommand implements ICommand {
|
||||
this._moved = true;
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
var result = helper.getTrackedSelection(this._selectionId);
|
||||
if (this._moved) {
|
||||
result = result.setStartPosition(result.startLineNumber, this._cutStartIndex);
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ColorProviderRegistry, DocumentColorProvider, IColorInformation, IColorPresentation } from 'vs/editor/common/modes';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
|
||||
export interface IColorData {
|
||||
colorInfo: IColorInformation;
|
||||
provider: DocumentColorProvider;
|
||||
}
|
||||
|
||||
export function getColors(model: IReadOnlyModel): TPromise<IColorData[]> {
|
||||
export function getColors(model: IModel): TPromise<IColorData[]> {
|
||||
const colors: IColorData[] = [];
|
||||
const providers = ColorProviderRegistry.ordered(model).reverse();
|
||||
const promises = providers.map(provider => asWinJsPromise(token => provider.provideDocumentColors(model, token)).then(result => {
|
||||
@@ -27,6 +27,6 @@ export function getColors(model: IReadOnlyModel): TPromise<IColorData[]> {
|
||||
return TPromise.join(promises).then(() => colors);
|
||||
}
|
||||
|
||||
export function getColorPresentations(model: IReadOnlyModel, colorInfo: IColorInformation, provider: DocumentColorProvider): TPromise<IColorPresentation[]> {
|
||||
export function getColorPresentations(model: IModel, colorInfo: IColorInformation, provider: DocumentColorProvider): TPromise<IColorPresentation[]> {
|
||||
return asWinJsPromise(token => provider.provideColorPresentations(model, colorInfo, token));
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class BlockCommentCommand implements editorCommon.ICommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
private _createOperationsForBlockComment(selection: Range, config: ICommentsConfiguration, model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
private _createOperationsForBlockComment(selection: Range, config: ICommentsConfiguration, model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
const startLineNumber = selection.startLineNumber;
|
||||
const startColumn = selection.startColumn;
|
||||
const endLineNumber = selection.endLineNumber;
|
||||
@@ -153,7 +153,7 @@ export class BlockCommentCommand implements editorCommon.ICommand {
|
||||
return res;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
const startLineNumber = this._selection.startLineNumber;
|
||||
const startColumn = this._selection.startColumn;
|
||||
|
||||
@@ -170,7 +170,7 @@ export class BlockCommentCommand implements editorCommon.ICommand {
|
||||
);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
const inverseEditOperations = helper.getInverseEditOperations();
|
||||
if (inverseEditOperations.length === 2) {
|
||||
const startTokenEditOperation = inverseEditOperations[0];
|
||||
|
||||
@@ -62,7 +62,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
|
||||
* Do an initial pass over the lines and gather info about the line comment string.
|
||||
* Returns null if any of the lines doesn't support a line comment string.
|
||||
*/
|
||||
public static _gatherPreflightCommentStrings(model: editorCommon.ITokenizedModel, startLineNumber: number, endLineNumber: number): ILinePreflightData[] {
|
||||
public static _gatherPreflightCommentStrings(model: editorCommon.IModel, startLineNumber: number, endLineNumber: number): ILinePreflightData[] {
|
||||
|
||||
model.tokenizeIfCheap(startLineNumber);
|
||||
const languageId = model.getLanguageIdAtPosition(startLineNumber, 1);
|
||||
@@ -173,7 +173,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
|
||||
/**
|
||||
* Analyze all lines and decide exactly what to do => not supported | insert line comments | remove line comments
|
||||
*/
|
||||
public static _gatherPreflightData(type: Type, model: editorCommon.ITokenizedModel, startLineNumber: number, endLineNumber: number): IPreflightData {
|
||||
public static _gatherPreflightData(type: Type, model: editorCommon.IModel, startLineNumber: number, endLineNumber: number): IPreflightData {
|
||||
var lines = LineCommentCommand._gatherPreflightCommentStrings(model, startLineNumber, endLineNumber);
|
||||
if (lines === null) {
|
||||
return {
|
||||
@@ -215,7 +215,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
|
||||
this._selectionId = builder.trackSelection(s);
|
||||
}
|
||||
|
||||
private _attemptRemoveBlockComment(model: editorCommon.ITokenizedModel, s: Selection, startToken: string, endToken: string): editorCommon.IIdentifiedSingleEditOperation[] {
|
||||
private _attemptRemoveBlockComment(model: editorCommon.IModel, s: Selection, startToken: string, endToken: string): editorCommon.IIdentifiedSingleEditOperation[] {
|
||||
let startLineNumber = s.startLineNumber;
|
||||
let endLineNumber = s.endLineNumber;
|
||||
|
||||
@@ -268,7 +268,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
|
||||
/**
|
||||
* Given an unsuccessful analysis, delegate to the block comment command
|
||||
*/
|
||||
private _executeBlockComment(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder, s: Selection): void {
|
||||
private _executeBlockComment(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder, s: Selection): void {
|
||||
model.tokenizeIfCheap(s.startLineNumber);
|
||||
let languageId = model.getLanguageIdAtPosition(s.startLineNumber, 1);
|
||||
let config = LanguageConfigurationRegistry.getComments(languageId);
|
||||
@@ -309,7 +309,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
|
||||
var s = this._selection;
|
||||
this._moveEndPositionDown = false;
|
||||
@@ -327,7 +327,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
|
||||
return this._executeBlockComment(model, builder, s);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
var result = helper.getTrackedSelection(this._selectionId);
|
||||
|
||||
if (this._moveEndPositionDown) {
|
||||
|
||||
@@ -23,7 +23,7 @@ export class DragAndDropCommand implements editorCommon.ICommand {
|
||||
this.copy = copy;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
let text = model.getValueInRange(this.selection);
|
||||
if (!this.copy) {
|
||||
builder.addEditOperation(this.selection, null);
|
||||
@@ -101,7 +101,7 @@ export class DragAndDropCommand implements editorCommon.ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
return this.targetSelection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
|
||||
this._replaceStrings = replaceStrings;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
if (this._ranges.length > 0) {
|
||||
// Collect all edit operations
|
||||
var ops: IEditOperation[] = [];
|
||||
@@ -65,7 +65,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
|
||||
this._trackedEditorSelectionId = builder.trackSelection(this._editorSelection);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this._trackedEditorSelectionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { ITextModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { FoldingMarkers } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { computeIndentLevel } from 'vs/editor/common/model/modelLine';
|
||||
import { FoldingRanges, MAX_LINE_NUMBER } from 'vs/editor/contrib/folding/foldingRanges';
|
||||
@@ -41,7 +41,7 @@ export class RangesCollector {
|
||||
}
|
||||
}
|
||||
|
||||
public toIndentRanges(model: ITextModel) {
|
||||
public toIndentRanges(model: IModel) {
|
||||
if (this._length <= this._FoldingRangesLimit) {
|
||||
// reverse and create arrays of the exact length
|
||||
let startIndexes = new Uint32Array(this._length);
|
||||
@@ -87,7 +87,7 @@ export class RangesCollector {
|
||||
|
||||
interface PreviousRegion { indent: number; line: number; marker: boolean; }
|
||||
|
||||
export function computeRanges(model: ITextModel, offSide: boolean, markers?: FoldingMarkers, FoldingRangesLimit = MAX_FOLDING_REGIONS_FOR_INDENT_LIMIT): FoldingRanges {
|
||||
export function computeRanges(model: IModel, offSide: boolean, markers?: FoldingMarkers, FoldingRangesLimit = MAX_FOLDING_REGIONS_FOR_INDENT_LIMIT): FoldingRanges {
|
||||
const tabSize = model.getOptions().tabSize;
|
||||
let result = new RangesCollector(FoldingRangesLimit);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import URI from 'vs/base/common/uri';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { registerDefaultLanguageCommand, registerLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { DocumentFormattingEditProviderRegistry, DocumentRangeFormattingEditProviderRegistry, OnTypeFormattingEditProviderRegistry, FormattingOptions, TextEdit } from 'vs/editor/common/modes';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -28,7 +28,7 @@ export class NoProviderError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export function getDocumentRangeFormattingEdits(model: IReadOnlyModel, range: Range, options: FormattingOptions): TPromise<TextEdit[], NoProviderError> {
|
||||
export function getDocumentRangeFormattingEdits(model: IModel, range: Range, options: FormattingOptions): TPromise<TextEdit[], NoProviderError> {
|
||||
|
||||
const providers = DocumentRangeFormattingEditProviderRegistry.ordered(model);
|
||||
|
||||
@@ -49,7 +49,7 @@ export function getDocumentRangeFormattingEdits(model: IReadOnlyModel, range: Ra
|
||||
})).then(() => result);
|
||||
}
|
||||
|
||||
export function getDocumentFormattingEdits(model: IReadOnlyModel, options: FormattingOptions): TPromise<TextEdit[]> {
|
||||
export function getDocumentFormattingEdits(model: IModel, options: FormattingOptions): TPromise<TextEdit[]> {
|
||||
const providers = DocumentFormattingEditProviderRegistry.ordered(model);
|
||||
|
||||
// try range formatters when no document formatter is registered
|
||||
@@ -70,7 +70,7 @@ export function getDocumentFormattingEdits(model: IReadOnlyModel, options: Forma
|
||||
})).then(() => result);
|
||||
}
|
||||
|
||||
export function getOnTypeFormattingEdits(model: IReadOnlyModel, position: Position, ch: string, options: FormattingOptions): TPromise<TextEdit[]> {
|
||||
export function getOnTypeFormattingEdits(model: IModel, position: Position, ch: string, options: FormattingOptions): TPromise<TextEdit[]> {
|
||||
const [support] = OnTypeFormattingEditProviderRegistry.ordered(model);
|
||||
if (!support) {
|
||||
return TPromise.as(undefined);
|
||||
|
||||
@@ -44,7 +44,7 @@ export class EditOperationsCommand implements editorCommon.ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
|
||||
for (let edit of this._edits) {
|
||||
// We know that this edit.range comes from the mirror model, so it should only contain \n and no \r's
|
||||
@@ -72,11 +72,11 @@ export class EditOperationsCommand implements editorCommon.ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this._selectionId);
|
||||
}
|
||||
|
||||
static fixLineTerminators(edit: editorCommon.ISingleEditOperation, model: editorCommon.ITokenizedModel): void {
|
||||
static fixLineTerminators(edit: editorCommon.ISingleEditOperation, model: editorCommon.IModel): void {
|
||||
edit.text = edit.text.replace(/\r\n|\r|\n/g, model.getEOL());
|
||||
}
|
||||
|
||||
@@ -88,14 +88,14 @@ export class EditOperationsCommand implements editorCommon.ICommand {
|
||||
* bug #15108. There the cursor was jumping since the tracked selection was in the middle of the range edit
|
||||
* and was lost.
|
||||
*/
|
||||
static trimEdit(edit: editorCommon.ISingleEditOperation, model: editorCommon.ITokenizedModel): editorCommon.ISingleEditOperation {
|
||||
static trimEdit(edit: editorCommon.ISingleEditOperation, model: editorCommon.IModel): editorCommon.ISingleEditOperation {
|
||||
|
||||
this.fixLineTerminators(edit, model);
|
||||
|
||||
return this._trimEdit(model.validateRange(edit.range), edit.text, edit.forceMoveMarkers, model);
|
||||
}
|
||||
|
||||
static _trimEdit(editRange: Range, editText: string, editForceMoveMarkers: boolean, model: editorCommon.ITokenizedModel): editorCommon.ISingleEditOperation {
|
||||
static _trimEdit(editRange: Range, editText: string, editForceMoveMarkers: boolean, model: editorCommon.IModel): editorCommon.ISingleEditOperation {
|
||||
|
||||
let currentText = model.getValueInRange(editRange);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { onUnexpectedExternalError } from 'vs/base/common/errors';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry';
|
||||
import { DefinitionProviderRegistry, ImplementationProviderRegistry, TypeDefinitionProviderRegistry, Location } from 'vs/editor/common/modes';
|
||||
@@ -30,10 +30,10 @@ function outputResults(promises: TPromise<Location | Location[]>[]) {
|
||||
}
|
||||
|
||||
function getDefinitions<T>(
|
||||
model: IReadOnlyModel,
|
||||
model: IModel,
|
||||
position: Position,
|
||||
registry: LanguageFeatureRegistry<T>,
|
||||
provide: (provider: T, model: IReadOnlyModel, position: Position, token: CancellationToken) => Location | Location[] | Thenable<Location | Location[]>
|
||||
provide: (provider: T, model: IModel, position: Position, token: CancellationToken) => Location | Location[] | Thenable<Location | Location[]>
|
||||
): TPromise<Location[]> {
|
||||
const provider = registry.ordered(model);
|
||||
|
||||
@@ -50,19 +50,19 @@ function getDefinitions<T>(
|
||||
}
|
||||
|
||||
|
||||
export function getDefinitionsAtPosition(model: IReadOnlyModel, position: Position): TPromise<Location[]> {
|
||||
export function getDefinitionsAtPosition(model: IModel, position: Position): TPromise<Location[]> {
|
||||
return getDefinitions(model, position, DefinitionProviderRegistry, (provider, model, position, token) => {
|
||||
return provider.provideDefinition(model, position, token);
|
||||
});
|
||||
}
|
||||
|
||||
export function getImplementationsAtPosition(model: IReadOnlyModel, position: Position): TPromise<Location[]> {
|
||||
export function getImplementationsAtPosition(model: IModel, position: Position): TPromise<Location[]> {
|
||||
return getDefinitions(model, position, ImplementationProviderRegistry, (provider, model, position, token) => {
|
||||
return provider.provideImplementation(model, position, token);
|
||||
});
|
||||
}
|
||||
|
||||
export function getTypeDefinitionsAtPosition(model: IReadOnlyModel, position: Position): TPromise<Location[]> {
|
||||
export function getTypeDefinitionsAtPosition(model: IModel, position: Position): TPromise<Location[]> {
|
||||
return getDefinitions(model, position, TypeDefinitionProviderRegistry, (provider, model, position, token) => {
|
||||
return provider.provideTypeDefinition(model, position, token);
|
||||
});
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { onUnexpectedExternalError } from 'vs/base/common/errors';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { Hover, HoverProviderRegistry } from 'vs/editor/common/modes';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
|
||||
export function getHover(model: IReadOnlyModel, position: Position): TPromise<Hover[]> {
|
||||
export function getHover(model: IModel, position: Position): TPromise<Hover[]> {
|
||||
|
||||
const supports = HoverProviderRegistry.ordered(model);
|
||||
const values: Hover[] = [];
|
||||
|
||||
@@ -20,11 +20,11 @@ export class InPlaceReplaceCommand implements editorCommon.ICommand {
|
||||
this._text = text;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
builder.addTrackedEditOperation(this._editRange, this._text);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
var inverseEditOperations = helper.getInverseEditOperations();
|
||||
var srcRange = inverseEditOperations[0].range;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IEditorContribution, IIdentifiedSingleEditOperation, ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorContribution, IIdentifiedSingleEditOperation, ICommand, ICursorStateComputerData, IEditOperationBuilder, IModel } from 'vs/editor/common/editorCommon';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { registerEditorAction, ServicesAccessor, IActionOptions, EditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
@@ -45,7 +45,7 @@ export function unshiftIndent(tabSize: number, indentation: string, count?: numb
|
||||
return newIndentation;
|
||||
}
|
||||
|
||||
export function getReindentEditOperations(model: ITokenizedModel, startLineNumber: number, endLineNumber: number, inheritedIndent?: string): IIdentifiedSingleEditOperation[] {
|
||||
export function getReindentEditOperations(model: IModel, startLineNumber: number, endLineNumber: number, inheritedIndent?: string): IIdentifiedSingleEditOperation[] {
|
||||
if (model.getLineCount() === 1 && model.getLineMaxColumn(1) === 1) {
|
||||
// Model is empty
|
||||
return undefined;
|
||||
@@ -344,7 +344,7 @@ export class AutoIndentOnPasteCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
for (let edit of this._edits) {
|
||||
builder.addEditOperation(Range.lift(edit.range), edit.text);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ export class AutoIndentOnPasteCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this._selectionId);
|
||||
}
|
||||
}
|
||||
@@ -547,7 +547,7 @@ export class AutoIndentOnPaste implements IEditorContribution {
|
||||
this.editor.pushUndoStop();
|
||||
}
|
||||
|
||||
private shouldIgnoreLine(model: ITokenizedModel, lineNumber: number): boolean {
|
||||
private shouldIgnoreLine(model: IModel, lineNumber: number): boolean {
|
||||
model.forceTokenization(lineNumber);
|
||||
let nonWhiteSpaceColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
|
||||
if (nonWhiteSpaceColumn === 0) {
|
||||
@@ -574,7 +574,7 @@ export class AutoIndentOnPaste implements IEditorContribution {
|
||||
}
|
||||
}
|
||||
|
||||
function getIndentationEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder, tabSize: number, tabsToSpaces: boolean): void {
|
||||
function getIndentationEditOperations(model: IModel, builder: IEditOperationBuilder, tabSize: number, tabsToSpaces: boolean): void {
|
||||
if (model.getLineCount() === 1 && model.getLineMaxColumn(1) === 1) {
|
||||
// Model is empty
|
||||
return;
|
||||
@@ -606,12 +606,12 @@ export class IndentationToSpacesCommand implements ICommand {
|
||||
|
||||
constructor(private selection: Selection, private tabSize: number) { }
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
this.selectionId = builder.trackSelection(this.selection);
|
||||
getIndentationEditOperations(model, builder, this.tabSize, true);
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this.selectionId);
|
||||
}
|
||||
}
|
||||
@@ -622,12 +622,12 @@ export class IndentationToTabsCommand implements ICommand {
|
||||
|
||||
constructor(private selection: Selection, private tabSize: number) { }
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
this.selectionId = builder.trackSelection(this.selection);
|
||||
getIndentationEditOperations(model, builder, this.tabSize, false);
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this.selectionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export class CopyLinesCommand implements editorCommon.ICommand {
|
||||
this._isCopyingDown = isCopyingDown;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
var s = this._selection;
|
||||
|
||||
this._startLineNumberDelta = 0;
|
||||
@@ -57,7 +57,7 @@ export class CopyLinesCommand implements editorCommon.ICommand {
|
||||
this._selectionDirection = this._selection.getDirection();
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
var result = helper.getTrackedSelection(this._selectionId);
|
||||
|
||||
if (this._startLineNumberDelta !== 0 || this._endLineNumberDelta !== 0) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, IModel } from 'vs/editor/common/editorCommon';
|
||||
|
||||
export class DeleteLinesCommand implements ICommand {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class DeleteLinesCommand implements ICommand {
|
||||
this.restoreCursorToColumn = restoreCursorToColumn;
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
if (model.getLineCount() === 1 && model.getLineMaxColumn(1) === 1) {
|
||||
// Model is empty
|
||||
return;
|
||||
@@ -42,7 +42,7 @@ export class DeleteLinesCommand implements ICommand {
|
||||
builder.addTrackedEditOperation(new Range(startLineNumber, startColumn, endLineNumber, endColumn), null);
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
var inverseEditOperations = helper.getInverseEditOperations();
|
||||
var srcRange = inverseEditOperations[0].range;
|
||||
return new Selection(
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, IModel } from 'vs/editor/common/editorCommon';
|
||||
import { LanguageConfigurationRegistry, IIndentConverter } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { ShiftCommand } from 'vs/editor/common/commands/shiftCommand';
|
||||
import * as IndentUtil from 'vs/editor/contrib/indentation/indentUtils';
|
||||
@@ -31,7 +31,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
this._moveEndLineSelectionShrink = false;
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
|
||||
var modelLineCount = model.getLineCount();
|
||||
|
||||
@@ -238,7 +238,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
};
|
||||
}
|
||||
|
||||
private matchEnterRule(model: ITokenizedModel, indentConverter: IIndentConverter, tabSize: number, line: number, oneLineAbove: number, oneLineAboveText?: string) {
|
||||
private matchEnterRule(model: IModel, indentConverter: IIndentConverter, tabSize: number, line: number, oneLineAbove: number, oneLineAboveText?: string) {
|
||||
let validPrecedingLine = oneLineAbove;
|
||||
while (validPrecedingLine >= 1) {
|
||||
// ship empty lines as empty lines just inherit indentation
|
||||
@@ -297,7 +297,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
return str.replace(/^\s+/, '');
|
||||
}
|
||||
|
||||
private shouldAutoIndent(model: ITokenizedModel, selection: Selection) {
|
||||
private shouldAutoIndent(model: IModel, selection: Selection) {
|
||||
if (!this._autoIndent) {
|
||||
return false;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
private getIndentEditsOfMovingBlock(model: ITokenizedModel, builder: IEditOperationBuilder, s: Selection, tabSize: number, insertSpaces: boolean, offset: number) {
|
||||
private getIndentEditsOfMovingBlock(model: IModel, builder: IEditOperationBuilder, s: Selection, tabSize: number, insertSpaces: boolean, offset: number) {
|
||||
for (let i = s.startLineNumber; i <= s.endLineNumber; i++) {
|
||||
let lineContent = model.getLineContent(i);
|
||||
let originalIndent = strings.getLeadingWhitespace(lineContent);
|
||||
@@ -340,7 +340,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
var result = helper.getTrackedSelection(this._selectionId);
|
||||
|
||||
if (this._moveEndPositionDown) {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class SortLinesCommand implements editorCommon.ICommand {
|
||||
this.descending = descending;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: editorCommon.IModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
let op = sortLines(model, this.selection, this.descending);
|
||||
if (op) {
|
||||
builder.addEditOperation(op.range, op.text);
|
||||
@@ -29,11 +29,11 @@ export class SortLinesCommand implements editorCommon.ICommand {
|
||||
this.selectionId = builder.trackSelection(this.selection);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: editorCommon.IModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this.selectionId);
|
||||
}
|
||||
|
||||
public static canRun(model: editorCommon.ITextModel, selection: Selection, descending: boolean): boolean {
|
||||
public static canRun(model: editorCommon.IModel, selection: Selection, descending: boolean): boolean {
|
||||
let data = getSortData(model, selection, descending);
|
||||
|
||||
if (!data) {
|
||||
@@ -50,7 +50,7 @@ export class SortLinesCommand implements editorCommon.ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
function getSortData(model: editorCommon.ITextModel, selection: Selection, descending: boolean) {
|
||||
function getSortData(model: editorCommon.IModel, selection: Selection, descending: boolean) {
|
||||
let startLineNumber = selection.startLineNumber;
|
||||
let endLineNumber = selection.endLineNumber;
|
||||
|
||||
@@ -91,7 +91,7 @@ function getSortData(model: editorCommon.ITextModel, selection: Selection, desce
|
||||
/**
|
||||
* Generate commands for sorting lines on a model.
|
||||
*/
|
||||
function sortLines(model: editorCommon.ITextModel, selection: Selection, descending: boolean): editorCommon.IIdentifiedSingleEditOperation {
|
||||
function sortLines(model: editorCommon.IModel, selection: Selection, descending: boolean): editorCommon.IIdentifiedSingleEditOperation {
|
||||
let data = getSortData(model, selection, descending);
|
||||
|
||||
if (!data) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { onUnexpectedExternalError } from 'vs/base/common/errors';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Range, IRange } from 'vs/editor/common/core/range';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { ILink, LinkProvider, LinkProviderRegistry } from 'vs/editor/common/modes';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
@@ -65,7 +65,7 @@ export class Link implements ILink {
|
||||
}
|
||||
}
|
||||
|
||||
export function getLinks(model: IReadOnlyModel): TPromise<Link[]> {
|
||||
export function getLinks(model: IModel): TPromise<Link[]> {
|
||||
|
||||
let links: Link[] = [];
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { onUnexpectedExternalError } from 'vs/base/common/errors';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { SignatureHelp, SignatureHelpProviderRegistry } from 'vs/editor/common/modes';
|
||||
import { asWinJsPromise, sequence } from 'vs/base/common/async';
|
||||
@@ -19,7 +19,7 @@ export const Context = {
|
||||
MultipleSignatures: new RawContextKey<boolean>('parameterHintsMultipleSignatures', false),
|
||||
};
|
||||
|
||||
export function provideSignatureHelp(model: IReadOnlyModel, position: Position): TPromise<SignatureHelp> {
|
||||
export function provideSignatureHelp(model: IModel, position: Position): TPromise<SignatureHelp> {
|
||||
|
||||
const supports = SignatureHelpProviderRegistry.ordered(model);
|
||||
let result: SignatureHelp;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
'use strict';
|
||||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { CodeActionProviderRegistry, CodeAction } from 'vs/editor/common/modes';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
@@ -15,7 +15,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { registerLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
|
||||
export function getCodeActions(model: IReadOnlyModel, range: Range): TPromise<CodeAction[]> {
|
||||
export function getCodeActions(model: IModel, range: Range): TPromise<CodeAction[]> {
|
||||
|
||||
const allResults: CodeAction[] = [];
|
||||
const promises = CodeActionProviderRegistry.all(model).map(support => {
|
||||
|
||||
@@ -197,7 +197,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
});
|
||||
|
||||
|
||||
export function provideReferences(model: editorCommon.IReadOnlyModel, position: Position): TPromise<Location[]> {
|
||||
export function provideReferences(model: editorCommon.IModel, position: Position): TPromise<Location[]> {
|
||||
|
||||
// collect references from all providers
|
||||
const promises = ReferenceProviderRegistry.ordered(model).map(provider => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { RawContextKey, IContextKey, IContextKeyService, ContextKeyExpr } from '
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction, EditorCommand, registerEditorCommand, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { IEditorContribution, IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorContribution, IModel } from 'vs/editor/common/editorCommon';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { createBulkEdit } from 'vs/editor/browser/services/bulkEdit';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
@@ -33,7 +33,7 @@ import { EditorState, CodeEditorStateFlag } from 'vs/editor/browser/core/editorS
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
|
||||
|
||||
export function rename(model: IReadOnlyModel, position: Position, newName: string): TPromise<WorkspaceEdit> {
|
||||
export function rename(model: IModel, position: Position, newName: string): TPromise<WorkspaceEdit> {
|
||||
|
||||
const supports = RenameProviderRegistry.ordered(model);
|
||||
const rejects: string[] = [];
|
||||
|
||||
@@ -34,7 +34,7 @@ export const overviewRulerWordHighlightStrongForeground = registerColor('editorO
|
||||
|
||||
export const ctxHasWordHighlights = new RawContextKey<boolean>('hasWordHighlights', false);
|
||||
|
||||
export function getOccurrencesAtPosition(model: editorCommon.IReadOnlyModel, position: Position): TPromise<DocumentHighlight[]> {
|
||||
export function getOccurrencesAtPosition(model: editorCommon.IModel, position: Position): TPromise<DocumentHighlight[]> {
|
||||
|
||||
const orderedByScore = DocumentHighlightProviderRegistry.ordered(model);
|
||||
let foundResult = false;
|
||||
|
||||
@@ -263,7 +263,7 @@ export function registerSignatureHelpProvider(languageId: string, provider: mode
|
||||
*/
|
||||
export function registerHoverProvider(languageId: string, provider: modes.HoverProvider): IDisposable {
|
||||
return modes.HoverProviderRegistry.register(languageId, {
|
||||
provideHover: (model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<modes.Hover> => {
|
||||
provideHover: (model: editorCommon.IModel, position: Position, token: CancellationToken): Thenable<modes.Hover> => {
|
||||
let word = model.getWordAtPosition(position);
|
||||
|
||||
return toThenable<modes.Hover>(provider.provideHover(model, position, token)).then((value) => {
|
||||
@@ -329,7 +329,7 @@ export function registerCodeLensProvider(languageId: string, provider: modes.Cod
|
||||
*/
|
||||
export function registerCodeActionProvider(languageId: string, provider: CodeActionProvider): IDisposable {
|
||||
return modes.CodeActionProviderRegistry.register(languageId, {
|
||||
provideCodeActions: (model: editorCommon.IReadOnlyModel, range: Range, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]> => {
|
||||
provideCodeActions: (model: editorCommon.IModel, range: Range, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]> => {
|
||||
let markers = StaticServices.markerService.get().read({ resource: model.uri }).filter(m => {
|
||||
return Range.areIntersectingOrTouching(m, range);
|
||||
});
|
||||
@@ -373,10 +373,10 @@ export function registerCompletionItemProvider(languageId: string, provider: Com
|
||||
let adapter = new SuggestAdapter(provider);
|
||||
return modes.SuggestRegistry.register(languageId, {
|
||||
triggerCharacters: provider.triggerCharacters,
|
||||
provideCompletionItems: (model: editorCommon.IReadOnlyModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
|
||||
provideCompletionItems: (model: editorCommon.IModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
|
||||
return adapter.provideCompletionItems(model, position, context, token);
|
||||
},
|
||||
resolveCompletionItem: (model: editorCommon.IReadOnlyModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> => {
|
||||
resolveCompletionItem: (model: editorCommon.IModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> => {
|
||||
return adapter.resolveCompletionItem(model, position, suggestion, token);
|
||||
}
|
||||
});
|
||||
@@ -411,7 +411,7 @@ export interface CodeActionProvider {
|
||||
/**
|
||||
* Provide commands for the given document and range.
|
||||
*/
|
||||
provideCodeActions(model: editorCommon.IReadOnlyModel, range: Range, context: CodeActionContext, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]>;
|
||||
provideCodeActions(model: editorCommon.IModel, range: Range, context: CodeActionContext, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -576,7 +576,7 @@ export interface CompletionItemProvider {
|
||||
/**
|
||||
* Provide completion items for the given position and document.
|
||||
*/
|
||||
provideCompletionItems(document: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken, context: CompletionContext): CompletionItem[] | Thenable<CompletionItem[]> | CompletionList | Thenable<CompletionList>;
|
||||
provideCompletionItems(document: editorCommon.IModel, position: Position, token: CancellationToken, context: CompletionContext): CompletionItem[] | Thenable<CompletionItem[]> | CompletionList | Thenable<CompletionList>;
|
||||
|
||||
/**
|
||||
* Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
|
||||
@@ -665,7 +665,7 @@ class SuggestAdapter {
|
||||
return suggestion;
|
||||
}
|
||||
|
||||
provideCompletionItems(model: editorCommon.IReadOnlyModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> {
|
||||
provideCompletionItems(model: editorCommon.IModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> {
|
||||
const result = this._provider.provideCompletionItems(model, position, token, context);
|
||||
return toThenable<CompletionItem[] | CompletionList>(result).then(value => {
|
||||
const result: modes.ISuggestResult = {
|
||||
@@ -708,7 +708,7 @@ class SuggestAdapter {
|
||||
});
|
||||
}
|
||||
|
||||
resolveCompletionItem(model: editorCommon.IReadOnlyModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> {
|
||||
resolveCompletionItem(model: editorCommon.IModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> {
|
||||
if (typeof this._provider.resolveCompletionItem !== 'function') {
|
||||
return TPromise.as(suggestion);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Selection } from 'vs/editor/common/core/selection';
|
||||
import {
|
||||
EndOfLinePreference, Handler,
|
||||
DefaultEndOfLine, ITextModelCreationOptions, ICommand,
|
||||
ITokenizedModel, IEditOperationBuilder, ICursorStateComputerData, EndOfLineSequence
|
||||
IModel, IEditOperationBuilder, ICursorStateComputerData, EndOfLineSequence
|
||||
} from 'vs/editor/common/editorCommon';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { IndentAction, IndentationRule } from 'vs/editor/common/modes/languageConfiguration';
|
||||
@@ -2087,12 +2087,12 @@ suite('Editor Controller - Cursor Configuration', () => {
|
||||
|
||||
private _selectionId: string = null;
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: IModel, builder: IEditOperationBuilder): void {
|
||||
builder.addEditOperation(new Range(1, 13, 1, 14), '');
|
||||
this._selectionId = builder.trackSelection(cursor.getSelection());
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this._selectionId);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+43
-67
@@ -1371,14 +1371,14 @@ declare module monaco.editor {
|
||||
* @param model The model the command will execute on.
|
||||
* @param builder A helper to collect the needed edit operations and to track selections.
|
||||
*/
|
||||
getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void;
|
||||
getEditOperations(model: IModel, builder: IEditOperationBuilder): void;
|
||||
/**
|
||||
* Compute the cursor state after the edit operations were applied.
|
||||
* @param model The model the commad has executed on.
|
||||
* @param helper A helper to get inverse edit operations and to get previously tracked selections.
|
||||
* @return The cursor state after the command executed.
|
||||
*/
|
||||
computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection;
|
||||
computeCursorState(model: IModel, helper: ICursorStateComputerData): Selection;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1453,10 +1453,27 @@ declare module monaco.editor {
|
||||
trimAutoWhitespace?: boolean;
|
||||
}
|
||||
|
||||
export class FindMatch {
|
||||
_findMatchBrand: void;
|
||||
readonly range: Range;
|
||||
readonly matches: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A textual read-only model.
|
||||
* Describes the behavior of decorations when typing/editing near their edges.
|
||||
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
|
||||
*/
|
||||
export interface ITextModel {
|
||||
export enum TrackedRangeStickiness {
|
||||
AlwaysGrowsWhenTypingAtEdges = 0,
|
||||
NeverGrowsWhenTypingAtEdges = 1,
|
||||
GrowsOnlyWhenTypingBefore = 2,
|
||||
GrowsOnlyWhenTypingAfter = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* A model.
|
||||
*/
|
||||
export interface IModel {
|
||||
/**
|
||||
* Get the resolved options for this model.
|
||||
*/
|
||||
@@ -1629,15 +1646,6 @@ declare module monaco.editor {
|
||||
* @return The range where the previous match is. It is null if no previous match has been found.
|
||||
*/
|
||||
findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch;
|
||||
}
|
||||
|
||||
export class FindMatch {
|
||||
_findMatchBrand: void;
|
||||
readonly range: Range;
|
||||
readonly matches: string[];
|
||||
}
|
||||
|
||||
export interface IReadOnlyModel extends ITextModel {
|
||||
/**
|
||||
* Gets the resource associated with this editor model.
|
||||
*/
|
||||
@@ -1660,12 +1668,6 @@ declare module monaco.editor {
|
||||
* @return The word under or besides `position`. Will never be null.
|
||||
*/
|
||||
getWordUntilPosition(position: IPosition): IWordAtPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* A model that is tokenized.
|
||||
*/
|
||||
export interface ITokenizedModel extends ITextModel {
|
||||
/**
|
||||
* Get the language associated with this model.
|
||||
*/
|
||||
@@ -1684,23 +1686,6 @@ declare module monaco.editor {
|
||||
* @return The word under or besides `position`. Will never be null.
|
||||
*/
|
||||
getWordUntilPosition(position: IPosition): IWordAtPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the behavior of decorations when typing/editing near their edges.
|
||||
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
|
||||
*/
|
||||
export enum TrackedRangeStickiness {
|
||||
AlwaysGrowsWhenTypingAtEdges = 0,
|
||||
NeverGrowsWhenTypingAtEdges = 1,
|
||||
GrowsOnlyWhenTypingBefore = 2,
|
||||
GrowsOnlyWhenTypingAfter = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* A model that can have decorations.
|
||||
*/
|
||||
export interface ITextModelWithDecorations {
|
||||
/**
|
||||
* Perform a minimum ammount of operations, in order to transform the decorations
|
||||
* identified by `oldDecorations` to the decorations described by `newDecorations`
|
||||
@@ -1762,12 +1747,6 @@ declare module monaco.editor {
|
||||
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
|
||||
*/
|
||||
getOverviewRulerDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
|
||||
}
|
||||
|
||||
/**
|
||||
* An editable text model.
|
||||
*/
|
||||
export interface IEditableTextModel extends ITextModel {
|
||||
/**
|
||||
* Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
|
||||
*/
|
||||
@@ -1806,12 +1785,6 @@ declare module monaco.editor {
|
||||
* @return The inverse edit operations, that, when applied, will bring the model back to the previous state.
|
||||
*/
|
||||
applyEdits(operations: IIdentifiedSingleEditOperation[]): IIdentifiedSingleEditOperation[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A model.
|
||||
*/
|
||||
export interface IModel extends IReadOnlyModel, IEditableTextModel, ITokenizedModel, ITextModelWithDecorations {
|
||||
/**
|
||||
* An event emitted when the contents of the model have changed.
|
||||
* @event
|
||||
@@ -3901,6 +3874,9 @@ declare module monaco.editor {
|
||||
readonly lineHeight: number;
|
||||
readonly letterSpacing: number;
|
||||
}
|
||||
|
||||
//compatibility:
|
||||
export type IReadOnlyModel = IModel;
|
||||
}
|
||||
|
||||
declare module monaco.languages {
|
||||
@@ -4080,7 +4056,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide commands for the given document and range.
|
||||
*/
|
||||
provideCodeActions(model: editor.IReadOnlyModel, range: Range, context: CodeActionContext, token: CancellationToken): (Command | CodeAction)[] | Thenable<(Command | CodeAction)[]>;
|
||||
provideCodeActions(model: editor.IModel, range: Range, context: CodeActionContext, token: CancellationToken): (Command | CodeAction)[] | Thenable<(Command | CodeAction)[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4244,7 +4220,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide completion items for the given position and document.
|
||||
*/
|
||||
provideCompletionItems(document: editor.IReadOnlyModel, position: Position, token: CancellationToken, context: CompletionContext): CompletionItem[] | Thenable<CompletionItem[]> | CompletionList | Thenable<CompletionList>;
|
||||
provideCompletionItems(document: editor.IModel, position: Position, token: CancellationToken, context: CompletionContext): CompletionItem[] | Thenable<CompletionItem[]> | CompletionList | Thenable<CompletionList>;
|
||||
/**
|
||||
* Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
|
||||
* or [details](#CompletionItem.detail).
|
||||
@@ -4505,7 +4481,7 @@ declare module monaco.languages {
|
||||
* position will be merged by the editor. A hover can have a range which defaults
|
||||
* to the word range at the position when omitted.
|
||||
*/
|
||||
provideHover(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Hover | Thenable<Hover>;
|
||||
provideHover(model: editor.IModel, position: Position, token: CancellationToken): Hover | Thenable<Hover>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4591,7 +4567,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide help for the signature at the given position and document.
|
||||
*/
|
||||
provideSignatureHelp(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): SignatureHelp | Thenable<SignatureHelp>;
|
||||
provideSignatureHelp(model: editor.IModel, position: Position, token: CancellationToken): SignatureHelp | Thenable<SignatureHelp>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4637,7 +4613,7 @@ declare module monaco.languages {
|
||||
* Provide a set of document highlights, like all occurrences of a variable or
|
||||
* all exit-points of a function.
|
||||
*/
|
||||
provideDocumentHighlights(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable<DocumentHighlight[]>;
|
||||
provideDocumentHighlights(model: editor.IModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable<DocumentHighlight[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4659,7 +4635,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide a set of project-wide references for the given position and document.
|
||||
*/
|
||||
provideReferences(model: editor.IReadOnlyModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable<Location[]>;
|
||||
provideReferences(model: editor.IModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable<Location[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4693,7 +4669,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide the definition of the symbol at the given position and document.
|
||||
*/
|
||||
provideDefinition(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
provideDefinition(model: editor.IModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4704,7 +4680,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide the implementation of the symbol at the given position and document.
|
||||
*/
|
||||
provideImplementation(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
provideImplementation(model: editor.IModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4715,7 +4691,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide the type definition of the symbol at the given position and document.
|
||||
*/
|
||||
provideTypeDefinition(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
provideTypeDefinition(model: editor.IModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4781,7 +4757,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide symbol information for the given document.
|
||||
*/
|
||||
provideDocumentSymbols(model: editor.IReadOnlyModel, token: CancellationToken): SymbolInformation[] | Thenable<SymbolInformation[]>;
|
||||
provideDocumentSymbols(model: editor.IModel, token: CancellationToken): SymbolInformation[] | Thenable<SymbolInformation[]>;
|
||||
}
|
||||
|
||||
export interface TextEdit {
|
||||
@@ -4812,7 +4788,7 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provide formatting edits for a whole document.
|
||||
*/
|
||||
provideDocumentFormattingEdits(model: editor.IReadOnlyModel, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
provideDocumentFormattingEdits(model: editor.IModel, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4827,7 +4803,7 @@ declare module monaco.languages {
|
||||
* or larger range. Often this is done by adjusting the start and end
|
||||
* of the range to full syntax nodes.
|
||||
*/
|
||||
provideDocumentRangeFormattingEdits(model: editor.IReadOnlyModel, range: Range, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
provideDocumentRangeFormattingEdits(model: editor.IModel, range: Range, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4843,7 +4819,7 @@ declare module monaco.languages {
|
||||
* what range the position to expand to, like find the matching `{`
|
||||
* when `}` has been entered.
|
||||
*/
|
||||
provideOnTypeFormattingEdits(model: editor.IReadOnlyModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
provideOnTypeFormattingEdits(model: editor.IModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4858,7 +4834,7 @@ declare module monaco.languages {
|
||||
* A provider of links.
|
||||
*/
|
||||
export interface LinkProvider {
|
||||
provideLinks(model: editor.IReadOnlyModel, token: CancellationToken): ILink[] | Thenable<ILink[]>;
|
||||
provideLinks(model: editor.IModel, token: CancellationToken): ILink[] | Thenable<ILink[]>;
|
||||
resolveLink?: (link: ILink, token: CancellationToken) => ILink | Thenable<ILink>;
|
||||
}
|
||||
|
||||
@@ -4927,11 +4903,11 @@ declare module monaco.languages {
|
||||
/**
|
||||
* Provides the color ranges for a specific model.
|
||||
*/
|
||||
provideDocumentColors(model: editor.IReadOnlyModel, token: CancellationToken): IColorInformation[] | Thenable<IColorInformation[]>;
|
||||
provideDocumentColors(model: editor.IModel, token: CancellationToken): IColorInformation[] | Thenable<IColorInformation[]>;
|
||||
/**
|
||||
* Provide the string representations for a color.
|
||||
*/
|
||||
provideColorPresentations(model: editor.IReadOnlyModel, colorInfo: IColorInformation, token: CancellationToken): IColorPresentation[] | Thenable<IColorPresentation[]>;
|
||||
provideColorPresentations(model: editor.IModel, colorInfo: IColorInformation, token: CancellationToken): IColorPresentation[] | Thenable<IColorPresentation[]>;
|
||||
}
|
||||
|
||||
export interface IResourceEdit {
|
||||
@@ -4946,7 +4922,7 @@ declare module monaco.languages {
|
||||
}
|
||||
|
||||
export interface RenameProvider {
|
||||
provideRenameEdits(model: editor.IReadOnlyModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable<WorkspaceEdit>;
|
||||
provideRenameEdits(model: editor.IModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable<WorkspaceEdit>;
|
||||
}
|
||||
|
||||
export interface Command {
|
||||
@@ -4964,8 +4940,8 @@ declare module monaco.languages {
|
||||
|
||||
export interface CodeLensProvider {
|
||||
onDidChange?: IEvent<this>;
|
||||
provideCodeLenses(model: editor.IReadOnlyModel, token: CancellationToken): ICodeLensSymbol[] | Thenable<ICodeLensSymbol[]>;
|
||||
resolveCodeLens?(model: editor.IReadOnlyModel, codeLens: ICodeLensSymbol, token: CancellationToken): ICodeLensSymbol | Thenable<ICodeLensSymbol>;
|
||||
provideCodeLenses(model: editor.IModel, token: CancellationToken): ICodeLensSymbol[] | Thenable<ICodeLensSymbol[]>;
|
||||
resolveCodeLens?(model: editor.IModel, codeLens: ICodeLensSymbol, token: CancellationToken): ICodeLensSymbol | Thenable<ICodeLensSymbol>;
|
||||
}
|
||||
|
||||
export interface ILanguageExtensionPoint {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import * as vscode from 'vscode';
|
||||
import { IReadOnlyModel, ISingleEditOperation } from 'vs/editor/common/editorCommon';
|
||||
import { IModel, ISingleEditOperation } from 'vs/editor/common/editorCommon';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { WorkspaceSymbolProviderRegistry, IWorkspaceSymbolProvider } from 'vs/workbench/parts/search/common/search';
|
||||
import { wireCancellationToken } from 'vs/base/common/async';
|
||||
@@ -111,7 +111,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerOutlineSupport(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.DocumentSymbolProviderRegistry.register(toLanguageSelector(selector), <modes.DocumentSymbolProvider>{
|
||||
provideDocumentSymbols: (model: IReadOnlyModel, token: CancellationToken): Thenable<modes.SymbolInformation[]> => {
|
||||
provideDocumentSymbols: (model: IModel, token: CancellationToken): Thenable<modes.SymbolInformation[]> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideDocumentSymbols(handle, model.uri)).then(MainThreadLanguageFeatures._reviveSymbolInformationDto);
|
||||
}
|
||||
});
|
||||
@@ -122,10 +122,10 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
$registerCodeLensSupport(handle: number, selector: vscode.DocumentSelector, eventHandle: number): void {
|
||||
|
||||
const provider = <modes.CodeLensProvider>{
|
||||
provideCodeLenses: (model: IReadOnlyModel, token: CancellationToken): modes.ICodeLensSymbol[] | Thenable<modes.ICodeLensSymbol[]> => {
|
||||
provideCodeLenses: (model: IModel, token: CancellationToken): modes.ICodeLensSymbol[] | Thenable<modes.ICodeLensSymbol[]> => {
|
||||
return this._heapService.trackRecursive(wireCancellationToken(token, this._proxy.$provideCodeLenses(handle, model.uri)));
|
||||
},
|
||||
resolveCodeLens: (model: IReadOnlyModel, codeLens: modes.ICodeLensSymbol, token: CancellationToken): modes.ICodeLensSymbol | Thenable<modes.ICodeLensSymbol> => {
|
||||
resolveCodeLens: (model: IModel, codeLens: modes.ICodeLensSymbol, token: CancellationToken): modes.ICodeLensSymbol | Thenable<modes.ICodeLensSymbol> => {
|
||||
return this._heapService.trackRecursive(wireCancellationToken(token, this._proxy.$resolveCodeLens(handle, model.uri, codeLens)));
|
||||
}
|
||||
};
|
||||
@@ -176,7 +176,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerHoverProvider(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.HoverProviderRegistry.register(toLanguageSelector(selector), <modes.HoverProvider>{
|
||||
provideHover: (model: IReadOnlyModel, position: EditorPosition, token: CancellationToken): Thenable<modes.Hover> => {
|
||||
provideHover: (model: IModel, position: EditorPosition, token: CancellationToken): Thenable<modes.Hover> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideHover(handle, model.uri, position));
|
||||
}
|
||||
});
|
||||
@@ -186,7 +186,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerDocumentHighlightProvider(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.DocumentHighlightProviderRegistry.register(toLanguageSelector(selector), <modes.DocumentHighlightProvider>{
|
||||
provideDocumentHighlights: (model: IReadOnlyModel, position: EditorPosition, token: CancellationToken): Thenable<modes.DocumentHighlight[]> => {
|
||||
provideDocumentHighlights: (model: IModel, position: EditorPosition, token: CancellationToken): Thenable<modes.DocumentHighlight[]> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideDocumentHighlights(handle, model.uri, position));
|
||||
}
|
||||
});
|
||||
@@ -196,7 +196,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerReferenceSupport(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.ReferenceProviderRegistry.register(toLanguageSelector(selector), <modes.ReferenceProvider>{
|
||||
provideReferences: (model: IReadOnlyModel, position: EditorPosition, context: modes.ReferenceContext, token: CancellationToken): Thenable<modes.Location[]> => {
|
||||
provideReferences: (model: IModel, position: EditorPosition, context: modes.ReferenceContext, token: CancellationToken): Thenable<modes.Location[]> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideReferences(handle, model.uri, position, context)).then(MainThreadLanguageFeatures._reviveLocationDto);
|
||||
}
|
||||
});
|
||||
@@ -206,7 +206,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerQuickFixSupport(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.CodeActionProviderRegistry.register(toLanguageSelector(selector), <modes.CodeActionProvider>{
|
||||
provideCodeActions: (model: IReadOnlyModel, range: EditorRange, token: CancellationToken): Thenable<modes.CodeAction[]> => {
|
||||
provideCodeActions: (model: IModel, range: EditorRange, token: CancellationToken): Thenable<modes.CodeAction[]> => {
|
||||
return this._heapService.trackRecursive(wireCancellationToken(token, this._proxy.$provideCodeActions(handle, model.uri, range))).then(MainThreadLanguageFeatures._reviveCodeActionDto);
|
||||
}
|
||||
});
|
||||
@@ -216,7 +216,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerDocumentFormattingSupport(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.DocumentFormattingEditProviderRegistry.register(toLanguageSelector(selector), <modes.DocumentFormattingEditProvider>{
|
||||
provideDocumentFormattingEdits: (model: IReadOnlyModel, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
|
||||
provideDocumentFormattingEdits: (model: IModel, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideDocumentFormattingEdits(handle, model.uri, options));
|
||||
}
|
||||
});
|
||||
@@ -224,7 +224,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerRangeFormattingSupport(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.DocumentRangeFormattingEditProviderRegistry.register(toLanguageSelector(selector), <modes.DocumentRangeFormattingEditProvider>{
|
||||
provideDocumentRangeFormattingEdits: (model: IReadOnlyModel, range: EditorRange, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
|
||||
provideDocumentRangeFormattingEdits: (model: IModel, range: EditorRange, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideDocumentRangeFormattingEdits(handle, model.uri, range, options));
|
||||
}
|
||||
});
|
||||
@@ -235,7 +235,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
autoFormatTriggerCharacters,
|
||||
|
||||
provideOnTypeFormattingEdits: (model: IReadOnlyModel, position: EditorPosition, ch: string, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
|
||||
provideOnTypeFormattingEdits: (model: IModel, position: EditorPosition, ch: string, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideOnTypeFormattingEdits(handle, model.uri, position, ch, options));
|
||||
}
|
||||
});
|
||||
@@ -265,7 +265,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
$registerRenameSupport(handle: number, selector: vscode.DocumentSelector): void {
|
||||
this._registrations[handle] = modes.RenameProviderRegistry.register(toLanguageSelector(selector), <modes.RenameProvider>{
|
||||
provideRenameEdits: (model: IReadOnlyModel, position: EditorPosition, newName: string, token: CancellationToken): Thenable<modes.WorkspaceEdit> => {
|
||||
provideRenameEdits: (model: IModel, position: EditorPosition, newName: string, token: CancellationToken): Thenable<modes.WorkspaceEdit> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideRenameEdits(handle, model.uri, position, newName)).then(MainThreadLanguageFeatures._reviveWorkspaceEditDto);
|
||||
}
|
||||
});
|
||||
@@ -276,7 +276,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
$registerSuggestSupport(handle: number, selector: vscode.DocumentSelector, triggerCharacters: string[], supportsResolveDetails: boolean): void {
|
||||
this._registrations[handle] = modes.SuggestRegistry.register(toLanguageSelector(selector), <modes.ISuggestSupport>{
|
||||
triggerCharacters,
|
||||
provideCompletionItems: (model: IReadOnlyModel, position: EditorPosition, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
|
||||
provideCompletionItems: (model: IModel, position: EditorPosition, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideCompletionItems(handle, model.uri, position, context)).then(result => {
|
||||
if (!result) {
|
||||
return result;
|
||||
@@ -301,7 +301,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
|
||||
signatureHelpTriggerCharacters: triggerCharacter,
|
||||
|
||||
provideSignatureHelp: (model: IReadOnlyModel, position: EditorPosition, token: CancellationToken): Thenable<modes.SignatureHelp> => {
|
||||
provideSignatureHelp: (model: IModel, position: EditorPosition, token: CancellationToken): Thenable<modes.SignatureHelp> => {
|
||||
return wireCancellationToken(token, this._proxy.$provideSignatureHelp(handle, model.uri, position));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ITree, ITreeOptions } from 'vs/base/parts/tree/browser/tree';
|
||||
import { Context as SuggestContext } from 'vs/editor/contrib/suggest/suggest';
|
||||
import { SuggestController } from 'vs/editor/contrib/suggest/suggestController';
|
||||
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
@@ -170,7 +170,7 @@ export class Repl extends Panel implements IPrivateReplService {
|
||||
|
||||
modes.SuggestRegistry.register({ scheme: debug.DEBUG_SCHEME }, {
|
||||
triggerCharacters: ['.'],
|
||||
provideCompletionItems: (model: IReadOnlyModel, position: Position, _context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
|
||||
provideCompletionItems: (model: IModel, position: Position, _context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
|
||||
const word = this.replInput.getModel().getWordAtPosition(position);
|
||||
const overwriteBefore = word ? word.word.length : 0;
|
||||
const text = this.replInput.getModel().getLineContent(position.lineNumber);
|
||||
|
||||
@@ -31,7 +31,7 @@ export class SmartSnippetInserter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static offsetToPosition(model: editorCommon.ITextModel, offset: number): Position {
|
||||
private static offsetToPosition(model: editorCommon.IModel, offset: number): Position {
|
||||
let offsetBeforeLine = 0;
|
||||
let eolLength = model.getEOL().length;
|
||||
let lineCount = model.getLineCount();
|
||||
@@ -53,7 +53,7 @@ export class SmartSnippetInserter {
|
||||
);
|
||||
}
|
||||
|
||||
public static insertSnippet(model: editorCommon.ITextModel, _position: Position): InsertSnippetResult {
|
||||
public static insertSnippet(model: editorCommon.IModel, _position: Position): InsertSnippetResult {
|
||||
|
||||
let desiredPosition = model.getValueLengthInRange(new Range(1, 1, _position.lineNumber, _position.column));
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import errors = require('vs/base/common/errors');
|
||||
import { IEntryRunContext, Mode, IAutoFocus } from 'vs/base/parts/quickopen/common/quickOpen';
|
||||
import { QuickOpenModel } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { QuickOpenHandler, EditorQuickOpenEntry, QuickOpenAction } from 'vs/workbench/browser/quickopen';
|
||||
import { IEditor, IModelDecorationsChangeAccessor, OverviewRulerLane, IModelDeltaDecoration, IEditorViewState, ITextModel, IDiffEditorModel, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { IEditor, IModelDecorationsChangeAccessor, OverviewRulerLane, IModelDeltaDecoration, IEditorViewState, IModel, IDiffEditorModel, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { Position, IEditorInput, ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
@@ -115,7 +115,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
|
||||
model = (<IDiffEditorModel>model).modified; // Support for diff editor models
|
||||
}
|
||||
|
||||
return model && types.isFunction((<ITextModel>model).getLineCount) ? (<ITextModel>model).getLineCount() : -1;
|
||||
return model && types.isFunction((<IModel>model).getLineCount) ? (<IModel>model).getLineCount() : -1;
|
||||
}
|
||||
|
||||
public run(mode: Mode, context: IEntryRunContext): boolean {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { IEntryRunContext, Mode, IAutoFocus } from 'vs/base/parts/quickopen/comm
|
||||
import { QuickOpenModel, IHighlight } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { QuickOpenHandler, EditorQuickOpenEntryGroup, QuickOpenAction } from 'vs/workbench/browser/quickopen';
|
||||
import filters = require('vs/base/common/filters');
|
||||
import { IEditor, IModelDecorationsChangeAccessor, OverviewRulerLane, IModelDeltaDecoration, IModel, ITokenizedModel, IDiffEditorModel, IEditorViewState, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { IEditor, IModelDecorationsChangeAccessor, OverviewRulerLane, IModelDeltaDecoration, IModel, IDiffEditorModel, IEditorViewState, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { Position, IEditorInput, ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
@@ -426,7 +426,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
|
||||
model = (<IDiffEditorModel>model).modified; // Support for diff editor models
|
||||
}
|
||||
|
||||
if (model && types.isFunction((<ITokenizedModel>model).getLanguageIdentifier)) {
|
||||
if (model && types.isFunction((<IModel>model).getLanguageIdentifier)) {
|
||||
canRun = DocumentSymbolProviderRegistry.has(<IModel>model);
|
||||
}
|
||||
}
|
||||
@@ -485,7 +485,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
|
||||
model = (<IDiffEditorModel>model).modified; // Support for diff editor models
|
||||
}
|
||||
|
||||
if (model && types.isFunction((<ITokenizedModel>model).getLanguageIdentifier)) {
|
||||
if (model && types.isFunction((<IModel>model).getLanguageIdentifier)) {
|
||||
|
||||
// Ask cache first
|
||||
const modelId = (<IModel>model).id;
|
||||
|
||||
Reference in New Issue
Block a user