modes.ts 19.5 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import {TPromise} from 'vs/base/common/winjs.base';
8
import {IMatch} from 'vs/base/common/filters';
A
Alex Dima 已提交
9
import {IMarker} from 'vs/platform/markers/common/markers';
E
Erich Gamma 已提交
10 11 12 13 14 15 16
import EditorCommon = require('vs/editor/common/editorCommon');
import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import URI from 'vs/base/common/uri';
import {IDisposable} from 'vs/base/common/lifecycle';
import {AsyncDescriptor0} from 'vs/platform/instantiation/common/descriptors';

export interface IWorkerParticipantDescriptor {
17 18 19
	modeId: string;
	moduleId: string;
	ctorName: string;
E
Erich Gamma 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 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
}

export interface IWorkerParticipant {

}

export enum Bracket {
	None = 0,
	Open = 1,
	Close = -1
}

export interface ITokenizationResult {
	type?:string;
	bracket?:Bracket;
	nextState?:IState;
}

export interface IState {
	clone():IState;
	equals(other:IState):boolean;
	getMode():IMode;
	tokenize(stream:IStream):ITokenizationResult;
	getStateData(): IState;
	setStateData(state:IState):void;
}

/**
 * An IStream is a character & token stream abstraction over a line of text. It
 *  is never multi-line. The stream can be navigated character by character, or
 *  token by token, given some token rules.
 */
export interface IStream {

	/**
	 * Returns the current character position of the stream on the line.
	 */
	pos():number;

	/**
	 * Returns true iff the stream is at the end of the line.
	 */
	eos():boolean;

	/**
	 * Returns the next character in the stream.
	 */
	peek():string;

	/**
	 * Returns the next character in the stream, and advances it by one character.
	 */
	next(): string;
	next2(): void;

	/**
	 * Advances the stream by `n` characters.
	 */
	advance(n:number):string;

	/**
	 * Advances the stream until the end of the line.
	 */
	advanceToEOS():string;

	/**
	 * Brings the stream back `n` characters.
	 */
	goBack(n:number):void;

	/**
	 *  Advances the stream if the next characters validate a condition. A condition can be
	 *
	 *      - a regular expression (always starting with ^)
	 * 			EXAMPLES: /^\d+/, /^function|var|interface|class/
	 *
	 *  	- a string
	 * 			EXAMPLES: "1954", "albert"
	 */
	advanceIfCharCode(charCode: number): string;
	advanceIfCharCode2(charCode:number): number;

	advanceIfString(condition: string): string;
	advanceIfString2(condition: string): number;

	advanceIfStringCaseInsensitive(condition: string): string;
	advanceIfStringCaseInsensitive2(condition: string): number;

	advanceIfRegExp(condition: RegExp): string;
	advanceIfRegExp2(condition:RegExp): number;


	/**
	 * Advances the stream while the next characters validate a condition. Check #advanceIf for
	 * details on the possible types for condition.
	 */
	advanceWhile(condition:string):string;
	advanceWhile(condition:RegExp):string;

	/**
	 * Advances the stream until the some characters validate a condition. Check #advanceIf for
	 * details on the possible types for condition. The `including` boolean value indicates
	 * whether the stream will advance the characters that matched the condition as well, or not.
	 */
	advanceUntil(condition: string, including: boolean): string;
	advanceUntil(condition: RegExp, including: boolean): string;

	advanceUntilString(condition: string, including: boolean): string;
	advanceUntilString2(condition: string, including: boolean): number;

	/**
	 * The token rules define how consecutive characters should be put together as a token,
	 * or separated into two different tokens. They are given through a separator characters
	 * string and a whitespace characters string. A separator is always one token. Consecutive
	 * whitespace is always one token. Everything in between these two token types, is also a token.
	 *
	 * 	EXAMPLE: stream.setTokenRules("+-", " ");
	 * 	Setting these token rules defines the tokens for the string "123+456 -    7" as being
	 * 		["123", "+", "456", " ", "-", "    ", "7"]
	 */
	setTokenRules(separators:string, whitespace:string):void;

	/**
	 * Returns the next token, given that the stream was configured with token rules.
	 */
	peekToken():string;

	/**
	 * Returns the next token, given that the stream was configured with token rules, and advances the
	 * stream by the exact length of the found token.
	 */
	nextToken():string;

	/**
	 * Returns the next whitespace, if found. Returns an empty string otherwise.
	 */
	peekWhitespace():string;

	/**
	 * Returns the next whitespace, if found, and advances the stream by the exact length of the found
	 * whitespace. Returns an empty string otherwise.
	 */
	skipWhitespace(): string;
	skipWhitespace2(): number;
}

export interface IModeDescriptor {
	id:string;
	workerParticipants:AsyncDescriptor0<IWorkerParticipant>[];
}

export interface ILineContext {
	getLineContent(): string;

	modeTransitions: IModeTransition[];

	getTokenCount(): number;
	getTokenStartIndex(tokenIndex:number): number;
	getTokenType(tokenIndex:number): string;
	getTokenText(tokenIndex:number): string;
	getTokenEndIndex(tokenIndex:number): number;
	findIndexOfOffset(offset:number): number;
}

export interface IMode {

	getId(): string;

A
Alex Dima 已提交
188 189 190 191 192
	/**
	 * Return a mode "similar" to this one that strips any "smart" supports.
	 */
	toSimplifiedMode(): IMode;

E
Erich Gamma 已提交
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 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
	addSupportChangedListener?(callback: (e: EditorCommon.IModeSupportChangedEvent) => void): IDisposable;

	/**
	 * Register a support by name. Only optional.
	 */
	registerSupport?<T>(support:string, callback:(mode:IMode)=>T): IDisposable;

	/**
	 * Optional adapter to support tokenization.
	 */
	tokenizationSupport?: ITokenizationSupport;

	/**
	 * Optional adapter to support showing occurrences of words or such.
	 */
	occurrencesSupport?:IOccurrencesSupport;

	/**
	 * Optional adapter to support revealing the declaration of a symbol.
	 */
	declarationSupport?: IDeclarationSupport;

	/**
	 * Optional adapter to support revealing the type declaration of a symbol.
	 */
	typeDeclarationSupport?: ITypeDeclarationSupport;

	/**
	 * Optional adapter to support finding references to a symbol.
	 */
	referenceSupport?:IReferenceSupport;

	/**
	 * Optional adapter to support intellisense.
	 */
	suggestSupport?:ISuggestSupport;

	/**
	 * Optional adapter to support intellisense.
	 */
	parameterHintsSupport?:IParameterHintsSupport;

	/**
	 * Optional adapter to support showing extra info in tokens.
	 */
	extraInfoSupport?:IExtraInfoSupport;

	/**
	 * Optional adapter to support showing an outline.
	 */
	outlineSupport?:IOutlineSupport;

	/**
	 * Optional adapter to support logical selection.
	 */
	logicalSelectionSupport?:ILogicalSelectionSupport;

	/**
	 * Optional adapter to support formatting.
	 */
	formattingSupport?:IFormattingSupport;

	/**
	 * Optional adapter to support inplace-replace.
	 */
	inplaceReplaceSupport?:IInplaceReplaceSupport;

	/**
	 * Optional adapter to support diff'ing two models.
	 */
	diffSupport?:IDiffSupport;

	/**
	 * Optional adapter to support diff'ing a model with its original version.
	 */
	dirtyDiffSupport?:IDirtyDiffSupport;

	/**
	 * Optional adapter to support output for a model (e.g. markdown -> html)
	 */
	emitOutputSupport?:IEmitOutputSupport;

	/**
	 * Optional adapter to support detecting links.
	 */
	linkSupport?:ILinkSupport;

	/**
	 * Optional adapter to support configuring this mode.
	 */
	configSupport?:IConfigurationSupport;

	/**
	 * Optional adapter to support quick fix of typing errors.
	 */
	quickFixSupport?:IQuickFixSupport;

	/**
	 * Optional adapter to show code lens
	 */
	codeLensSupport?:ICodeLensSupport;

	/**
	 * Optional adapter to support renaming
	 */
	renameSupport?: IRenameSupport;

	/**
	 * Optional adapter to support task running
	 */
	taskSupport?: ITaskSupport;

305 306 307 308
	/**
	 * Optional adapter to support rich editing.
	 */
	richEditSupport?: IRichEditSupport;
E
Erich Gamma 已提交
309 310 311 312 313 314 315 316
}

/**
 * Interface used for tokenization
 */
export interface IToken {
	startIndex:number;
	type:string;
317
	bracket?:Bracket;
E
Erich Gamma 已提交
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
}

export interface IModeTransition {
	startIndex: number;
	mode: IMode;
}

export interface ILineTokens {
	tokens: IToken[];
	actualStopOffset: number;
	endState: IState;
	modeTransitions: IModeTransition[];
	retokenize?:TPromise<void>;
}

export interface ITokenizationSupport {

	shouldGenerateEmbeddedModels: boolean;

	getInitialState():IState;

	// add offsetDelta to each of the returned indices
	// stop tokenizing at absolute value stopAtOffset (i.e. stream.pos() + offsetDelta > stopAtOffset)
	tokenize(line:string, state:IState, offsetDelta?:number, stopAtOffset?:number):ILineTokens;
}

/**
 * Interface used to get extra info for a symbol
 */
export interface IComputeExtraInfoResult {
	range: EditorCommon.IRange;
	value?: string;
	htmlContent?: IHTMLContentElement[];
	className?: string;
}
export interface IExtraInfoSupport {
J
Johannes Rieken 已提交
354
	computeInfo(resource:URI, position:EditorCommon.IPosition):TPromise<IComputeExtraInfoResult>;
E
Erich Gamma 已提交
355 356 357 358 359 360 361 362 363 364 365 366
}


export interface ISuggestion {
	label: string;
	codeSnippet: string;
	type: string;
	typeLabel?: string;
	documentationLabel?: string;
	filterText?: string;
	sortText?: string;
	noAutoAccept?: boolean;
367 368
	overwriteBefore?: number;
	overwriteAfter?: number;
E
Erich Gamma 已提交
369 370
}

371
export interface ISuggestResult {
E
Erich Gamma 已提交
372 373 374 375 376
	currentWord: string;
	suggestions:ISuggestion[];
	incomplete?: boolean;
}

377
export interface ISuggestionFilter {
E
Erich Gamma 已提交
378
	// Should return whether `suggestion` is a good suggestion for `word`
379
	(word: string, suggestion: ISuggestion): IMatch[];
E
Erich Gamma 已提交
380 381 382 383 384 385 386 387 388 389
}

/**
 * Interface used to get completion suggestions at a specific location.
 */
export interface ISuggestSupport {

	/**
	 * Compute all completions for the given resource at the given position.
	 */
390
	suggest(resource: URI, position: EditorCommon.IPosition, triggerCharacter?: string): TPromise<ISuggestResult[]>;
E
Erich Gamma 已提交
391 392 393 394

	/**
	 * Compute more details for the given suggestion.
	 */
395
	getSuggestionDetails?: (resource: URI, position: EditorCommon.IPosition, suggestion: ISuggestion) => TPromise<ISuggestion>;
E
Erich Gamma 已提交
396

397 398 399 400
	getFilter(): ISuggestionFilter;
	getTriggerCharacters(): string[];
	shouldShowEmptySuggestionList(): boolean;
	shouldAutotriggerSuggest(context: ILineContext, offset: number, triggeredByCharacter: string): boolean;
E
Erich Gamma 已提交
401 402 403 404 405 406
}

/**
 * Interface used to quick fix typing errors while accesing member fields.
 */
export interface IQuickFix {
407
	command: ICommand;
E
Erich Gamma 已提交
408 409 410 411 412 413 414 415 416 417
	score: number;
}

export interface IQuickFixResult {
	edits?: IResourceEdit[];
	message?: string;
}

export interface IQuickFixSupport {
	getQuickFixes(resource: URI, range: IMarker | EditorCommon.IRange): TPromise<IQuickFix[]>;
418 419
	//TODO@joh this should be removed in the furture such that we can trust the command and it's args
	runQuickFixAction(resource: URI, range: EditorCommon.IRange, quickFix: IQuickFix):TPromise<IQuickFixResult>;
E
Erich Gamma 已提交
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
}

export interface IParameter {
	label:string;
	documentation?:string;
	signatureLabelOffset?:number;
	signatureLabelEnd?:number;
}

export interface ISignature {
	label:string;
	documentation?:string;
	parameters:IParameter[];
}

export interface IParameterHints {
	currentSignature:number;
	currentParameter:number;
	signatures:ISignature[];
}

/**
 * Interface used to get parameter hints.
 */
export interface IParameterHintsSupport {
	getParameterHintsTriggerCharacters(): string[];
	shouldTriggerParameterHints(context: ILineContext, offset: number): boolean;
447
	getParameterHints(resource: URI, position: EditorCommon.IPosition, triggerCharacter?: string): TPromise<IParameterHints>;
E
Erich Gamma 已提交
448 449 450 451 452 453 454 455 456 457 458 459
}


export interface IOccurence {
	kind?:string;
	range:EditorCommon.IRange;
}

/**
 * Interface used to find occurrences of a symbol
 */
export interface IOccurrencesSupport {
460
	findOccurrences(resource:URI, position:EditorCommon.IPosition, strict?:boolean):TPromise<IOccurence[]>;
E
Erich Gamma 已提交
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486
}


/**
 * Interface used to find declarations on a symbol
 */
export interface IReference {
	resource: URI;
	range: EditorCommon.IRange;
}

/**
 * Interface used to find references to a symbol
 */
export interface IReferenceSupport {

	/**
	 * @returns true if on the given line (and its tokens) at the given
	 * 	offset reference search can be invoked.
	 */
	canFindReferences(context:ILineContext, offset:number):boolean;

	/**
	 * @returns a list of reference of the symbol at the position in the
	 * 	given resource.
	 */
487
	findReferences(resource:URI, position:EditorCommon.IPosition, includeDeclaration:boolean):TPromise<IReference[]>;
E
Erich Gamma 已提交
488 489 490 491 492 493 494
}

/**
 * Interface used to find declarations on a symbol
 */
export interface IDeclarationSupport {
	canFindDeclaration(context:ILineContext, offset:number):boolean;
J
Johannes Rieken 已提交
495
	findDeclaration(resource:URI, position:EditorCommon.IPosition):TPromise<IReference|IReference[]>;
E
Erich Gamma 已提交
496 497 498 499
}

export interface ITypeDeclarationSupport {
	canFindTypeDeclaration(context:ILineContext, offset:number):boolean;
500
	findTypeDeclaration(resource:URI, position:EditorCommon.IPosition):TPromise<IReference>;
E
Erich Gamma 已提交
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
}

/**
 * Interface used to compute an outline
 */
export interface IOutlineEntry {
	label: string;
	containerLabel?: string;
	type: string;
	icon?: string; // icon class or null to use the default images based on the type
	range: EditorCommon.IRange;
	children?: IOutlineEntry[];
}

export interface IOutlineSupport {
516
	getOutline(resource:URI):TPromise<IOutlineEntry[]>;
E
Erich Gamma 已提交
517 518 519 520 521 522 523 524 525 526 527
	outlineGroupLabel?: { [name: string]: string; };
}

/**
 * Interface used to compute a hierachry of logical ranges.
 */
export interface ILogicalSelectionEntry {
	type:string;
	range:EditorCommon.IRange;
}
export interface ILogicalSelectionSupport {
528
	getRangesToPosition(resource:URI, position:EditorCommon.IPosition):TPromise<ILogicalSelectionEntry[]>;
E
Erich Gamma 已提交
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
}

/**
 * Interface used to format a model
 */
export interface IFormattingOptions {
	tabSize:number;
	insertSpaces:boolean;
}

/**
 * Supports to format source code. There are three levels
 * on which formatting can be offered:
 * (1) format a document
 * (2) format a selectin
 * (3) format on keystroke
 */
export interface IFormattingSupport {

548
	formatDocument?: (resource: URI, options: IFormattingOptions) => TPromise<EditorCommon.ISingleEditOperation[]>;
E
Erich Gamma 已提交
549

550
	formatRange?: (resource: URI, range: EditorCommon.IRange, options: IFormattingOptions) => TPromise<EditorCommon.ISingleEditOperation[]>;
E
Erich Gamma 已提交
551 552 553

	autoFormatTriggerCharacters?: string[];

554
	formatAfterKeystroke?: (resource: URI, position: EditorCommon.IPosition, ch: string, options: IFormattingOptions) => TPromise<EditorCommon.ISingleEditOperation[]>;
E
Erich Gamma 已提交
555 556 557 558 559 560 561 562 563 564 565
}

export interface IInplaceReplaceSupportResult {
	value: string;
	range:EditorCommon.IRange;
}

/**
 * Interface used to navigate with a value-set.
 */
export interface IInplaceReplaceSupport {
566
	navigateValueSet(resource:URI, range:EditorCommon.IRange, up:boolean):TPromise<IInplaceReplaceSupportResult>;
E
Erich Gamma 已提交
567 568 569 570 571 572 573
}


/**
 * Interface used to compute the diff between two models.
 */
export interface IDiffSupport {
574
	computeDiff(original:URI, modified:URI, ignoreTrimWhitespace:boolean):TPromise<EditorCommon.ILineChange[]>;
E
Erich Gamma 已提交
575 576 577 578 579 580 581
}


/**
 * Interface used to compute the diff between a model and its original version.
 */
export interface IDirtyDiffSupport {
582
	computeDirtyDiff(resource:URI, ignoreTrimWhitespace:boolean):TPromise<EditorCommon.IChange[]>;
E
Erich Gamma 已提交
583 584 585 586 587 588
}

/**
 * Interface used to get output for a language that supports transformation (e.g. markdown -> html)
 */
export interface IEmitOutputSupport {
589
	getEmitOutput(resource:URI):TPromise<IEmitOutput>;
E
Erich Gamma 已提交
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613
}

export interface IEmitOutput {
	filename?:string;
	content:string;
}

/**
 * Interface used to detect links.
 */
export interface ILink {

	range: EditorCommon.IRange;

	/**
	 * The url of the link.
	 * The url should be absolute and will not get any special treatment.
	 */
	url: string;

	extraInlineClassName?: string;
}

export interface ILinkSupport {
614
	computeLinks(resource:URI):TPromise<ILink[]>;
E
Erich Gamma 已提交
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
}

/**
 * Interface used to define a configurable editor mode.
 */
export interface IConfigurationSupport {
	configure(options:any):TPromise<boolean>;
}

export interface IResourceEdit {
	resource: URI;
	range?: EditorCommon.IRange;
	newText: string;
}

export interface IRenameResult {
	currentName: string;
	edits: IResourceEdit[];
	rejectReason?: string;
}

/**
 * Interface used to support renaming of symbols
 */
export interface IRenameSupport {

	filter?: string[];

	rename(resource: URI, position: EditorCommon.IPosition, newName: string): TPromise<IRenameResult>;
}

export interface ICommand {
	id: string;
	title: string;
	arguments?: any[];
}

export interface ICodeLensSymbol {
	range: EditorCommon.IRange;
	id?: string;
J
Johannes Rieken 已提交
655
	command?: ICommand;
E
Erich Gamma 已提交
656 657 658 659 660 661 662
}

/**
 * Interface used for the code lense support
 */
export interface ICodeLensSupport {
	findCodeLensSymbols(resource: URI): TPromise<ICodeLensSymbol[]>;
J
Johannes Rieken 已提交
663
	resolveCodeLensSymbol(resource: URI, symbol: ICodeLensSymbol): TPromise<ICodeLensSymbol>;
E
Erich Gamma 已提交
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691
}

export interface ITaskSummary {
}

/**
 * Interface to support building via a langauge service
 */
export interface ITaskSupport {
	build?():TPromise<ITaskSummary>;
	rebuild?():TPromise<ITaskSummary>;
	clean?():TPromise<void>;
}

/**
 * Standard brackets used for auto indentation
 */
export interface IBracketPair {
	tokenType:string;
	open:string;
	close:string;
	isElectric:boolean;
}

export interface IAutoClosingPairConditional extends IAutoClosingPair {
	notIn?: string[];
}

692 693 694 695 696 697 698 699
/**
 * Interface used to support electric characters
 */
export interface IElectricAction {
	// Only one of the following properties should be defined:

	// The line will be indented at the same level of the line
	// which contains the matching given bracket type.
700
	matchOpenBracket?:string;
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738

	// The text will be appended after the electric character.
	appendText?:string;

	// The number of characters to advance the cursor, useful with appendText
	advanceCount?:number;
}

export enum IndentAction {
	None,
	Indent,
	IndentOutdent,
	Outdent
}

/**
 * An action the editor executes when 'enter' is being pressed
 */
export interface IEnterAction {
	indentAction:IndentAction;
	appendText?:string;
	removeText?:number;
}

export interface IRichEditElectricCharacter {
	getElectricCharacters():string[];
	// Should return opening bracket type to match indentation with
	onElectricCharacter(context:ILineContext, offset:number):IElectricAction;
}

export interface IRichEditOnEnter {
	onEnter(model:EditorCommon.ITokenizedModel, position: EditorCommon.IPosition): IEnterAction;
}

/**
 * Interface used to support insertion of mode specific comments.
 */
export interface ICommentsConfiguration {
A
Alex Dima 已提交
739
	lineCommentToken?:string;
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
	blockCommentStartToken?:string;
	blockCommentEndToken?:string;
}

/**
 * Interface used to support insertion of matching characters like brackets and qoutes.
 */
export interface IAutoClosingPair {
	open:string;
	close:string;
}
export interface IRichEditCharacterPair {
	getAutoClosingPairs():IAutoClosingPairConditional[];
	shouldAutoClosePair(character:string, context:ILineContext, offset:number):boolean;
	getSurroundingPairs():IAutoClosingPair[];
}

757 758 759 760 761 762 763 764 765
export interface IRichEditBrackets {
	maxBracketLength: number;
	forwardRegex: RegExp;
	reversedRegex: RegExp;
	brackets: EditorCommon.IRichEditBracket[];
	textIsBracket: {[text:string]:EditorCommon.IRichEditBracket;};
	textIsOpenBracket: {[text:string]:boolean;};
}

766 767 768 769 770 771 772 773 774
export interface IRichEditSupport {
	/**
	 * Optional adapter for electric characters.
	 */
	electricCharacter?:IRichEditElectricCharacter;

	/**
	 * Optional adapter for comment insertion.
	 */
A
Alex Dima 已提交
775
	comments?:ICommentsConfiguration;
776 777 778 779 780 781 782 783 784

	/**
	 * Optional adapter for insertion of character pair.
	 */
	characterPair?:IRichEditCharacterPair;

	/**
	 * Optional adapter for classification of tokens.
	 */
785
	wordDefinition?: RegExp;
786 787 788 789 790

	/**
	 * Optional adapter for custom Enter handling.
	 */
	onEnter?: IRichEditOnEnter;
791 792 793 794 795

	/**
	 * Optional adapter for brackets.
	 */
	brackets?: IRichEditBrackets;
796
}