model.test.ts 17.8 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
A
Alex Dima 已提交
5

A
Alex Dima 已提交
6
import * as assert from 'assert';
A
Alex Dima 已提交
7
import { Disposable, dispose } from 'vs/base/common/lifecycle';
J
Johannes Rieken 已提交
8 9 10
import { EditOperation } from 'vs/editor/common/core/editOperation';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
A
Alex Dima 已提交
11
import { TokenizationResult2 } from 'vs/editor/common/core/token';
A
Alex Dima 已提交
12
import { TextModel } from 'vs/editor/common/model/textModel';
A
Alex Dima 已提交
13 14
import { ModelRawContentChangedEvent, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from 'vs/editor/common/model/textModelEvents';
import { IState, LanguageIdentifier, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/modes';
M
Matt Bierner 已提交
15 16
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
A
Alex Dima 已提交
17
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
18
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
E
Erich Gamma 已提交
19 20 21

// --------- utils

A
Alex Dima 已提交
22 23 24 25 26
const LINE1 = 'My First Line';
const LINE2 = '\t\tMy Second Line';
const LINE3 = '    Third Line';
const LINE4 = '';
const LINE5 = '1';
E
Erich Gamma 已提交
27 28 29

suite('Editor Model - Model', () => {

A
Alex Dima 已提交
30
	let thisModel: TextModel;
E
Erich Gamma 已提交
31 32

	setup(() => {
A
Alex Dima 已提交
33
		const text =
E
Erich Gamma 已提交
34 35 36 37 38
			LINE1 + '\r\n' +
			LINE2 + '\n' +
			LINE3 + '\n' +
			LINE4 + '\r\n' +
			LINE5;
39
		thisModel = createTextModel(text);
E
Erich Gamma 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
	});

	teardown(() => {
		thisModel.dispose();
	});

	// --------- insert text

	test('model getValue', () => {
		assert.equal(thisModel.getValue(), 'My First Line\n\t\tMy Second Line\n    Third Line\n\n1');
	});

	test('model insert empty text', () => {
		thisModel.applyEdits([EditOperation.insert(new Position(1, 1), '')]);
		assert.equal(thisModel.getLineCount(), 5);
		assert.equal(thisModel.getLineContent(1), 'My First Line');
	});

	test('model insert text without newline 1', () => {
		thisModel.applyEdits([EditOperation.insert(new Position(1, 1), 'foo ')]);
		assert.equal(thisModel.getLineCount(), 5);
		assert.equal(thisModel.getLineContent(1), 'foo My First Line');
	});

	test('model insert text without newline 2', () => {
		thisModel.applyEdits([EditOperation.insert(new Position(1, 3), ' foo')]);
		assert.equal(thisModel.getLineCount(), 5);
		assert.equal(thisModel.getLineContent(1), 'My foo First Line');
	});

	test('model insert text with one newline', () => {
		thisModel.applyEdits([EditOperation.insert(new Position(1, 3), ' new line\nNo longer')]);
		assert.equal(thisModel.getLineCount(), 6);
		assert.equal(thisModel.getLineContent(1), 'My new line');
		assert.equal(thisModel.getLineContent(2), 'No longer First Line');
	});

	test('model insert text with two newlines', () => {
		thisModel.applyEdits([EditOperation.insert(new Position(1, 3), ' new line\nOne more line in the middle\nNo longer')]);
		assert.equal(thisModel.getLineCount(), 7);
		assert.equal(thisModel.getLineContent(1), 'My new line');
		assert.equal(thisModel.getLineContent(2), 'One more line in the middle');
		assert.equal(thisModel.getLineContent(3), 'No longer First Line');
	});

	test('model insert text with many newlines', () => {
		thisModel.applyEdits([EditOperation.insert(new Position(1, 3), '\n\n\n\n')]);
		assert.equal(thisModel.getLineCount(), 9);
		assert.equal(thisModel.getLineContent(1), 'My');
		assert.equal(thisModel.getLineContent(2), '');
		assert.equal(thisModel.getLineContent(3), '');
		assert.equal(thisModel.getLineContent(4), '');
		assert.equal(thisModel.getLineContent(5), ' First Line');
	});


	// --------- insert text eventing

	test('model insert empty text does not trigger eventing', () => {
A
Alex Dima 已提交
99
		thisModel.onDidChangeRawContent((e) => {
E
Erich Gamma 已提交
100 101 102 103 104 105
			assert.ok(false, 'was not expecting event');
		});
		thisModel.applyEdits([EditOperation.insert(new Position(1, 1), '')]);
	});

	test('model insert text without newline eventing', () => {
106
		let e: ModelRawContentChangedEvent | null = null;
107 108
		thisModel.onDidChangeRawContent((_e) => {
			if (e !== null) {
109
				assert.fail('Unexpected assertion error');
110 111
			}
			e = _e;
E
Erich Gamma 已提交
112 113
		});
		thisModel.applyEdits([EditOperation.insert(new Position(1, 1), 'foo ')]);
114 115 116 117 118 119 120 121
		assert.deepEqual(e, new ModelRawContentChangedEvent(
			[
				new ModelRawLineChanged(1, 'foo My First Line')
			],
			2,
			false,
			false
		));
E
Erich Gamma 已提交
122 123 124
	});

	test('model insert text with one newline eventing', () => {
125
		let e: ModelRawContentChangedEvent | null = null;
126 127
		thisModel.onDidChangeRawContent((_e) => {
			if (e !== null) {
128
				assert.fail('Unexpected assertion error');
E
Erich Gamma 已提交
129
			}
130
			e = _e;
E
Erich Gamma 已提交
131 132
		});
		thisModel.applyEdits([EditOperation.insert(new Position(1, 3), ' new line\nNo longer')]);
133 134 135
		assert.deepEqual(e, new ModelRawContentChangedEvent(
			[
				new ModelRawLineChanged(1, 'My new line'),
A
Alex Dima 已提交
136
				new ModelRawLinesInserted(2, 2, ['No longer First Line']),
137 138 139 140 141
			],
			2,
			false,
			false
		));
E
Erich Gamma 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
	});


	// --------- delete text

	test('model delete empty text', () => {
		thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 1))]);
		assert.equal(thisModel.getLineCount(), 5);
		assert.equal(thisModel.getLineContent(1), 'My First Line');
	});

	test('model delete text from one line', () => {
		thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 2))]);
		assert.equal(thisModel.getLineCount(), 5);
		assert.equal(thisModel.getLineContent(1), 'y First Line');
	});

	test('model delete text from one line 2', () => {
		thisModel.applyEdits([EditOperation.insert(new Position(1, 1), 'a')]);
		assert.equal(thisModel.getLineContent(1), 'aMy First Line');

		thisModel.applyEdits([EditOperation.delete(new Range(1, 2, 1, 4))]);
		assert.equal(thisModel.getLineCount(), 5);
		assert.equal(thisModel.getLineContent(1), 'a First Line');
	});

	test('model delete all text from a line', () => {
		thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 14))]);
		assert.equal(thisModel.getLineCount(), 5);
		assert.equal(thisModel.getLineContent(1), '');
	});

	test('model delete text from two lines', () => {
		thisModel.applyEdits([EditOperation.delete(new Range(1, 4, 2, 6))]);
		assert.equal(thisModel.getLineCount(), 4);
		assert.equal(thisModel.getLineContent(1), 'My Second Line');
	});

	test('model delete text from many lines', () => {
		thisModel.applyEdits([EditOperation.delete(new Range(1, 4, 3, 5))]);
		assert.equal(thisModel.getLineCount(), 3);
		assert.equal(thisModel.getLineContent(1), 'My Third Line');
	});

	test('model delete everything', () => {
		thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 5, 2))]);
		assert.equal(thisModel.getLineCount(), 1);
		assert.equal(thisModel.getLineContent(1), '');
	});

	// --------- delete text eventing

	test('model delete empty text does not trigger eventing', () => {
A
Alex Dima 已提交
195
		thisModel.onDidChangeRawContent((e) => {
E
Erich Gamma 已提交
196 197 198 199 200 201
			assert.ok(false, 'was not expecting event');
		});
		thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 1))]);
	});

	test('model delete text from one line eventing', () => {
202
		let e: ModelRawContentChangedEvent | null = null;
203 204
		thisModel.onDidChangeRawContent((_e) => {
			if (e !== null) {
205
				assert.fail('Unexpected assertion error');
206 207
			}
			e = _e;
E
Erich Gamma 已提交
208 209
		});
		thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 2))]);
210 211 212 213 214 215 216 217
		assert.deepEqual(e, new ModelRawContentChangedEvent(
			[
				new ModelRawLineChanged(1, 'y First Line'),
			],
			2,
			false,
			false
		));
E
Erich Gamma 已提交
218 219 220
	});

	test('model delete all text from a line eventing', () => {
221
		let e: ModelRawContentChangedEvent | null = null;
222 223
		thisModel.onDidChangeRawContent((_e) => {
			if (e !== null) {
224
				assert.fail('Unexpected assertion error');
225 226
			}
			e = _e;
E
Erich Gamma 已提交
227 228
		});
		thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 14))]);
229 230 231 232 233 234 235 236
		assert.deepEqual(e, new ModelRawContentChangedEvent(
			[
				new ModelRawLineChanged(1, ''),
			],
			2,
			false,
			false
		));
E
Erich Gamma 已提交
237 238 239
	});

	test('model delete text from two lines eventing', () => {
240
		let e: ModelRawContentChangedEvent | null = null;
241 242
		thisModel.onDidChangeRawContent((_e) => {
			if (e !== null) {
243
				assert.fail('Unexpected assertion error');
E
Erich Gamma 已提交
244
			}
245
			e = _e;
E
Erich Gamma 已提交
246 247
		});
		thisModel.applyEdits([EditOperation.delete(new Range(1, 4, 2, 6))]);
248 249 250 251 252 253 254 255 256
		assert.deepEqual(e, new ModelRawContentChangedEvent(
			[
				new ModelRawLineChanged(1, 'My Second Line'),
				new ModelRawLinesDeleted(2, 2),
			],
			2,
			false,
			false
		));
E
Erich Gamma 已提交
257 258 259
	});

	test('model delete text from many lines eventing', () => {
260
		let e: ModelRawContentChangedEvent | null = null;
261 262
		thisModel.onDidChangeRawContent((_e) => {
			if (e !== null) {
263
				assert.fail('Unexpected assertion error');
E
Erich Gamma 已提交
264
			}
265
			e = _e;
E
Erich Gamma 已提交
266 267
		});
		thisModel.applyEdits([EditOperation.delete(new Range(1, 4, 3, 5))]);
268 269 270 271 272 273 274 275 276
		assert.deepEqual(e, new ModelRawContentChangedEvent(
			[
				new ModelRawLineChanged(1, 'My Third Line'),
				new ModelRawLinesDeleted(2, 3),
			],
			2,
			false,
			false
		));
E
Erich Gamma 已提交
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
	});

	// --------- getValueInRange

	test('getValueInRange', () => {
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 1, 1)), '');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 1, 2)), 'M');
		assert.equal(thisModel.getValueInRange(new Range(1, 2, 1, 3)), 'y');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 1, 14)), 'My First Line');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 2, 1)), 'My First Line\n');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 2, 2)), 'My First Line\n\t');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 2, 3)), 'My First Line\n\t\t');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 2, 17)), 'My First Line\n\t\tMy Second Line');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 3, 1)), 'My First Line\n\t\tMy Second Line\n');
		assert.equal(thisModel.getValueInRange(new Range(1, 1, 4, 1)), 'My First Line\n\t\tMy Second Line\n    Third Line\n');
	});

	// --------- getValueLengthInRange

	test('getValueLengthInRange', () => {
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 1, 1)), ''.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 1, 2)), 'M'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 2, 1, 3)), 'y'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 1, 14)), 'My First Line'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 2, 1)), 'My First Line\n'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 2, 2)), 'My First Line\n\t'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 2, 3)), 'My First Line\n\t\t'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 2, 17)), 'My First Line\n\t\tMy Second Line'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 3, 1)), 'My First Line\n\t\tMy Second Line\n'.length);
		assert.equal(thisModel.getValueLengthInRange(new Range(1, 1, 4, 1)), 'My First Line\n\t\tMy Second Line\n    Third Line\n'.length);
	});

	// --------- setValue
	test('setValue eventing', () => {
311
		let e: ModelRawContentChangedEvent | null = null;
312 313
		thisModel.onDidChangeRawContent((_e) => {
			if (e !== null) {
314
				assert.fail('Unexpected assertion error');
315 316
			}
			e = _e;
E
Erich Gamma 已提交
317 318
		});
		thisModel.setValue('new value');
319 320 321 322 323 324 325 326
		assert.deepEqual(e, new ModelRawContentChangedEvent(
			[
				new ModelRawFlush()
			],
			2,
			false,
			false
		));
E
Erich Gamma 已提交
327
	});
328 329 330 331 332

	test('issue #46342: Maintain edit operation order in applyEdits', () => {
		let res = thisModel.applyEdits([
			{ range: new Range(2, 1, 2, 1), text: 'a' },
			{ range: new Range(1, 1, 1, 1), text: 'b' },
333
		], true);
334 335 336 337

		assert.deepEqual(res[0].range, new Range(2, 1, 2, 2));
		assert.deepEqual(res[1].range, new Range(1, 1, 1, 2));
	});
E
Erich Gamma 已提交
338 339 340 341 342 343
});


// --------- Special Unicode LINE SEPARATOR character
suite('Editor Model - Model Line Separators', () => {

A
Alex Dima 已提交
344
	let thisModel: TextModel;
E
Erich Gamma 已提交
345 346

	setup(() => {
A
Alex Dima 已提交
347
		const text =
E
Erich Gamma 已提交
348 349 350 351 352
			LINE1 + '\u2028' +
			LINE2 + '\n' +
			LINE3 + '\u2028' +
			LINE4 + '\r\n' +
			LINE5;
353
		thisModel = createTextModel(text);
E
Erich Gamma 已提交
354 355 356
	});

	teardown(() => {
A
Alex Dima 已提交
357
		thisModel.dispose();
E
Erich Gamma 已提交
358 359 360 361 362 363 364 365 366 367 368
	});

	test('model getValue', () => {
		assert.equal(thisModel.getValue(), 'My First Line\u2028\t\tMy Second Line\n    Third Line\u2028\n1');
	});

	test('model lines', () => {
		assert.equal(thisModel.getLineCount(), 3);
	});

	test('Bug 13333:Model should line break on lonely CR too', () => {
369
		let model = createTextModel('Hello\rWorld!\r\nAnother line');
E
Erich Gamma 已提交
370 371 372 373 374 375 376 377 378 379 380
		assert.equal(model.getLineCount(), 3);
		assert.equal(model.getValue(), 'Hello\r\nWorld!\r\nAnother line');
		model.dispose();
	});
});


// --------- Words

suite('Editor Model - Words', () => {

M
Matt Bierner 已提交
381 382 383 384 385 386 387 388 389 390
	const OUTER_LANGUAGE_ID = new LanguageIdentifier('outerMode', 3);
	const INNER_LANGUAGE_ID = new LanguageIdentifier('innerMode', 4);

	class OuterMode extends MockMode {
		constructor() {
			super(OUTER_LANGUAGE_ID);
			this._register(LanguageConfigurationRegistry.register(this.getLanguageIdentifier(), {}));

			this._register(TokenizationRegistry.register(this.getLanguageIdentifier().language, {
				getInitialState: (): IState => NULL_STATE,
391
				tokenize: undefined!,
392
				tokenize2: (line: string, hasEOL: boolean, state: IState): TokenizationResult2 => {
M
Matt Bierner 已提交
393
					const tokensArr: number[] = [];
394
					let prevLanguageId: LanguageIdentifier | undefined = undefined;
M
Matt Bierner 已提交
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
					for (let i = 0; i < line.length; i++) {
						const languageId = (line.charAt(i) === 'x' ? INNER_LANGUAGE_ID : OUTER_LANGUAGE_ID);
						if (prevLanguageId !== languageId) {
							tokensArr.push(i);
							tokensArr.push((languageId.id << MetadataConsts.LANGUAGEID_OFFSET));
						}
						prevLanguageId = languageId;
					}

					const tokens = new Uint32Array(tokensArr.length);
					for (let i = 0; i < tokens.length; i++) {
						tokens[i] = tokensArr[i];
					}
					return new TokenizationResult2(tokens, state);
				}
			}));
		}
	}

	class InnerMode extends MockMode {
		constructor() {
			super(INNER_LANGUAGE_ID);
			this._register(LanguageConfigurationRegistry.register(this.getLanguageIdentifier(), {}));
		}
	}

	let disposables: Disposable[] = [];
E
Erich Gamma 已提交
422 423

	setup(() => {
M
Matt Bierner 已提交
424
		disposables = [];
E
Erich Gamma 已提交
425 426 427
	});

	teardown(() => {
M
Matt Bierner 已提交
428 429
		dispose(disposables);
		disposables = [];
E
Erich Gamma 已提交
430 431 432
	});

	test('Get word at position', () => {
M
Matt Bierner 已提交
433
		const text = ['This text has some  words. '];
434
		const thisModel = createTextModel(text.join('\n'));
M
Matt Bierner 已提交
435 436
		disposables.push(thisModel);

E
Erich Gamma 已提交
437 438 439 440 441 442 443 444 445 446 447 448
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 1)), { word: 'This', startColumn: 1, endColumn: 5 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 2)), { word: 'This', startColumn: 1, endColumn: 5 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 4)), { word: 'This', startColumn: 1, endColumn: 5 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 5)), { word: 'This', startColumn: 1, endColumn: 5 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 6)), { word: 'text', startColumn: 6, endColumn: 10 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 19)), { word: 'some', startColumn: 15, endColumn: 19 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 20)), null);
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 21)), { word: 'words', startColumn: 21, endColumn: 26 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 26)), { word: 'words', startColumn: 21, endColumn: 26 });
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 27)), null);
		assert.deepEqual(thisModel.getWordAtPosition(new Position(1, 28)), null);
	});
M
Matt Bierner 已提交
449 450 451 452 453 454

	test('getWordAtPosition at embedded language boundaries', () => {
		const outerMode = new OuterMode();
		const innerMode = new InnerMode();
		disposables.push(outerMode, innerMode);

455
		const model = createTextModel('ab<xx>ab<x>', undefined, outerMode.getLanguageIdentifier());
M
Matt Bierner 已提交
456 457 458 459 460 461 462 463 464 465
		disposables.push(model);

		assert.deepEqual(model.getWordAtPosition(new Position(1, 1)), { word: 'ab', startColumn: 1, endColumn: 3 });
		assert.deepEqual(model.getWordAtPosition(new Position(1, 2)), { word: 'ab', startColumn: 1, endColumn: 3 });
		assert.deepEqual(model.getWordAtPosition(new Position(1, 3)), { word: 'ab', startColumn: 1, endColumn: 3 });
		assert.deepEqual(model.getWordAtPosition(new Position(1, 4)), { word: 'xx', startColumn: 4, endColumn: 6 });
		assert.deepEqual(model.getWordAtPosition(new Position(1, 5)), { word: 'xx', startColumn: 4, endColumn: 6 });
		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 });
	});
466 467 468 469 470 471 472 473 474 475 476 477 478 479

	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);

480
		const thisModel = createTextModel('.🐷-a-b', undefined, MODE_ID);
481 482 483 484 485 486 487 488 489 490 491
		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 });
	});
E
Erich Gamma 已提交
492
});