Fixes #150176: Extract code related to encoded token attributes to a separate file (#150275)

This commit is contained in:
Alexandru Dima
2022-05-24 15:51:23 +02:00
committed by GitHub
parent 903c5c6cc9
commit 339c3a9b60
60 changed files with 295 additions and 262 deletions

View File

@@ -22,6 +22,7 @@ import { ISelection, Selection } from 'vs/editor/common/core/selection';
import { ILineChange } from 'vs/editor/common/diff/diffComputer';
import * as editorCommon from 'vs/editor/common/editorCommon';
import * as languages from 'vs/editor/common/languages';
import { StandardTokenType } from 'vs/editor/common/encodedTokenAttributes';
import { CharacterPair, CommentRule, EnterAction } from 'vs/editor/common/languages/languageConfiguration';
import { EndOfLineSequence } from 'vs/editor/common/model';
import { IModelChangedEvent } from 'vs/editor/common/model/mirrorTextModel';
@@ -398,7 +399,7 @@ export interface MainThreadLanguageFeaturesShape extends IDisposable {
export interface MainThreadLanguagesShape extends IDisposable {
$changeLanguage(resource: UriComponents, languageId: string): Promise<void>;
$tokensAtPosition(resource: UriComponents, position: IPosition): Promise<undefined | { type: languages.StandardTokenType; range: IRange }>;
$tokensAtPosition(resource: UriComponents, position: IPosition): Promise<undefined | { type: StandardTokenType; range: IRange }>;
$setLanguageStatus(handle: number, status: ILanguageStatus): void;
$removeLanguageStatus(handle: number): void;
}

View File

@@ -20,6 +20,7 @@ import * as editorRange from 'vs/editor/common/core/range';
import { ISelection } from 'vs/editor/common/core/selection';
import { IContentDecorationRenderOptions, IDecorationOptions, IDecorationRenderOptions, IThemeDecorationRenderOptions } from 'vs/editor/common/editorCommon';
import * as languages from 'vs/editor/common/languages';
import * as encodedTokenAttributes from 'vs/editor/common/encodedTokenAttributes';
import * as languageSelector from 'vs/editor/common/languageSelector';
import { EndOfLineSequence, TrackedRangeStickiness } from 'vs/editor/common/model';
import { EditorResolution, ITextEditorOptions } from 'vs/platform/editor/common/editor';
@@ -112,12 +113,12 @@ export namespace Range {
}
export namespace TokenType {
export function to(type: languages.StandardTokenType): types.StandardTokenType {
export function to(type: encodedTokenAttributes.StandardTokenType): types.StandardTokenType {
switch (type) {
case languages.StandardTokenType.Comment: return types.StandardTokenType.Comment;
case languages.StandardTokenType.Other: return types.StandardTokenType.Other;
case languages.StandardTokenType.RegEx: return types.StandardTokenType.RegEx;
case languages.StandardTokenType.String: return types.StandardTokenType.String;
case encodedTokenAttributes.StandardTokenType.Comment: return types.StandardTokenType.Comment;
case encodedTokenAttributes.StandardTokenType.Other: return types.StandardTokenType.Other;
case encodedTokenAttributes.StandardTokenType.RegEx: return types.StandardTokenType.RegEx;
case encodedTokenAttributes.StandardTokenType.String: return types.StandardTokenType.String;
}
}
}