plaintext.ts 1.7 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7 8 9
/*---------------------------------------------------------------------------------------------
 *  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 Modes = require('vs/editor/common/modes');
import {AbstractMode} from 'vs/editor/common/modes/abstractMode';
import {AbstractState} from 'vs/editor/common/modes/abstractState';
10
import {TokenizationSupport} from 'vs/editor/common/modes/supports/tokenizationSupport';
11 12
import {TextualSuggestSupport} from 'vs/editor/common/modes/supports/suggestSupport';
import {IEditorWorkerService} from 'vs/editor/common/services/editorWorkerService';
E
Erich Gamma 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

class State extends AbstractState {

	constructor(mode:Modes.IMode) {
		super(mode);
	}

	public makeClone():State {
		return this;
	}

	public equals(other:Modes.IState):boolean {
		if (other instanceof State) {
			return (
				super.equals(other)
			);
		}
		return false;
	}

	public tokenize(stream:Modes.IStream):Modes.ITokenizationResult {
		stream.advanceToEOS();
		return { type:'' };
	}
}

39
export class Mode extends AbstractMode {
E
Erich Gamma 已提交
40

41
	public suggestSupport:Modes.ISuggestSupport;
E
Erich Gamma 已提交
42 43 44 45
	public tokenizationSupport: Modes.ITokenizationSupport;

	constructor(
		descriptor:Modes.IModeDescriptor,
46
		@IEditorWorkerService editorWorkerService: IEditorWorkerService
E
Erich Gamma 已提交
47
	) {
48
		super(descriptor.id);
49
		this.tokenizationSupport = new TokenizationSupport(this, {
E
Erich Gamma 已提交
50 51
			getInitialState: () => new State(this)
		}, false, false);
52

53
		this.suggestSupport = new TextualSuggestSupport(this.getId(), editorWorkerService);
E
Erich Gamma 已提交
54 55
	}
}