mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from master
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { CommentRule } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { LanguageIdentifier } from 'vs/editor/common/modes';
|
||||
import { CommentRule } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
|
||||
|
||||
export class CommentMode extends MockMode {
|
||||
|
||||
@@ -2,14 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { AccessibilitySupport } from 'vs/base/common/platform';
|
||||
import { IEnvConfiguration } from 'vs/editor/common/config/commonEditorConfig';
|
||||
import { IEditorHoverOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { EditorZoom } from 'vs/editor/common/config/editorZoom';
|
||||
import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration';
|
||||
import { IEnvConfiguration } from 'vs/editor/common/config/commonEditorConfig';
|
||||
import { AccessibilitySupport } from 'vs/base/common/platform';
|
||||
import { IEditorHoverOptions } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
suite('Common Editor Config', () => {
|
||||
test('Zoom Level', () => {
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { CursorColumns } from 'vs/editor/common/controller/cursorCommon';
|
||||
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { CharacterClassifier } from 'vs/editor/common/core/characterClassifier';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { CharacterClassifier } from 'vs/editor/common/core/characterClassifier';
|
||||
|
||||
suite('CharacterClassifier', () => {
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { LineTokens, IViewLineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { IViewLineTokens, LineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { MetadataConsts } from 'vs/editor/common/modes';
|
||||
|
||||
suite('LineTokens', () => {
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
|
||||
suite('Editor Core - Range', () => {
|
||||
test('empty range', () => {
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ColorId, TokenMetadata } from 'vs/editor/common/modes';
|
||||
import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { ColorId, TokenMetadata } from 'vs/editor/common/modes';
|
||||
|
||||
/**
|
||||
* A token on a line.
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { DiffComputer } from 'vs/editor/common/diff/diffComputer';
|
||||
import { IChange, ICharChange, ILineChange } from 'vs/editor/common/editorCommon';
|
||||
@@ -55,7 +53,7 @@ function assertDiff(originalLines: string[], modifiedLines: string[], expectedCh
|
||||
});
|
||||
let changes = diffComputer.computeDiff();
|
||||
|
||||
let extracted = [];
|
||||
let extracted: IChange[] = [];
|
||||
for (let i = 0; i < changes.length; i++) {
|
||||
extracted.push(extractLineChangeRepresentation(changes[i], <ILineChange>(i < expectedChanges.length ? expectedChanges[i] : null)));
|
||||
}
|
||||
@@ -729,4 +727,122 @@ suite('Editor Diff - DiffComputer', () => {
|
||||
];
|
||||
assertDiff(original, modified, expected, false, false, false);
|
||||
});
|
||||
|
||||
test('issue #44422: Less than ideal diff results', () => {
|
||||
let original = [
|
||||
'export class C {',
|
||||
'',
|
||||
' public m1(): void {',
|
||||
' {',
|
||||
' //2',
|
||||
' //3',
|
||||
' //4',
|
||||
' //5',
|
||||
' //6',
|
||||
' //7',
|
||||
' //8',
|
||||
' //9',
|
||||
' //10',
|
||||
' //11',
|
||||
' //12',
|
||||
' //13',
|
||||
' //14',
|
||||
' //15',
|
||||
' //16',
|
||||
' //17',
|
||||
' //18',
|
||||
' }',
|
||||
' }',
|
||||
'',
|
||||
' public m2(): void {',
|
||||
' if (a) {',
|
||||
' if (b) {',
|
||||
' //A1',
|
||||
' //A2',
|
||||
' //A3',
|
||||
' //A4',
|
||||
' //A5',
|
||||
' //A6',
|
||||
' //A7',
|
||||
' //A8',
|
||||
' }',
|
||||
' }',
|
||||
'',
|
||||
' //A9',
|
||||
' //A10',
|
||||
' //A11',
|
||||
' //A12',
|
||||
' //A13',
|
||||
' //A14',
|
||||
' //A15',
|
||||
' }',
|
||||
'',
|
||||
' public m3(): void {',
|
||||
' if (a) {',
|
||||
' //B1',
|
||||
' }',
|
||||
' //B2',
|
||||
' //B3',
|
||||
' }',
|
||||
'',
|
||||
' public m4(): boolean {',
|
||||
' //1',
|
||||
' //2',
|
||||
' //3',
|
||||
' //4',
|
||||
' }',
|
||||
'',
|
||||
'}',
|
||||
];
|
||||
let modified = [
|
||||
'export class C {',
|
||||
'',
|
||||
' constructor() {',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
' }',
|
||||
'',
|
||||
' public m1(): void {',
|
||||
' {',
|
||||
' //2',
|
||||
' //3',
|
||||
' //4',
|
||||
' //5',
|
||||
' //6',
|
||||
' //7',
|
||||
' //8',
|
||||
' //9',
|
||||
' //10',
|
||||
' //11',
|
||||
' //12',
|
||||
' //13',
|
||||
' //14',
|
||||
' //15',
|
||||
' //16',
|
||||
' //17',
|
||||
' //18',
|
||||
' }',
|
||||
' }',
|
||||
'',
|
||||
' public m4(): boolean {',
|
||||
' //1',
|
||||
' //2',
|
||||
' //3',
|
||||
' //4',
|
||||
' }',
|
||||
'',
|
||||
'}',
|
||||
];
|
||||
let expected = [
|
||||
createLineChange(
|
||||
2, 0, 3, 9
|
||||
),
|
||||
createLineChange(
|
||||
25, 55, 31, 0
|
||||
)
|
||||
];
|
||||
assertDiff(original, modified, expected, false, false, false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { DefaultEndOfLine, ITextModelCreationOptions } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { LanguageIdentifier } from 'vs/editor/common/modes';
|
||||
import URI from 'vs/base/common/uri';
|
||||
|
||||
export function withEditorModel(text: string[], callback: (model: TextModel) => void): void {
|
||||
let model = TextModel.createFromString(text.join('\n'));
|
||||
@@ -25,7 +24,7 @@ export interface IRelaxedTextModelCreationOptions {
|
||||
largeFileOptimizations?: boolean;
|
||||
}
|
||||
|
||||
export function createTextModel(text: string, _options: IRelaxedTextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS, languageIdentifier: LanguageIdentifier = null, uri: URI = null): TextModel {
|
||||
export function createTextModel(text: string, _options: IRelaxedTextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS, languageIdentifier: LanguageIdentifier | null = null, uri: URI | null = null): TextModel {
|
||||
const options: ITextModelCreationOptions = {
|
||||
tabSize: (typeof _options.tabSize === 'undefined' ? TextModel.DEFAULT_CREATION_OPTIONS.tabSize : _options.tabSize),
|
||||
insertSpaces: (typeof _options.insertSpaces === 'undefined' ? TextModel.DEFAULT_CREATION_OPTIONS.insertSpaces : _options.insertSpaces),
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IMode, LanguageIdentifier } from 'vs/editor/common/modes';
|
||||
import { ILanguageSelection } from 'vs/editor/common/services/modeService';
|
||||
|
||||
export class MockMode extends Disposable implements IMode {
|
||||
private _languageIdentifier: LanguageIdentifier;
|
||||
@@ -23,3 +24,9 @@ export class MockMode extends Disposable implements IMode {
|
||||
return this._languageIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
export class StaticLanguageSelector implements ILanguageSelection {
|
||||
readonly onDidChange: Event<LanguageIdentifier> = Event.None;
|
||||
constructor(public readonly languageIdentifier: LanguageIdentifier) { }
|
||||
public dispose(): void { }
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { AccessibilitySupport } from 'vs/base/common/platform';
|
||||
import { CommonEditorConfiguration, IEnvConfiguration } from 'vs/editor/common/config/commonEditorConfig';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
import { AccessibilitySupport } from 'vs/base/common/platform';
|
||||
import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
|
||||
export class TestConfiguration extends CommonEditorConfiguration {
|
||||
|
||||
@@ -39,6 +38,7 @@ export class TestConfiguration extends CommonEditorConfiguration {
|
||||
isMonospace: true,
|
||||
typicalHalfwidthCharacterWidth: 10,
|
||||
typicalFullwidthCharacterWidth: 20,
|
||||
canUseHalfwidthRightwardsArrow: true,
|
||||
spaceWidth: 10,
|
||||
maxDigitWidth: 10,
|
||||
}, true);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ITextBufferBuilder, ITextBufferFactory, ITextBuffer, DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { DefaultEndOfLine, ITextBuffer, ITextBufferBuilder, ITextBufferFactory } from 'vs/editor/common/model';
|
||||
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
||||
|
||||
export function doBenchmark<T>(id: string, ts: T[], fn: (t: T) => void) {
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
require('../../../../../../bootstrap-amd').bootstrap('vs/editor/test/common/model/benchmark/entry');
|
||||
require('../../../../../../bootstrap-amd').load('vs/editor/test/common/model/benchmark/entry');
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import 'vs/editor/test/common/model/benchmark/modelbuilder.benchmark';
|
||||
import 'vs/editor/test/common/model/benchmark/operations.benchmark';
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
||||
import { ITextBufferBuilder } from 'vs/editor/common/model';
|
||||
import { generateRandomChunkWithLF } from 'vs/editor/test/common/model/linesTextBuffer/textBufferAutoTestUtils';
|
||||
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
||||
import { doBenchmark } from 'vs/editor/test/common/model/benchmark/benchmarkUtils';
|
||||
import { generateRandomChunkWithLF } from 'vs/editor/test/common/model/linesTextBuffer/textBufferAutoTestUtils';
|
||||
|
||||
let pieceTreeTextBufferBuilder = new PieceTreeTextBufferBuilder();
|
||||
let chunks: string[] = [];
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ITextBufferBuilder, EndOfLinePreference } from 'vs/editor/common/model';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { EndOfLinePreference, ITextBufferBuilder } from 'vs/editor/common/model';
|
||||
import { BenchmarkSuite } from 'vs/editor/test/common/model/benchmark/benchmarkUtils';
|
||||
import { generateRandomChunkWithLF, generateRandomEdits, generateSequentialInserts, getRandomInt } from 'vs/editor/test/common/model/linesTextBuffer/textBufferAutoTestUtils';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
|
||||
let fileSizes = [1, 1000, 64 * 1000, 32 * 1000 * 1000];
|
||||
let editTypes = [
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ITextBufferBuilder } from 'vs/editor/common/model';
|
||||
import { generateRandomReplaces, generateRandomChunkWithLF } from 'vs/editor/test/common/model/linesTextBuffer/textBufferAutoTestUtils';
|
||||
import { BenchmarkSuite } from 'vs/editor/test/common/model/benchmark/benchmarkUtils';
|
||||
import { generateRandomChunkWithLF, generateRandomReplaces } from 'vs/editor/test/common/model/linesTextBuffer/textBufferAutoTestUtils';
|
||||
|
||||
let fileSizes = [1, 1000, 64 * 1000, 32 * 1000 * 1000];
|
||||
|
||||
|
||||
@@ -3,15 +3,13 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { EndOfLineSequence, IIdentifiedSingleEditOperation, EndOfLinePreference } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
import { MirrorTextModel } from 'vs/editor/common/model/mirrorTextModel';
|
||||
import { assertSyncedModels, testApplyEditsWithSyncedModels } from 'vs/editor/test/common/model/editableTextModelTestUtils';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
import { assertSyncedModels, testApplyEditsWithSyncedModels } from 'vs/editor/test/common/model/editableTextModelTestUtils';
|
||||
|
||||
function createEditableTextModelFromString(text: string): TextModel {
|
||||
return new TextModel(text, TextModel.DEFAULT_CREATION_OPTIONS, null);
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
import { testApplyEditsWithSyncedModels } from 'vs/editor/test/common/model/editableTextModelTestUtils';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
|
||||
const GENERATE_TESTS = false;
|
||||
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { MirrorTextModel } from 'vs/editor/common/model/mirrorTextModel';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
import { MirrorTextModel } from 'vs/editor/common/model/mirrorTextModel';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
import { EndOfLinePreference, IIdentifiedSingleEditOperation, EndOfLineSequence } from 'vs/editor/common/model';
|
||||
|
||||
export function testApplyEditsWithSyncedModels(original: string[], edits: IIdentifiedSingleEditOperation[], expected: string[], inputEditsAreInvalid: boolean = false): void {
|
||||
let originalStr = original.join('\n');
|
||||
@@ -88,7 +87,7 @@ function assertLineMapping(model: TextModel, msg: string): void {
|
||||
}
|
||||
|
||||
|
||||
export function assertSyncedModels(text: string, callback: (model: TextModel, assertMirrorModels: () => void) => void, setup: (model: TextModel) => void = null): void {
|
||||
export function assertSyncedModels(text: string, callback: (model: TextModel, assertMirrorModels: () => void) => void, setup: ((model: TextModel) => void) | null = null): void {
|
||||
let model = new TextModel(text, TextModel.DEFAULT_CREATION_OPTIONS, null);
|
||||
model.setEOL(EndOfLineSequence.LF);
|
||||
assertLineMapping(model, 'model');
|
||||
@@ -98,7 +97,7 @@ export function assertSyncedModels(text: string, callback: (model: TextModel, as
|
||||
assertLineMapping(model, 'model');
|
||||
}
|
||||
|
||||
let mirrorModel2 = new MirrorTextModel(null, model.getLinesContent(), model.getEOL(), model.getVersionId());
|
||||
let mirrorModel2 = new MirrorTextModel(null!, model.getLinesContent(), model.getEOL(), model.getVersionId());
|
||||
let mirrorModel2PrevVersionId = model.getVersionId();
|
||||
|
||||
model.onDidChangeContent((e: IModelContentChangedEvent) => {
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { IntervalTree, IntervalNode, getNodeColor, NodeColor, SENTINEL, intervalCompare, setNodeStickiness, nodeAcceptEdit } from 'vs/editor/common/model/intervalTree';
|
||||
import { TrackedRangeStickiness } from 'vs/editor/common/model';
|
||||
import { IntervalNode, IntervalTree, NodeColor, SENTINEL, getNodeColor, intervalCompare, nodeAcceptEdit, setNodeStickiness } from 'vs/editor/common/model/intervalTree';
|
||||
|
||||
const GENERATE_TESTS = false;
|
||||
let TEST_COUNT = GENERATE_TESTS ? 10000 : 0;
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { PieceTreeTextBuffer, IValidatedEditOperation } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer';
|
||||
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { IValidatedEditOperation, PieceTreeTextBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer';
|
||||
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
|
||||
|
||||
suite('PieceTreeTextBuffer._getInverseEdits', () => {
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { PieceTreeTextBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer';
|
||||
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
|
||||
|
||||
export function testTextBufferFactory(text: string, eol: string, mightContainNonBasicASCII: boolean, mightContainRTL: boolean): void {
|
||||
const textBuffer = <PieceTreeTextBuffer>createTextBufferFactory(text).create(DefaultEndOfLine.LF);
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { IIdentifiedSingleEditOperation, DefaultEndOfLine, ITextBufferBuilder, ITextBuffer } from 'vs/editor/common/model';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { DefaultEndOfLine, IIdentifiedSingleEditOperation, ITextBuffer, ITextBufferBuilder } from 'vs/editor/common/model';
|
||||
|
||||
export function getRandomInt(min: number, max: number): number {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
@@ -33,7 +32,7 @@ export function getRandomString(minLength: number, maxLength: number): string {
|
||||
}
|
||||
|
||||
export function generateRandomEdits(chunks: string[], editCnt: number): IIdentifiedSingleEditOperation[] {
|
||||
let lines = [];
|
||||
let lines: string[] = [];
|
||||
for (let i = 0; i < chunks.length; i++) {
|
||||
let newLines = chunks[i].split(/\r\n|\r|\n/);
|
||||
if (lines.length === 0) {
|
||||
@@ -66,7 +65,7 @@ export function generateRandomEdits(chunks: string[], editCnt: number): IIdentif
|
||||
}
|
||||
|
||||
export function generateSequentialInserts(chunks: string[], editCnt: number): IIdentifiedSingleEditOperation[] {
|
||||
let lines = [];
|
||||
let lines: string[] = [];
|
||||
for (let i = 0; i < chunks.length; i++) {
|
||||
let newLines = chunks[i].split(/\r\n|\r|\n/);
|
||||
if (lines.length === 0) {
|
||||
@@ -101,7 +100,7 @@ export function generateSequentialInserts(chunks: string[], editCnt: number): II
|
||||
}
|
||||
|
||||
export function generateRandomReplaces(chunks: string[], editCnt: number, searchStringLen: number, replaceStringLen: number): IIdentifiedSingleEditOperation[] {
|
||||
let lines = [];
|
||||
let lines: string[] = [];
|
||||
for (let i = 0; i < chunks.length; i++) {
|
||||
let newLines = chunks[i].split(/\r\n|\r|\n/);
|
||||
if (lines.length === 0) {
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { LineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { LanguageIdentifier, MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { ViewLineToken, ViewLineTokenFactory } from 'vs/editor/test/common/core/viewLineToken';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { LanguageIdentifier, MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { ViewLineToken, ViewLineTokenFactory } from 'vs/editor/test/common/core/viewLineToken';
|
||||
|
||||
interface ILineEdit {
|
||||
startColumn: number;
|
||||
|
||||
@@ -2,17 +2,16 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
|
||||
// --------- utils
|
||||
|
||||
@@ -34,8 +33,8 @@ suite('Editor Model - Model Modes 1', () => {
|
||||
}
|
||||
};
|
||||
|
||||
let thisModel: TextModel = null;
|
||||
let languageRegistration: IDisposable = null;
|
||||
let thisModel: TextModel | null = null;
|
||||
let languageRegistration: IDisposable | null = null;
|
||||
|
||||
setup(() => {
|
||||
const TEXT =
|
||||
@@ -204,8 +203,8 @@ suite('Editor Model - Model Modes 2', () => {
|
||||
stateEqual((<any>model)._tokens._lastState, states[len]);
|
||||
}
|
||||
|
||||
let thisModel: TextModel = null;
|
||||
let languageRegistration: IDisposable = null;
|
||||
let thisModel: TextModel | null = null;
|
||||
let languageRegistration: IDisposable | null = null;
|
||||
|
||||
setup(() => {
|
||||
const TEXT =
|
||||
|
||||
@@ -2,23 +2,19 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Disposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import {
|
||||
ModelRawContentChangedEvent, ModelRawFlush, ModelRawLineChanged,
|
||||
ModelRawLinesDeleted, ModelRawLinesInserted
|
||||
} from 'vs/editor/common/model/textModelEvents';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { LanguageIdentifier, TokenizationRegistry, IState, MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { ModelRawContentChangedEvent, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from 'vs/editor/common/model/textModelEvents';
|
||||
import { IState, LanguageIdentifier, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/modes';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
|
||||
import { dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
|
||||
|
||||
// --------- utils
|
||||
|
||||
@@ -106,7 +102,7 @@ suite('Editor Model - Model', () => {
|
||||
});
|
||||
|
||||
test('model insert text without newline eventing', () => {
|
||||
let e: ModelRawContentChangedEvent = null;
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
@@ -125,7 +121,7 @@ suite('Editor Model - Model', () => {
|
||||
});
|
||||
|
||||
test('model insert text with one newline eventing', () => {
|
||||
let e: ModelRawContentChangedEvent = null;
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
@@ -202,7 +198,7 @@ suite('Editor Model - Model', () => {
|
||||
});
|
||||
|
||||
test('model delete text from one line eventing', () => {
|
||||
let e: ModelRawContentChangedEvent = null;
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
@@ -221,7 +217,7 @@ suite('Editor Model - Model', () => {
|
||||
});
|
||||
|
||||
test('model delete all text from a line eventing', () => {
|
||||
let e: ModelRawContentChangedEvent = null;
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
@@ -240,7 +236,7 @@ suite('Editor Model - Model', () => {
|
||||
});
|
||||
|
||||
test('model delete text from two lines eventing', () => {
|
||||
let e: ModelRawContentChangedEvent = null;
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
@@ -260,7 +256,7 @@ suite('Editor Model - Model', () => {
|
||||
});
|
||||
|
||||
test('model delete text from many lines eventing', () => {
|
||||
let e: ModelRawContentChangedEvent = null;
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
@@ -311,7 +307,7 @@ suite('Editor Model - Model', () => {
|
||||
|
||||
// --------- setValue
|
||||
test('setValue eventing', () => {
|
||||
let e: ModelRawContentChangedEvent = null;
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
@@ -394,7 +390,7 @@ suite('Editor Model - Words', () => {
|
||||
tokenize: undefined,
|
||||
tokenize2: (line: string, state: IState): TokenizationResult2 => {
|
||||
const tokensArr: number[] = [];
|
||||
let prevLanguageId: LanguageIdentifier = undefined;
|
||||
let prevLanguageId: LanguageIdentifier | undefined = undefined;
|
||||
for (let i = 0; i < line.length; i++) {
|
||||
const languageId = (line.charAt(i) === 'x' ? INNER_LANGUAGE_ID : OUTER_LANGUAGE_ID);
|
||||
if (prevLanguageId !== languageId) {
|
||||
@@ -466,4 +462,30 @@ suite('Editor Model - Words', () => {
|
||||
assert.deepEqual(model.getWordAtPosition(new Position(1, 6)), { word: 'xx', startColumn: 4, endColumn: 6 });
|
||||
assert.deepEqual(model.getWordAtPosition(new Position(1, 7)), { word: 'ab', startColumn: 7, endColumn: 9 });
|
||||
});
|
||||
|
||||
test('issue #61296: VS code freezes when editing CSS file with emoji', () => {
|
||||
const MODE_ID = new LanguageIdentifier('testMode', 4);
|
||||
|
||||
const mode = new class extends MockMode {
|
||||
constructor() {
|
||||
super(MODE_ID);
|
||||
this._register(LanguageConfigurationRegistry.register(this.getLanguageIdentifier(), {
|
||||
wordPattern: /(#?-?\d*\.\d\w*%?)|(::?[\w-]*(?=[^,{;]*[,{]))|(([@#.!])?[\w-?]+%?|[@#!.])/g
|
||||
}));
|
||||
}
|
||||
};
|
||||
disposables.push(mode);
|
||||
|
||||
const thisModel = TextModel.createFromString('.🐷-a-b', undefined, MODE_ID);
|
||||
disposables.push(thisModel);
|
||||
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 1)), { word: '.', startColumn: 1, endColumn: 2 });
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 2)), { word: '.', startColumn: 1, endColumn: 2 });
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 3)), null);
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 4)), { word: '-a-b', startColumn: 4, endColumn: 8 });
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 5)), { word: '-a-b', startColumn: 4, endColumn: 8 });
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 6)), { word: '-a-b', startColumn: 4, endColumn: 8 });
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 7)), { word: '-a-b', startColumn: 4, endColumn: 8 });
|
||||
assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 8)), { word: '-a-b', startColumn: 4, endColumn: 8 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IModelDeltaDecoration, TrackedRangeStickiness, EndOfLineSequence } from 'vs/editor/common/model';
|
||||
import { EndOfLineSequence, IModelDeltaDecoration, TrackedRangeStickiness } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
|
||||
// --------- utils
|
||||
@@ -51,7 +50,7 @@ function addDecoration(model: TextModel, startLineNumber: number, startColumn: n
|
||||
}
|
||||
|
||||
function lineHasDecorations(model: TextModel, lineNumber: number, decorations: { start: number; end: number; className: string; }[]) {
|
||||
let lineDecorations = [];
|
||||
let lineDecorations: Array<{ start: number; end: number; className: string; }> = [];
|
||||
let decs = model.getLineDecorations(lineNumber);
|
||||
for (let i = 0, len = decs.length; i < len; i++) {
|
||||
lineDecorations.push({
|
||||
@@ -1370,4 +1369,22 @@ suite('deltaDecorations', () => {
|
||||
|
||||
model.dispose();
|
||||
});
|
||||
|
||||
test('issue #41492: URL highlighting persists after pasting over url', () => {
|
||||
|
||||
let model = TextModel.createFromString([
|
||||
'My First Line'
|
||||
].join('\n'));
|
||||
|
||||
const id = model.deltaDecorations([], [{ range: new Range(1, 2, 1, 14), options: { stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges, collapseOnReplaceEdit: true } }])[0];
|
||||
model.applyEdits([{
|
||||
range: new Range(1, 1, 1, 14),
|
||||
text: 'Some new text that is longer than the previous one',
|
||||
forceMoveMarkers: false
|
||||
}]);
|
||||
const actual = model.getDecorationRange(id);
|
||||
assert.deepEqual(actual, new Range(1, 1, 1, 1));
|
||||
|
||||
model.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { WordCharacterClassifier } from 'vs/editor/common/controller/wordCharacterClassifier';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { PieceTreeBase } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase';
|
||||
import { SENTINEL, NodeColor, TreeNode } from 'vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase';
|
||||
import { PieceTreeTextBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer';
|
||||
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
||||
import { NodeColor, SENTINEL, TreeNode } from 'vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { ITextSnapshot } from 'vs/platform/files/common/files';
|
||||
import { SearchData } from 'vs/editor/common/model/textModelSearch';
|
||||
import { WordCharacterClassifier } from 'vs/editor/common/controller/wordCharacterClassifier';
|
||||
import { ITextSnapshot } from 'vs/platform/files/common/files';
|
||||
|
||||
const alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n';
|
||||
|
||||
@@ -1517,7 +1516,7 @@ suite('random is unsupervised', () => {
|
||||
|
||||
test('random chunks', function () {
|
||||
this.timeout(500000);
|
||||
let chunks = [];
|
||||
let chunks: string[] = [];
|
||||
for (let i = 0; i < 5; i++) {
|
||||
chunks.push(randomStr(1000));
|
||||
}
|
||||
@@ -1552,7 +1551,7 @@ suite('random is unsupervised', () => {
|
||||
|
||||
test('random chunks 2', function () {
|
||||
this.timeout(500000);
|
||||
let chunks = [];
|
||||
let chunks: string[] = [];
|
||||
chunks.push(randomStr(1000));
|
||||
|
||||
let pieceTable = createTextBuffer(chunks, false);
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { UTF8_BOM_CHARACTER } from 'vs/base/common/strings';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel';
|
||||
import { UTF8_BOM_CHARACTER } from 'vs/base/common/strings';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
function testGuessIndentation(defaultInsertSpaces: boolean, defaultTabSize: number, expectedInsertSpaces: boolean, expectedTabSize: number, text: string[], msg?: string): void {
|
||||
@@ -315,7 +314,7 @@ suite('Editor Model - TextModel', () => {
|
||||
' ',
|
||||
' ',
|
||||
], 'whitespace lines don\'t count');
|
||||
assertGuess(true, 4, [
|
||||
assertGuess(true, 3, [
|
||||
'x',
|
||||
' x',
|
||||
' x',
|
||||
@@ -328,8 +327,8 @@ suite('Editor Model - TextModel', () => {
|
||||
' x',
|
||||
' x',
|
||||
' x',
|
||||
], 'odd number is not allowed: 6x3, 3x4');
|
||||
assertGuess(true, 4, [
|
||||
], '6x3, 3x4');
|
||||
assertGuess(true, 5, [
|
||||
'x',
|
||||
' x',
|
||||
' x',
|
||||
@@ -342,8 +341,12 @@ suite('Editor Model - TextModel', () => {
|
||||
' x',
|
||||
' x',
|
||||
' x',
|
||||
], 'odd number is not allowed: 6x5, 3x4');
|
||||
assertGuess(true, 4, [
|
||||
], '6x5, 3x4');
|
||||
assertGuess(true, 7, [
|
||||
'x',
|
||||
' x',
|
||||
' x',
|
||||
' x',
|
||||
'x',
|
||||
' x',
|
||||
' x',
|
||||
@@ -352,11 +355,7 @@ suite('Editor Model - TextModel', () => {
|
||||
' x',
|
||||
' x',
|
||||
' x',
|
||||
'x',
|
||||
' x',
|
||||
' x',
|
||||
' x',
|
||||
], 'odd number is not allowed: 6x7, 3x4');
|
||||
], '6x7, 1x5, 2x4');
|
||||
assertGuess(true, 2, [
|
||||
'x',
|
||||
' x',
|
||||
@@ -508,7 +507,7 @@ suite('Editor Model - TextModel', () => {
|
||||
' x',
|
||||
' x',
|
||||
], '6x4, 2x5, 4x8');
|
||||
assertGuess(true, undefined, [
|
||||
assertGuess(true, 3, [
|
||||
'x',
|
||||
' x',
|
||||
' x',
|
||||
@@ -550,6 +549,32 @@ suite('Editor Model - TextModel', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test('issue #55818: Broken indentation detection', () => {
|
||||
assertGuess(true, 2, [
|
||||
'',
|
||||
'/* REQUIRE */',
|
||||
'',
|
||||
'const foo = require ( \'foo\' ),',
|
||||
' bar = require ( \'bar\' );',
|
||||
'',
|
||||
'/* MY FN */',
|
||||
'',
|
||||
'function myFn () {',
|
||||
'',
|
||||
' const asd = 1,',
|
||||
' dsa = 2;',
|
||||
'',
|
||||
' return bar ( foo ( asd ) );',
|
||||
'',
|
||||
'}',
|
||||
'',
|
||||
'/* EXPORT */',
|
||||
'',
|
||||
'module.exports = myFn;',
|
||||
'',
|
||||
]);
|
||||
});
|
||||
|
||||
test('validatePosition', () => {
|
||||
|
||||
let m = TextModel.createFromString('line one\nline two');
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { FindMatch, EndOfLineSequence } from 'vs/editor/common/model';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { TextModelSearch, SearchParams, SearchData } from 'vs/editor/common/model/textModelSearch';
|
||||
import { getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { EndOfLineSequence, FindMatch } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { SearchData, SearchParams, TextModelSearch, isMultilineRegexSource } from 'vs/editor/common/model/textModelSearch';
|
||||
import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper';
|
||||
|
||||
// --------- Find
|
||||
@@ -18,7 +17,7 @@ suite('TextModelSearch', () => {
|
||||
|
||||
const usualWordSeparators = getMapForWordSeparators(USUAL_WORD_SEPARATORS);
|
||||
|
||||
function assertFindMatch(actual: FindMatch, expectedRange: Range, expectedMatches: string[] = null): void {
|
||||
function assertFindMatch(actual: FindMatch, expectedRange: Range, expectedMatches: string[] | null = null): void {
|
||||
assert.deepEqual(actual, new FindMatch(expectedRange, expectedMatches));
|
||||
}
|
||||
|
||||
@@ -633,4 +632,106 @@ suite('TextModelSearch', () => {
|
||||
assertParseSearchResult('foo\\r', true, false, null, new SearchData(/foo\r/gim, null, null));
|
||||
assertParseSearchResult('foo\\\\r', true, false, null, new SearchData(/foo\\r/gi, null, null));
|
||||
});
|
||||
|
||||
test('issue #53415. \W should match line break.', () => {
|
||||
assertFindMatches(
|
||||
[
|
||||
'text',
|
||||
'180702-',
|
||||
'180703-180704'
|
||||
].join('\n'),
|
||||
'\\d{6}-\\W', true, false, null,
|
||||
[
|
||||
[2, 1, 3, 1]
|
||||
]
|
||||
);
|
||||
|
||||
assertFindMatches(
|
||||
[
|
||||
'Just some text',
|
||||
'',
|
||||
'Just'
|
||||
].join('\n'),
|
||||
'\\W', true, false, null,
|
||||
[
|
||||
[1, 5, 1, 6],
|
||||
[1, 10, 1, 11],
|
||||
[1, 15, 2, 1],
|
||||
[2, 1, 3, 1]
|
||||
]
|
||||
);
|
||||
|
||||
// Line break doesn't affect the result as we always use \n as line break when doing search
|
||||
assertFindMatches(
|
||||
[
|
||||
'Just some text',
|
||||
'',
|
||||
'Just'
|
||||
].join('\r\n'),
|
||||
'\\W', true, false, null,
|
||||
[
|
||||
[1, 5, 1, 6],
|
||||
[1, 10, 1, 11],
|
||||
[1, 15, 2, 1],
|
||||
[2, 1, 3, 1]
|
||||
]
|
||||
);
|
||||
|
||||
assertFindMatches(
|
||||
[
|
||||
'Just some text',
|
||||
'\tJust',
|
||||
'Just'
|
||||
].join('\n'),
|
||||
'\\W', true, false, null,
|
||||
[
|
||||
[1, 5, 1, 6],
|
||||
[1, 10, 1, 11],
|
||||
[1, 15, 2, 1],
|
||||
[2, 1, 2, 2],
|
||||
[2, 6, 3, 1],
|
||||
]
|
||||
);
|
||||
|
||||
// line break is seen as one non-word character
|
||||
assertFindMatches(
|
||||
[
|
||||
'Just some text',
|
||||
'',
|
||||
'Just'
|
||||
].join('\n'),
|
||||
'\\W{2}', true, false, null,
|
||||
[
|
||||
[1, 5, 1, 7],
|
||||
[1, 16, 3, 1]
|
||||
]
|
||||
);
|
||||
|
||||
// even if it's \r\n
|
||||
assertFindMatches(
|
||||
[
|
||||
'Just some text',
|
||||
'',
|
||||
'Just'
|
||||
].join('\r\n'),
|
||||
'\\W{2}', true, false, null,
|
||||
[
|
||||
[1, 5, 1, 7],
|
||||
[1, 16, 3, 1]
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
test('isMultilineRegexSource', () => {
|
||||
assert(!isMultilineRegexSource('foo'));
|
||||
assert(!isMultilineRegexSource(''));
|
||||
assert(!isMultilineRegexSource('foo\\sbar'));
|
||||
assert(!isMultilineRegexSource('\\\\notnewline'));
|
||||
|
||||
assert(isMultilineRegexSource('foo\\nbar'));
|
||||
assert(isMultilineRegexSource('foo\\nbar\\s'));
|
||||
assert(isMultilineRegexSource('foo\\r\\n'));
|
||||
assert(isMultilineRegexSource('\\n'));
|
||||
assert(isMultilineRegexSource('foo\\W'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ViewLineToken } from 'vs/editor/test/common/core/viewLineToken';
|
||||
import { ITokenizationSupport, TokenizationRegistry, LanguageId, LanguageIdentifier, MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { CharacterPair } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { IFoundBracket } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { ITokenizationSupport, LanguageId, LanguageIdentifier, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/modes';
|
||||
import { CharacterPair } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { ViewLineToken } from 'vs/editor/test/common/core/viewLineToken';
|
||||
|
||||
suite('TextModelWithTokens', () => {
|
||||
|
||||
@@ -159,7 +158,7 @@ suite('TextModelWithTokens - bracket matching', () => {
|
||||
}
|
||||
|
||||
const languageIdentifier = new LanguageIdentifier('bracketMode1', LanguageId.PlainText);
|
||||
let registration: IDisposable = null;
|
||||
let registration: IDisposable | null = null;
|
||||
|
||||
setup(() => {
|
||||
registration = LanguageConfigurationRegistry.register(languageIdentifier, {
|
||||
@@ -391,6 +390,34 @@ suite('TextModelWithTokens regression tests', () => {
|
||||
model.dispose();
|
||||
registration.dispose();
|
||||
});
|
||||
|
||||
test('issue #63822: Wrong embedded language detected for empty lines', () => {
|
||||
const outerMode = new LanguageIdentifier('outerMode', 3);
|
||||
const innerMode = new LanguageIdentifier('innerMode', 4);
|
||||
|
||||
const tokenizationSupport: ITokenizationSupport = {
|
||||
getInitialState: () => NULL_STATE,
|
||||
tokenize: undefined,
|
||||
tokenize2: (line, state) => {
|
||||
let tokens = new Uint32Array(2);
|
||||
tokens[0] = 0;
|
||||
tokens[1] = (
|
||||
innerMode.id << MetadataConsts.LANGUAGEID_OFFSET
|
||||
) >>> 0;
|
||||
return new TokenizationResult2(tokens, state);
|
||||
}
|
||||
};
|
||||
|
||||
let registration = TokenizationRegistry.register(outerMode.language, tokenizationSupport);
|
||||
|
||||
let model = TextModel.createFromString('A model with one line', undefined, outerMode);
|
||||
|
||||
model.forceTokenization(1);
|
||||
assert.equal(model.getLanguageIdAtPosition(1, 1), innerMode.id);
|
||||
|
||||
model.dispose();
|
||||
registration.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
suite('TextModel.getLineIndentGuide', () => {
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { StandardAutoClosingPairConditional } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { StandardTokenType } from 'vs/editor/common/modes';
|
||||
import { StandardAutoClosingPairConditional } from 'vs/editor/common/modes/languageConfiguration';
|
||||
|
||||
suite('StandardAutoClosingPairConditional', () => {
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { score } from 'vs/editor/common/modes/languageSelector';
|
||||
|
||||
suite('LanguageSelector', function () {
|
||||
@@ -96,4 +94,14 @@ suite('LanguageSelector', function () {
|
||||
assert.equal(score({ language: 'javascript', scheme: 'file', hasAccessToAllModels: true }, doc.uri, doc.langId, false), 10);
|
||||
assert.equal(score(['fooLang', '*', { language: '*', hasAccessToAllModels: true }], doc.uri, doc.langId, false), 5);
|
||||
});
|
||||
|
||||
test('Document selector match - unexpected result value #60232', function () {
|
||||
let selector = {
|
||||
language: 'json',
|
||||
scheme: 'file',
|
||||
pattern: '**/*.interface.json'
|
||||
};
|
||||
let value = score(selector, URI.parse('file:///C:/Users/zlhe/Desktop/test.interface.json'), 'json', true);
|
||||
assert.equal(value, 10);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { ILink } from 'vs/editor/common/modes';
|
||||
import { ILinkComputerTarget, computeLinks } from 'vs/editor/common/modes/linkComputer';
|
||||
@@ -197,4 +195,11 @@ suite('Editor Modes - Link Computer', () => {
|
||||
' https://msdn.microsoft.com/en-us/library/windows/desktop/ms687414(v=vs.85).aspx '
|
||||
);
|
||||
});
|
||||
|
||||
test('issue #62278: "Ctrl + click to follow link" for IPv6 URLs', () => {
|
||||
assertLink(
|
||||
'let x = "http://[::1]:5000/connect/token"',
|
||||
' http://[::1]:5000/connect/token '
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { StandardTokenType } from 'vs/editor/common/modes';
|
||||
import { CharacterPairSupport } from 'vs/editor/common/modes/supports/characterPair';
|
||||
import { TokenText, createFakeScopedLineTokens } from 'vs/editor/test/common/modesTestUtils';
|
||||
import { StandardTokenType } from 'vs/editor/common/modes';
|
||||
|
||||
suite('CharacterPairSupport', () => {
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { BracketElectricCharacterSupport, IElectricAction } from 'vs/editor/common/modes/supports/electricCharacter';
|
||||
import { createFakeScopedLineTokens, TokenText } from 'vs/editor/test/common/modesTestUtils';
|
||||
import { RichEditBrackets } from 'vs/editor/common/modes/supports/richEditBrackets';
|
||||
import { LanguageIdentifier, StandardTokenType } from 'vs/editor/common/modes';
|
||||
import { BracketElectricCharacterSupport, IElectricAction } from 'vs/editor/common/modes/supports/electricCharacter';
|
||||
import { RichEditBrackets } from 'vs/editor/common/modes/supports/richEditBrackets';
|
||||
import { TokenText, createFakeScopedLineTokens } from 'vs/editor/test/common/modesTestUtils';
|
||||
|
||||
const fakeLanguageIdentifier = new LanguageIdentifier('test', 3);
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IndentAction } from 'vs/editor/common/modes/languageConfiguration';
|
||||
|
||||
export const javascriptOnEnterRules = [
|
||||
{
|
||||
// e.g. /** | */
|
||||
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
||||
afterText: /^\s*\*\/$/,
|
||||
action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
|
||||
}, {
|
||||
// e.g. /** ...|
|
||||
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
||||
action: { indentAction: IndentAction.None, appendText: ' * ' }
|
||||
}, {
|
||||
// e.g. * ...|
|
||||
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
|
||||
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
|
||||
action: { indentAction: IndentAction.None, appendText: '* ' }
|
||||
}, {
|
||||
// e.g. */|
|
||||
beforeText: /^(\t|[ ])*[ ]\*\/\s*$/,
|
||||
action: { indentAction: IndentAction.None, removeText: 1 }
|
||||
},
|
||||
{
|
||||
// e.g. *-----*/|
|
||||
beforeText: /^(\t|[ ])*[ ]\*[^/]*\*\/\s*$/,
|
||||
action: { indentAction: IndentAction.None, removeText: 1 }
|
||||
}
|
||||
];
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { CharacterPair, IndentAction } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { OnEnterSupport } from 'vs/editor/common/modes/supports/onEnter';
|
||||
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
|
||||
|
||||
suite('OnEnter', () => {
|
||||
|
||||
@@ -49,32 +48,10 @@ suite('OnEnter', () => {
|
||||
|
||||
test('uses regExpRules', () => {
|
||||
let support = new OnEnterSupport({
|
||||
regExpRules: [
|
||||
{
|
||||
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
||||
afterText: /^\s*\*\/$/,
|
||||
action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
|
||||
},
|
||||
{
|
||||
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
||||
action: { indentAction: IndentAction.None, appendText: ' * ' }
|
||||
},
|
||||
{
|
||||
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
||||
action: { indentAction: IndentAction.None, appendText: '* ' }
|
||||
},
|
||||
{
|
||||
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
|
||||
action: { indentAction: IndentAction.None, removeText: 1 }
|
||||
},
|
||||
{
|
||||
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
|
||||
action: { indentAction: IndentAction.None, removeText: 1 }
|
||||
}
|
||||
]
|
||||
regExpRules: javascriptOnEnterRules
|
||||
});
|
||||
let testIndentAction = (beforeText: string, afterText: string, expectedIndentAction: IndentAction, expectedAppendText: string, removeText: number = 0) => {
|
||||
let actual = support.onEnter('', beforeText, afterText);
|
||||
let testIndentAction = (oneLineAboveText: string, beforeText: string, afterText: string, expectedIndentAction: IndentAction, expectedAppendText: string, removeText: number = 0) => {
|
||||
let actual = support.onEnter(oneLineAboveText, beforeText, afterText);
|
||||
if (expectedIndentAction === null) {
|
||||
assert.equal(actual, null, 'isNull:' + beforeText);
|
||||
} else {
|
||||
@@ -89,40 +66,70 @@ suite('OnEnter', () => {
|
||||
}
|
||||
};
|
||||
|
||||
testIndentAction('\t/**', ' */', IndentAction.IndentOutdent, ' * ');
|
||||
testIndentAction('\t/**', '', IndentAction.None, ' * ');
|
||||
testIndentAction('\t/** * / * / * /', '', IndentAction.None, ' * ');
|
||||
testIndentAction('\t/** /*', '', IndentAction.None, ' * ');
|
||||
testIndentAction('/**', '', IndentAction.None, ' * ');
|
||||
testIndentAction('\t/**/', '', null, null);
|
||||
testIndentAction('\t/***/', '', null, null);
|
||||
testIndentAction('\t/*******/', '', null, null);
|
||||
testIndentAction('\t/** * * * * */', '', null, null);
|
||||
testIndentAction('\t/** */', '', null, null);
|
||||
testIndentAction('\t/** asdfg */', '', null, null);
|
||||
testIndentAction('\t/* asdfg */', '', null, null);
|
||||
testIndentAction('\t/* asdfg */', '', null, null);
|
||||
testIndentAction('\t/** asdfg */', '', null, null);
|
||||
testIndentAction('*/', '', null, null);
|
||||
testIndentAction('\t/*', '', null, null);
|
||||
testIndentAction('\t*', '', null, null);
|
||||
testIndentAction('\t *', '', IndentAction.None, '* ');
|
||||
testIndentAction('\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('\t * */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('\t * * / * / * / */', '', null, null);
|
||||
testIndentAction('\t * ', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * ', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * asdfsfagadfg', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * /*', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
|
||||
testIndentAction(' */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('\t\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction(' */', '', IndentAction.None, null, 1);
|
||||
testIndentAction(' */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction(' *--------------------------------------------------------------------------------------------*/', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', '\t/**', ' */', IndentAction.IndentOutdent, ' * ');
|
||||
testIndentAction('', '\t/**', '', IndentAction.None, ' * ');
|
||||
testIndentAction('', '\t/** * / * / * /', '', IndentAction.None, ' * ');
|
||||
testIndentAction('', '\t/** /*', '', IndentAction.None, ' * ');
|
||||
testIndentAction('', '/**', '', IndentAction.None, ' * ');
|
||||
testIndentAction('', '\t/**/', '', null, null);
|
||||
testIndentAction('', '\t/***/', '', null, null);
|
||||
testIndentAction('', '\t/*******/', '', null, null);
|
||||
testIndentAction('', '\t/** * * * * */', '', null, null);
|
||||
testIndentAction('', '\t/** */', '', null, null);
|
||||
testIndentAction('', '\t/** asdfg */', '', null, null);
|
||||
testIndentAction('', '\t/* asdfg */', '', null, null);
|
||||
testIndentAction('', '\t/* asdfg */', '', null, null);
|
||||
testIndentAction('', '\t/** asdfg */', '', null, null);
|
||||
testIndentAction('', '*/', '', null, null);
|
||||
testIndentAction('', '\t/*', '', null, null);
|
||||
testIndentAction('', '\t*', '', null, null);
|
||||
|
||||
testIndentAction('\t/**', '\t *', '', IndentAction.None, '* ');
|
||||
testIndentAction('\t * something', '\t *', '', IndentAction.None, '* ');
|
||||
testIndentAction('\t *', '\t *', '', IndentAction.None, '* ');
|
||||
|
||||
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', '\t * */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', '\t * * / * / * / */', '', null, null);
|
||||
|
||||
testIndentAction('\t/**', '\t * ', '', IndentAction.None, '* ');
|
||||
testIndentAction('\t * something', '\t * ', '', IndentAction.None, '* ');
|
||||
testIndentAction('\t *', '\t * ', '', IndentAction.None, '* ');
|
||||
|
||||
testIndentAction('/**', ' * ', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * something', ' * ', '', IndentAction.None, '* ');
|
||||
testIndentAction(' *', ' * asdfsfagadfg', '', IndentAction.None, '* ');
|
||||
|
||||
testIndentAction('/**', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * something', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
|
||||
testIndentAction(' *', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
|
||||
|
||||
testIndentAction('/**', ' * /*', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * something', ' * /*', '', IndentAction.None, '* ');
|
||||
testIndentAction(' *', ' * /*', '', IndentAction.None, '* ');
|
||||
|
||||
testIndentAction('/**', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * something', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
|
||||
testIndentAction(' *', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
|
||||
|
||||
testIndentAction('/**', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
|
||||
testIndentAction(' * something', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
|
||||
testIndentAction(' *', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
|
||||
|
||||
testIndentAction('', ' */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', '\t\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', ' */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', ' */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('', ' *--------------------------------------------------------------------------------------------*/', '', IndentAction.None, null, 1);
|
||||
|
||||
// issue #43469
|
||||
testIndentAction('class A {', ' * test() {', '', IndentAction.Indent, null, 0);
|
||||
testIndentAction('', ' * test() {', '', IndentAction.Indent, null, 0);
|
||||
testIndentAction(' ', ' * test() {', '', IndentAction.Indent, null, 0);
|
||||
testIndentAction('class A {', ' * test() {', '', IndentAction.Indent, null, 0);
|
||||
testIndentAction('', ' * test() {', '', IndentAction.Indent, null, 0);
|
||||
testIndentAction(' ', ' * test() {', '', IndentAction.Indent, null, 0);
|
||||
});
|
||||
});
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { BracketsUtils } from 'vs/editor/common/modes/supports/richEditBrackets';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { BracketsUtils } from 'vs/editor/common/modes/supports/richEditBrackets';
|
||||
|
||||
suite('richEditBrackets', () => {
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { strcmp, parseTokenTheme, TokenTheme, ParsedTokenThemeRule, ColorMap, ExternalThemeTrieElement, ThemeTrieElementRule } from 'vs/editor/common/modes/supports/tokenization';
|
||||
import { FontStyle } from 'vs/editor/common/modes';
|
||||
import { ColorMap, ExternalThemeTrieElement, ParsedTokenThemeRule, ThemeTrieElementRule, TokenTheme, parseTokenTheme, strcmp } from 'vs/editor/common/modes/supports/tokenization';
|
||||
|
||||
suite('Token theme matching', () => {
|
||||
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TokenizationRegistry, IState, LanguageIdentifier, ColorId, FontStyle, MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { tokenizeToString, tokenizeLineToHTML } from 'vs/editor/common/modes/textToHtmlTokenizer';
|
||||
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { ColorId, FontStyle, IState, LanguageIdentifier, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/modes';
|
||||
import { tokenizeLineToHTML, tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
|
||||
import { ViewLineToken, ViewLineTokens } from 'vs/editor/test/common/core/viewLineToken';
|
||||
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
|
||||
|
||||
suite('Editor Modes - textToHtmlTokenizer', () => {
|
||||
function toStr(pieces: { className: string; text: string }[]): string {
|
||||
@@ -19,8 +18,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
|
||||
|
||||
test('TextToHtmlTokenizer 1', () => {
|
||||
let mode = new Mode();
|
||||
let support = TokenizationRegistry.get(mode.getId());
|
||||
|
||||
let actual = tokenizeToString('.abc..def...gh', mode.getId());
|
||||
let actual = tokenizeToString('.abc..def...gh', support);
|
||||
let expected = [
|
||||
{ className: 'mtk7', text: '.' },
|
||||
{ className: 'mtk9', text: 'abc' },
|
||||
@@ -38,8 +38,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
|
||||
|
||||
test('TextToHtmlTokenizer 2', () => {
|
||||
let mode = new Mode();
|
||||
let support = TokenizationRegistry.get(mode.getId());
|
||||
|
||||
let actual = tokenizeToString('.abc..def...gh\n.abc..def...gh', mode.getId());
|
||||
let actual = tokenizeToString('.abc..def...gh\n.abc..def...gh', support);
|
||||
let expected1 = [
|
||||
{ className: 'mtk7', text: '.' },
|
||||
{ className: 'mtk9', text: 'abc' },
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { LineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { createScopedLineTokens, ScopedLineTokens } from 'vs/editor/common/modes/supports';
|
||||
import { StandardTokenType, MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { MetadataConsts, StandardTokenType } from 'vs/editor/common/modes';
|
||||
import { ScopedLineTokens, createScopedLineTokens } from 'vs/editor/common/modes/supports';
|
||||
|
||||
export interface TokenText {
|
||||
text: string;
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { EditorSimpleWorkerImpl, ICommonModel } from 'vs/editor/common/services/editorSimpleWorker';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { EditorSimpleWorkerImpl, ICommonModel } from 'vs/editor/common/services/editorSimpleWorker';
|
||||
|
||||
suite('EditorSimpleWorker', () => {
|
||||
|
||||
@@ -52,7 +51,7 @@ suite('EditorSimpleWorker', () => {
|
||||
assert.equal(actual, offset);
|
||||
}
|
||||
|
||||
test('ICommonModel#offsetAt', function () {
|
||||
test('ICommonModel#offsetAt', () => {
|
||||
assertOffsetAt(1, 1, 0);
|
||||
assertOffsetAt(1, 2, 1);
|
||||
assertOffsetAt(1, 17, 16);
|
||||
@@ -67,7 +66,7 @@ suite('EditorSimpleWorker', () => {
|
||||
assertOffsetAt(Number.MAX_VALUE, Number.MAX_VALUE, 95);
|
||||
});
|
||||
|
||||
test('ICommonModel#positionAt', function () {
|
||||
test('ICommonModel#positionAt', () => {
|
||||
assertPositionAt(0, 1, 1);
|
||||
assertPositionAt(Number.MIN_VALUE, 1, 1);
|
||||
assertPositionAt(1, 1, 2);
|
||||
@@ -86,7 +85,7 @@ suite('EditorSimpleWorker', () => {
|
||||
assert.equal(model.offsetAt({ lineNumber: 1, column: 2 }), 1);
|
||||
});
|
||||
|
||||
test('MoreMinimal', function () {
|
||||
test('MoreMinimal', () => {
|
||||
|
||||
return worker.computeMoreMinimalEdits(model.uri.toString(), [{ text: 'This is line One', range: new Range(1, 1, 1, 17) }]).then(edits => {
|
||||
assert.equal(edits.length, 1);
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { LanguagesRegistry } from 'vs/editor/common/services/languagesRegistry';
|
||||
import URI from 'vs/base/common/uri';
|
||||
|
||||
suite('LanguagesRegistry', () => {
|
||||
|
||||
|
||||
@@ -2,19 +2,20 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { createStringBuilder } from 'vs/editor/common/core/stringBuilder';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
|
||||
const GENERATE_TESTS = false;
|
||||
|
||||
@@ -26,7 +27,7 @@ suite('ModelService', () => {
|
||||
configService.setUserConfiguration('files', { 'eol': '\n' });
|
||||
configService.setUserConfiguration('files', { 'eol': '\r\n' }, URI.file(platform.isWindows ? 'c:\\myroot' : '/myroot'));
|
||||
|
||||
modelService = new ModelServiceImpl(null, configService);
|
||||
modelService = new ModelServiceImpl(null, configService, new TestTextResourcePropertiesService(configService));
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
@@ -363,3 +364,23 @@ assertComputeEdits(file1, file2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestTextResourcePropertiesService implements ITextResourcePropertiesService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
constructor(
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
) {
|
||||
}
|
||||
|
||||
getEOL(resource: URI, language?: string): string {
|
||||
const filesConfiguration = this.configurationService.getValue<{ eol: string }>('files', { overrideIdentifier: language, resource });
|
||||
if (filesConfiguration && filesConfiguration.eol) {
|
||||
if (filesConfiguration.eol !== 'auto') {
|
||||
return filesConfiguration.eol;
|
||||
}
|
||||
}
|
||||
return (platform.isLinux || platform.isMacintosh) ? '\n' : '\r\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { KeyCode as StandaloneKeyCode, Severity as StandaloneSeverity } from 'vs/editor/common/standalone/standaloneBase';
|
||||
import { KeyCode as RuntimeKeyCode } from 'vs/base/common/keyCodes';
|
||||
import RuntimeSeverity from 'vs/base/common/severity';
|
||||
|
||||
suite('StandaloneBase', () => {
|
||||
test('exports enums correctly', () => {
|
||||
assert.equal(StandaloneSeverity.Ignore, RuntimeSeverity.Ignore);
|
||||
assert.equal(StandaloneSeverity.Info, RuntimeSeverity.Info);
|
||||
assert.equal(StandaloneSeverity.Warning, RuntimeSeverity.Warning);
|
||||
assert.equal(StandaloneSeverity.Error, RuntimeSeverity.Error);
|
||||
});
|
||||
});
|
||||
|
||||
suite('KeyCode', () => {
|
||||
test('is exported correctly in standalone editor', () => {
|
||||
|
||||
function assertKeyCode(standalone: StandaloneKeyCode, runtime: RuntimeKeyCode): void {
|
||||
assert.equal(standalone, runtime);
|
||||
}
|
||||
|
||||
assertKeyCode(StandaloneKeyCode.Unknown, RuntimeKeyCode.Unknown);
|
||||
assertKeyCode(StandaloneKeyCode.Backspace, RuntimeKeyCode.Backspace);
|
||||
assertKeyCode(StandaloneKeyCode.Tab, RuntimeKeyCode.Tab);
|
||||
assertKeyCode(StandaloneKeyCode.Enter, RuntimeKeyCode.Enter);
|
||||
assertKeyCode(StandaloneKeyCode.Shift, RuntimeKeyCode.Shift);
|
||||
assertKeyCode(StandaloneKeyCode.Ctrl, RuntimeKeyCode.Ctrl);
|
||||
assertKeyCode(StandaloneKeyCode.Alt, RuntimeKeyCode.Alt);
|
||||
assertKeyCode(StandaloneKeyCode.PauseBreak, RuntimeKeyCode.PauseBreak);
|
||||
assertKeyCode(StandaloneKeyCode.CapsLock, RuntimeKeyCode.CapsLock);
|
||||
assertKeyCode(StandaloneKeyCode.Escape, RuntimeKeyCode.Escape);
|
||||
assertKeyCode(StandaloneKeyCode.Space, RuntimeKeyCode.Space);
|
||||
assertKeyCode(StandaloneKeyCode.PageUp, RuntimeKeyCode.PageUp);
|
||||
assertKeyCode(StandaloneKeyCode.PageDown, RuntimeKeyCode.PageDown);
|
||||
assertKeyCode(StandaloneKeyCode.End, RuntimeKeyCode.End);
|
||||
assertKeyCode(StandaloneKeyCode.Home, RuntimeKeyCode.Home);
|
||||
assertKeyCode(StandaloneKeyCode.LeftArrow, RuntimeKeyCode.LeftArrow);
|
||||
assertKeyCode(StandaloneKeyCode.UpArrow, RuntimeKeyCode.UpArrow);
|
||||
assertKeyCode(StandaloneKeyCode.RightArrow, RuntimeKeyCode.RightArrow);
|
||||
assertKeyCode(StandaloneKeyCode.DownArrow, RuntimeKeyCode.DownArrow);
|
||||
assertKeyCode(StandaloneKeyCode.Insert, RuntimeKeyCode.Insert);
|
||||
assertKeyCode(StandaloneKeyCode.Delete, RuntimeKeyCode.Delete);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_0, RuntimeKeyCode.KEY_0);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_1, RuntimeKeyCode.KEY_1);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_2, RuntimeKeyCode.KEY_2);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_3, RuntimeKeyCode.KEY_3);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_4, RuntimeKeyCode.KEY_4);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_5, RuntimeKeyCode.KEY_5);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_6, RuntimeKeyCode.KEY_6);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_7, RuntimeKeyCode.KEY_7);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_8, RuntimeKeyCode.KEY_8);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_9, RuntimeKeyCode.KEY_9);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_A, RuntimeKeyCode.KEY_A);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_B, RuntimeKeyCode.KEY_B);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_C, RuntimeKeyCode.KEY_C);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_D, RuntimeKeyCode.KEY_D);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_E, RuntimeKeyCode.KEY_E);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_F, RuntimeKeyCode.KEY_F);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_G, RuntimeKeyCode.KEY_G);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_H, RuntimeKeyCode.KEY_H);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_I, RuntimeKeyCode.KEY_I);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_J, RuntimeKeyCode.KEY_J);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_K, RuntimeKeyCode.KEY_K);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_L, RuntimeKeyCode.KEY_L);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_M, RuntimeKeyCode.KEY_M);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_N, RuntimeKeyCode.KEY_N);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_O, RuntimeKeyCode.KEY_O);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_P, RuntimeKeyCode.KEY_P);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_Q, RuntimeKeyCode.KEY_Q);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_R, RuntimeKeyCode.KEY_R);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_S, RuntimeKeyCode.KEY_S);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_T, RuntimeKeyCode.KEY_T);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_U, RuntimeKeyCode.KEY_U);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_V, RuntimeKeyCode.KEY_V);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_W, RuntimeKeyCode.KEY_W);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_X, RuntimeKeyCode.KEY_X);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_Y, RuntimeKeyCode.KEY_Y);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_Z, RuntimeKeyCode.KEY_Z);
|
||||
assertKeyCode(StandaloneKeyCode.Meta, RuntimeKeyCode.Meta);
|
||||
assertKeyCode(StandaloneKeyCode.ContextMenu, RuntimeKeyCode.ContextMenu);
|
||||
assertKeyCode(StandaloneKeyCode.F1, RuntimeKeyCode.F1);
|
||||
assertKeyCode(StandaloneKeyCode.F2, RuntimeKeyCode.F2);
|
||||
assertKeyCode(StandaloneKeyCode.F3, RuntimeKeyCode.F3);
|
||||
assertKeyCode(StandaloneKeyCode.F4, RuntimeKeyCode.F4);
|
||||
assertKeyCode(StandaloneKeyCode.F5, RuntimeKeyCode.F5);
|
||||
assertKeyCode(StandaloneKeyCode.F6, RuntimeKeyCode.F6);
|
||||
assertKeyCode(StandaloneKeyCode.F7, RuntimeKeyCode.F7);
|
||||
assertKeyCode(StandaloneKeyCode.F8, RuntimeKeyCode.F8);
|
||||
assertKeyCode(StandaloneKeyCode.F9, RuntimeKeyCode.F9);
|
||||
assertKeyCode(StandaloneKeyCode.F10, RuntimeKeyCode.F10);
|
||||
assertKeyCode(StandaloneKeyCode.F11, RuntimeKeyCode.F11);
|
||||
assertKeyCode(StandaloneKeyCode.F12, RuntimeKeyCode.F12);
|
||||
assertKeyCode(StandaloneKeyCode.F13, RuntimeKeyCode.F13);
|
||||
assertKeyCode(StandaloneKeyCode.F14, RuntimeKeyCode.F14);
|
||||
assertKeyCode(StandaloneKeyCode.F15, RuntimeKeyCode.F15);
|
||||
assertKeyCode(StandaloneKeyCode.F16, RuntimeKeyCode.F16);
|
||||
assertKeyCode(StandaloneKeyCode.F17, RuntimeKeyCode.F17);
|
||||
assertKeyCode(StandaloneKeyCode.F18, RuntimeKeyCode.F18);
|
||||
assertKeyCode(StandaloneKeyCode.F19, RuntimeKeyCode.F19);
|
||||
assertKeyCode(StandaloneKeyCode.NumLock, RuntimeKeyCode.NumLock);
|
||||
assertKeyCode(StandaloneKeyCode.ScrollLock, RuntimeKeyCode.ScrollLock);
|
||||
assertKeyCode(StandaloneKeyCode.US_SEMICOLON, RuntimeKeyCode.US_SEMICOLON);
|
||||
assertKeyCode(StandaloneKeyCode.US_EQUAL, RuntimeKeyCode.US_EQUAL);
|
||||
assertKeyCode(StandaloneKeyCode.US_COMMA, RuntimeKeyCode.US_COMMA);
|
||||
assertKeyCode(StandaloneKeyCode.US_MINUS, RuntimeKeyCode.US_MINUS);
|
||||
assertKeyCode(StandaloneKeyCode.US_DOT, RuntimeKeyCode.US_DOT);
|
||||
assertKeyCode(StandaloneKeyCode.US_SLASH, RuntimeKeyCode.US_SLASH);
|
||||
assertKeyCode(StandaloneKeyCode.US_BACKTICK, RuntimeKeyCode.US_BACKTICK);
|
||||
assertKeyCode(StandaloneKeyCode.US_OPEN_SQUARE_BRACKET, RuntimeKeyCode.US_OPEN_SQUARE_BRACKET);
|
||||
assertKeyCode(StandaloneKeyCode.US_BACKSLASH, RuntimeKeyCode.US_BACKSLASH);
|
||||
assertKeyCode(StandaloneKeyCode.US_CLOSE_SQUARE_BRACKET, RuntimeKeyCode.US_CLOSE_SQUARE_BRACKET);
|
||||
assertKeyCode(StandaloneKeyCode.US_QUOTE, RuntimeKeyCode.US_QUOTE);
|
||||
assertKeyCode(StandaloneKeyCode.OEM_8, RuntimeKeyCode.OEM_8);
|
||||
assertKeyCode(StandaloneKeyCode.OEM_102, RuntimeKeyCode.OEM_102);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_0, RuntimeKeyCode.NUMPAD_0);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_1, RuntimeKeyCode.NUMPAD_1);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_2, RuntimeKeyCode.NUMPAD_2);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_3, RuntimeKeyCode.NUMPAD_3);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_4, RuntimeKeyCode.NUMPAD_4);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_5, RuntimeKeyCode.NUMPAD_5);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_6, RuntimeKeyCode.NUMPAD_6);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_7, RuntimeKeyCode.NUMPAD_7);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_8, RuntimeKeyCode.NUMPAD_8);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_9, RuntimeKeyCode.NUMPAD_9);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_MULTIPLY, RuntimeKeyCode.NUMPAD_MULTIPLY);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_ADD, RuntimeKeyCode.NUMPAD_ADD);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_SEPARATOR, RuntimeKeyCode.NUMPAD_SEPARATOR);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_SUBTRACT, RuntimeKeyCode.NUMPAD_SUBTRACT);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_DECIMAL, RuntimeKeyCode.NUMPAD_DECIMAL);
|
||||
assertKeyCode(StandaloneKeyCode.NUMPAD_DIVIDE, RuntimeKeyCode.NUMPAD_DIVIDE);
|
||||
assertKeyCode(StandaloneKeyCode.KEY_IN_COMPOSITION, RuntimeKeyCode.KEY_IN_COMPOSITION);
|
||||
assertKeyCode(StandaloneKeyCode.ABNT_C1, RuntimeKeyCode.ABNT_C1);
|
||||
assertKeyCode(StandaloneKeyCode.ABNT_C2, RuntimeKeyCode.ABNT_C2);
|
||||
assertKeyCode(StandaloneKeyCode.MAX_VALUE, RuntimeKeyCode.MAX_VALUE);
|
||||
});
|
||||
});
|
||||
@@ -2,13 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Constants } from 'vs/editor/common/view/minimapCharRenderer';
|
||||
import { MinimapCharRendererFactory } from 'vs/editor/test/common/view/minimapCharRendererFactory';
|
||||
import { getOrCreateMinimapCharRenderer } from 'vs/editor/common/view/runtimeMinimapCharRenderer';
|
||||
import { RGBA8 } from 'vs/editor/common/core/rgba';
|
||||
import { Constants } from 'vs/editor/common/view/minimapCharRenderer';
|
||||
import { getOrCreateMinimapCharRenderer } from 'vs/editor/common/view/runtimeMinimapCharRenderer';
|
||||
import { MinimapCharRendererFactory } from 'vs/editor/test/common/view/minimapCharRendererFactory';
|
||||
|
||||
suite('MinimapCharRenderer', () => {
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { Constants, MinimapCharRenderer } from 'vs/editor/common/view/minimapCharRenderer';
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { OverviewZoneManager, ColorZone, OverviewRulerZone } from 'vs/editor/common/view/overviewZoneManager';
|
||||
import { ColorZone, OverviewRulerZone, OverviewZoneManager } from 'vs/editor/common/view/overviewZoneManager';
|
||||
|
||||
suite('Editor View - OverviewZoneManager', () => {
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { RenderMinimap, EditorLayoutInfo, EditorLayoutProvider, IEditorLayoutProviderOpts } from 'vs/editor/common/config/editorOptions';
|
||||
import { EditorLayoutInfo, EditorLayoutProvider, IEditorLayoutProviderOpts, RenderMinimap } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
suite('Editor ViewLayout - EditorLayoutProvider', () => {
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { DecorationSegment, LineDecorationsNormalizer, LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { DecorationSegment, LineDecoration, LineDecorationsNormalizer } from 'vs/editor/common/viewLayout/lineDecorations';
|
||||
import { InlineDecoration, InlineDecorationType } from 'vs/editor/common/viewModel/viewModel';
|
||||
|
||||
suite('Editor ViewLayout - ViewLineParts', () => {
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { LinesLayout } from 'vs/editor/common/viewLayout/linesLayout';
|
||||
|
||||
|
||||
@@ -2,17 +2,16 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { renderViewLine2 as renderViewLine, RenderLineInput, CharacterMapping } from 'vs/editor/common/viewLayout/viewLineRenderer';
|
||||
import { ViewLineToken, ViewLineTokens } from 'vs/editor/test/common/core/viewLineToken';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
|
||||
import { CharacterMapping, RenderLineInput, renderViewLine2 as renderViewLine } from 'vs/editor/common/viewLayout/viewLineRenderer';
|
||||
import { InlineDecorationType } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ViewLineToken, ViewLineTokens } from 'vs/editor/test/common/core/viewLineToken';
|
||||
|
||||
function createViewLineTokens(viewLineTokens: ViewLineToken[]): IViewLineTokens {
|
||||
return new ViewLineTokens(viewLineTokens);
|
||||
@@ -29,6 +28,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
function assertCharacterReplacement(lineContent: string, tabSize: number, expected: string, expectedCharOffsetInPart: number[][], expectedPartLengts: number[]): void {
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
strings.isBasicASCII(lineContent),
|
||||
@@ -77,6 +77,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
function assertParts(lineContent: string, tabSize: number, parts: ViewLineToken[], expected: string, expectedCharOffsetInPart: number[][], expectedPartLengts: number[]): void {
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
true,
|
||||
@@ -115,6 +116,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
test('overflow', () => {
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
'Hello world!',
|
||||
false,
|
||||
true,
|
||||
@@ -218,6 +220,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
true,
|
||||
@@ -279,6 +282,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
true,
|
||||
@@ -340,6 +344,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
true,
|
||||
@@ -378,6 +383,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
false,
|
||||
@@ -407,6 +413,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
let lineParts = createViewLineTokens([createPart(lineText.length, 1)]);
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
true,
|
||||
@@ -506,6 +513,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
let lineParts = createViewLineTokens([createPart(lineText.length, 1)]);
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
true,
|
||||
@@ -529,7 +537,9 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
'101 chars',
|
||||
_lineText.substr(0, 101),
|
||||
[
|
||||
'<span class="mtk1">This\u00a0is\u00a0just\u00a0a\u00a0long\u00a0line\u00a0that\u00a0contains\u00a0very\u00a0interesting\u00a0text.\u00a0This\u00a0is\u00a0just\u00a0a\u00a0long\u00a0line\u00a0that\u00a0contains\u00a0</span>',
|
||||
'<span class="mtk1">This\u00a0is\u00a0just\u00a0a\u00a0long\u00a0line\u00a0that\u00a0contains\u00a0very\u00a0</span>',
|
||||
'<span class="mtk1">interesting\u00a0text.\u00a0This\u00a0is\u00a0just\u00a0a\u00a0long\u00a0line\u00a0that\u00a0</span>',
|
||||
'<span class="mtk1">contains\u00a0</span>',
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -541,6 +551,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
let lineParts = createViewLineTokens([createPart(lineText.length, 1)]);
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
false,
|
||||
@@ -569,6 +580,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
];
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
false,
|
||||
@@ -613,6 +625,7 @@ suite('viewLineRenderer.renderLine', () => {
|
||||
].join('');
|
||||
|
||||
let _actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
lineText,
|
||||
false,
|
||||
@@ -696,6 +709,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
function testCreateLineParts(fontIsMonospace: boolean, lineContent: string, tokens: ViewLineToken[], fauxIndentLength: number, renderWhitespace: 'none' | 'boundary' | 'all', expected: string): void {
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
fontIsMonospace,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
true,
|
||||
@@ -720,6 +734,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
true,
|
||||
@@ -749,6 +764,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
let lineContent = '\'let url = `http://***/_api/web/lists/GetByTitle(\\\'Teambuildingaanvragen\\\')/items`;\'';
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
@@ -1016,6 +1032,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('createLineParts can handle unsorted inline decorations', () => {
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
'Hello world',
|
||||
false,
|
||||
true,
|
||||
@@ -1059,6 +1076,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
true,
|
||||
@@ -1090,6 +1108,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
true,
|
||||
@@ -1122,6 +1141,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
true,
|
||||
@@ -1149,6 +1169,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('issue #37208: Collapsing bullet point containing emoji in Markdown document results in [??] character', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
' 1. 🙏',
|
||||
false,
|
||||
@@ -1178,6 +1199,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('issue #37401: Allow both before and after decorations on empty line', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
@@ -1209,6 +1231,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('issue #38935: GitLens end-of-line blame no longer rendering', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
'\t}',
|
||||
false,
|
||||
@@ -1241,6 +1264,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('issue #22832: Consider fullwidth characters when rendering tabs', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
'asd = "擦"\t\t#asd',
|
||||
false,
|
||||
@@ -1269,6 +1293,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('issue #22832: Consider fullwidth characters when rendering tabs (render whitespace)', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
'asd = "擦"\t\t#asd',
|
||||
false,
|
||||
@@ -1303,6 +1328,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('issue #22352: COMBINING ACUTE ACCENT (U+0301)', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
'12345689012345678901234568901234567890123456890abába',
|
||||
false,
|
||||
@@ -1331,6 +1357,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
test('issue #22352: Partially Broken Complex Script Rendering of Tamil', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
' JoyShareல் பின்தொடர்ந்து, விடீயோ, ஜோக்குகள், அனிமேசன், நகைச்சுவை படங்கள் மற்றும் செய்திகளை பெறுவீர்',
|
||||
false,
|
||||
@@ -1349,20 +1376,19 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
|
||||
let expected = [
|
||||
'<span>',
|
||||
'<span class="mtk3">\u00a0JoyShareல்\u00a0பின்தொடர்ந்து,\u00a0விடீயோ,\u00a0ஜோக்குகள்,\u00a0அனிமேசன்,\u00a0நகைச்சுவை\u00a0படங்கள்\u00a0மற்றும்\u00a0செய்திகளை\u00a0பெறுவீர்</span>',
|
||||
'<span class="mtk3">\u00a0JoyShareல்\u00a0பின்தொடர்ந்து,\u00a0விடீயோ,\u00a0ஜோக்குகள்,\u00a0</span>',
|
||||
'<span class="mtk3">அனிமேசன்,\u00a0நகைச்சுவை\u00a0படங்கள்\u00a0மற்றும்\u00a0செய்திகளை\u00a0</span>',
|
||||
'<span class="mtk3">பெறுவீர்</span>',
|
||||
'</span>'
|
||||
].join('');
|
||||
|
||||
let _expected = expected.split('').map(c => c.charCodeAt(0));
|
||||
let _actual = actual.html.split('').map(c => c.charCodeAt(0));
|
||||
assert.deepEqual(_actual, _expected);
|
||||
|
||||
assert.deepEqual(actual.html, expected);
|
||||
});
|
||||
|
||||
test('issue #42700: Hindi characters are not being rendered properly', () => {
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
' वो ऐसा क्या है जो हमारे अंदर भी है और बाहर भी है। जिसकी वजह से हम सब हैं। जिसने इस सृष्टि की रचना की है।',
|
||||
false,
|
||||
@@ -1381,7 +1407,9 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
|
||||
let expected = [
|
||||
'<span>',
|
||||
'<span class="mtk3">\u00a0वो\u00a0ऐसा\u00a0क्या\u00a0है\u00a0जो\u00a0हमारे\u00a0अंदर\u00a0भी\u00a0है\u00a0और\u00a0बाहर\u00a0भी\u00a0है।\u00a0जिसकी\u00a0वजह\u00a0से\u00a0हम\u00a0सब\u00a0हैं।\u00a0जिसने\u00a0इस\u00a0सृष्टि\u00a0की\u00a0रचना\u00a0की\u00a0है।</span>',
|
||||
'<span class="mtk3">\u00a0वो\u00a0ऐसा\u00a0क्या\u00a0है\u00a0जो\u00a0हमारे\u00a0अंदर\u00a0भी\u00a0है\u00a0और\u00a0बाहर\u00a0भी\u00a0है।\u00a0</span>',
|
||||
'<span class="mtk3">जिसकी\u00a0वजह\u00a0से\u00a0हम\u00a0सब\u00a0हैं।\u00a0जिसने\u00a0इस\u00a0सृष्टि\u00a0की\u00a0रचना\u00a0की\u00a0</span>',
|
||||
'<span class="mtk3">है।</span>',
|
||||
'</span>'
|
||||
].join('');
|
||||
|
||||
@@ -1390,6 +1418,7 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
|
||||
test('issue #38123: editor.renderWhitespace: "boundary" renders whitespace at line wrap point when line is wrapped', () => {
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
true,
|
||||
'This is a long line which never uses more than two spaces. ',
|
||||
true,
|
||||
@@ -1415,9 +1444,70 @@ suite('viewLineRenderer.renderLine 2', () => {
|
||||
assert.deepEqual(actual.html, expected);
|
||||
});
|
||||
|
||||
test('issue #33525: Long line with ligatures takes a long time to paint decorations', () => {
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
false,
|
||||
'append data to append data to append data to append data to append data to append data to append data to append data to append data to append data to append data to append data to append data to',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
0,
|
||||
createViewLineTokens([createPart(194, 3)]),
|
||||
[],
|
||||
4,
|
||||
10,
|
||||
10000,
|
||||
'none',
|
||||
false,
|
||||
true
|
||||
));
|
||||
|
||||
let expected = [
|
||||
'<span>',
|
||||
'<span class="mtk3">append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0</span>',
|
||||
'<span class="mtk3">append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0</span>',
|
||||
'<span class="mtk3">append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0</span>',
|
||||
'<span class="mtk3">append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0append\u00a0data\u00a0to\u00a0</span>',
|
||||
'<span class="mtk3">append\u00a0data\u00a0to</span>',
|
||||
'</span>'
|
||||
].join('');
|
||||
|
||||
assert.deepEqual(actual.html, expected);
|
||||
});
|
||||
|
||||
test('issue #33525: Long line with ligatures takes a long time to paint decorations - not possible', () => {
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
false,
|
||||
'appenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatato',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
0,
|
||||
createViewLineTokens([createPart(194, 3)]),
|
||||
[],
|
||||
4,
|
||||
10,
|
||||
10000,
|
||||
'none',
|
||||
false,
|
||||
true
|
||||
));
|
||||
|
||||
let expected = [
|
||||
'<span>',
|
||||
'<span class="mtk3">appenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatato</span>',
|
||||
'</span>'
|
||||
].join('');
|
||||
|
||||
assert.deepEqual(actual.html, expected);
|
||||
});
|
||||
|
||||
function createTestGetColumnOfLinePartOffset(lineContent: string, tabSize: number, parts: ViewLineToken[], expectedPartLengths: number[]): (partIndex: number, partLength: number, offset: number, expected: number) => void {
|
||||
let renderLineOutput = renderViewLine(new RenderLineInput(
|
||||
false,
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
true,
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { WhitespaceComputer } from 'vs/editor/common/viewLayout/whitespaceComputer';
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { WrappingIndent } from 'vs/editor/common/config/editorOptions';
|
||||
import { CharacterHardWrappingLineMapperFactory } from 'vs/editor/common/viewModel/characterHardWrappingLineMapper';
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { PrefixSumComputer, PrefixSumIndexOfResult } from 'vs/editor/common/viewModel/prefixSumComputer';
|
||||
import { toUint32Array } from 'vs/editor/common/core/uint';
|
||||
import { PrefixSumComputer, PrefixSumIndexOfResult } from 'vs/editor/common/viewModel/prefixSumComputer';
|
||||
|
||||
suite('Editor ViewModel - PrefixSumComputer', () => {
|
||||
|
||||
|
||||
@@ -2,24 +2,23 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { CharacterHardWrappingLineMapping, CharacterHardWrappingLineMapperFactory } from 'vs/editor/common/viewModel/characterHardWrappingLineMapper';
|
||||
import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer';
|
||||
import { ILineMapping, SplitLine, SplitLinesCollection, ISimpleModel } from 'vs/editor/common/viewModel/splitLinesCollection';
|
||||
import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { IRange, Range } from 'vs/editor/common/core/range';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { toUint32Array } from 'vs/editor/common/core/uint';
|
||||
import { EndOfLinePreference } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
|
||||
import { TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { CharacterHardWrappingLineMapperFactory, CharacterHardWrappingLineMapping } from 'vs/editor/common/viewModel/characterHardWrappingLineMapper';
|
||||
import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer';
|
||||
import { ILineMapping, ISimpleModel, SplitLine, SplitLinesCollection } from 'vs/editor/common/viewModel/splitLinesCollection';
|
||||
import { ViewLineData } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { Range, IRange } from 'vs/editor/common/core/range';
|
||||
import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { EndOfLinePreference } from 'vs/editor/common/model';
|
||||
import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration';
|
||||
|
||||
suite('Editor ViewModel - SplitLinesCollection', () => {
|
||||
test('SplitLine', () => {
|
||||
@@ -323,8 +322,8 @@ suite('SplitLinesCollection', () => {
|
||||
]
|
||||
];
|
||||
|
||||
let model: TextModel = null;
|
||||
let languageRegistration: IDisposable = null;
|
||||
let model: TextModel | null = null;
|
||||
let languageRegistration: IDisposable | null = null;
|
||||
|
||||
setup(() => {
|
||||
let _lineIndex = 0;
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration';
|
||||
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';
|
||||
import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration';
|
||||
|
||||
export function testViewModel(text: string[], options: IEditorOptions, callback: (viewModel: ViewModel, model: TextModel) => void): void {
|
||||
const EDITOR_ID = 1;
|
||||
@@ -16,7 +15,7 @@ export function testViewModel(text: string[], options: IEditorOptions, callback:
|
||||
|
||||
let model = TextModel.createFromString(text.join('\n'));
|
||||
|
||||
let viewModel = new ViewModel(EDITOR_ID, configuration, model, null);
|
||||
let viewModel = new ViewModel(EDITOR_ID, configuration, model, null!);
|
||||
|
||||
callback(viewModel, model);
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { testViewModel } from 'vs/editor/test/common/viewModel/testViewModel';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { InlineDecorationType } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { testViewModel } from 'vs/editor/test/common/viewModel/testViewModel';
|
||||
|
||||
suite('ViewModelDecorations', () => {
|
||||
test('getDecorationsViewportData', () => {
|
||||
@@ -81,6 +80,7 @@ suite('ViewModelDecorations', () => {
|
||||
});
|
||||
|
||||
assert.deepEqual(actualDecorations, [
|
||||
'dec1',
|
||||
'dec2',
|
||||
'dec3',
|
||||
'dec4',
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { testViewModel } from 'vs/editor/test/common/viewModel/testViewModel';
|
||||
import { EndOfLineSequence } from 'vs/editor/common/model';
|
||||
import { testViewModel } from 'vs/editor/test/common/viewModel/testViewModel';
|
||||
|
||||
suite('ViewModel', () => {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user