mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
This commit is contained in:
parent
be6446ddb1
commit
58b32d628a
|
@ -8,6 +8,7 @@ import { StringBuilder } from 'vs/editor/common/core/stringBuilder';
|
|||
import * as viewEvents from 'vs/editor/common/viewEvents';
|
||||
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { BugIndicatingError } from 'vs/base/common/errors';
|
||||
|
||||
/**
|
||||
* Represents a visible line
|
||||
|
@ -80,7 +81,7 @@ export class RenderedLinesCollection<T extends ILine> {
|
|||
public getLine(lineNumber: number): T {
|
||||
const lineIndex = lineNumber - this._rendLineNumberStart;
|
||||
if (lineIndex < 0 || lineIndex >= this._lines.length) {
|
||||
throw new Error('Illegal value for lineNumber');
|
||||
throw new BugIndicatingError('Illegal value for lineNumber');
|
||||
}
|
||||
return this._lines[lineIndex];
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import { TextModelPart } from 'vs/editor/common/model/textModelPart';
|
|||
import { computeIndentLevel } from 'vs/editor/common/model/utils';
|
||||
import { ILanguageConfigurationService, ResolvedLanguageConfiguration } from 'vs/editor/common/languages/languageConfigurationRegistry';
|
||||
import { BracketGuideOptions, HorizontalGuidesState, IActiveIndentGuideInfo, IGuidesTextModelPart, IndentGuide, IndentGuideHorizontalLine } from 'vs/editor/common/textModelGuides';
|
||||
import { BugIndicatingError } from 'vs/base/common/errors';
|
||||
|
||||
export class GuidesTextModelPart extends TextModelPart implements IGuidesTextModelPart {
|
||||
constructor(
|
||||
|
@ -46,7 +47,7 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod
|
|||
const lineCount = this.textModel.getLineCount();
|
||||
|
||||
if (lineNumber < 1 || lineNumber > lineCount) {
|
||||
throw new Error('Illegal value for lineNumber');
|
||||
throw new BugIndicatingError('Illegal value for lineNumber');
|
||||
}
|
||||
|
||||
const foldingRules = this.getLanguageConfiguration(
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { ArrayQueue, pushMany } from 'vs/base/common/arrays';
|
||||
import { VSBuffer, VSBufferReadableStream } from 'vs/base/common/buffer';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { illegalArgument, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { BugIndicatingError, illegalArgument, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IMarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { combinedDisposable, Disposable, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
|
@ -792,7 +792,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
|
|||
public getLineContent(lineNumber: number): string {
|
||||
this._assertNotDisposed();
|
||||
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
|
||||
throw new Error('Illegal value for lineNumber');
|
||||
throw new BugIndicatingError('Illegal value for lineNumber');
|
||||
}
|
||||
|
||||
return this._buffer.getLineContent(lineNumber);
|
||||
|
@ -801,7 +801,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
|
|||
public getLineLength(lineNumber: number): number {
|
||||
this._assertNotDisposed();
|
||||
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
|
||||
throw new Error('Illegal value for lineNumber');
|
||||
throw new BugIndicatingError('Illegal value for lineNumber');
|
||||
}
|
||||
|
||||
return this._buffer.getLineLength(lineNumber);
|
||||
|
@ -834,7 +834,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
|
|||
public getLineMaxColumn(lineNumber: number): number {
|
||||
this._assertNotDisposed();
|
||||
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
|
||||
throw new Error('Illegal value for lineNumber');
|
||||
throw new BugIndicatingError('Illegal value for lineNumber');
|
||||
}
|
||||
return this._buffer.getLineLength(lineNumber) + 1;
|
||||
}
|
||||
|
@ -842,7 +842,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
|
|||
public getLineFirstNonWhitespaceColumn(lineNumber: number): number {
|
||||
this._assertNotDisposed();
|
||||
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
|
||||
throw new Error('Illegal value for lineNumber');
|
||||
throw new BugIndicatingError('Illegal value for lineNumber');
|
||||
}
|
||||
return this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
|
|||
public getLineLastNonWhitespaceColumn(lineNumber: number): number {
|
||||
this._assertNotDisposed();
|
||||
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
|
||||
throw new Error('Illegal value for lineNumber');
|
||||
throw new BugIndicatingError('Illegal value for lineNumber');
|
||||
}
|
||||
return this._buffer.getLineLastNonWhitespaceColumn(lineNumber);
|
||||
}
|
||||
|
|
|
@ -544,7 +544,7 @@ class GrammarTokens extends Disposable {
|
|||
return;
|
||||
}
|
||||
|
||||
startLineNumber = Math.max(1, startLineNumber);
|
||||
startLineNumber = Math.max(1, Math.min(this._textModel.getLineCount(), startLineNumber));
|
||||
endLineNumber = Math.min(this._textModel.getLineCount(), endLineNumber);
|
||||
|
||||
const builder = new ContiguousMultilineTokensBuilder();
|
||||
|
|
Loading…
Reference in a new issue