Path: blob/main/src/vs/editor/contrib/semanticTokens/common/semanticTokensConfig.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { ITextModel } from '../../../common/model.js';6import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';7import { IThemeService } from '../../../../platform/theme/common/themeService.js';89export const SEMANTIC_HIGHLIGHTING_SETTING_ID = 'editor.semanticHighlighting';1011export interface IEditorSemanticHighlightingOptions {12enabled: true | false | 'configuredByTheme';13}1415export function isSemanticColoringEnabled(model: ITextModel, themeService: IThemeService, configurationService: IConfigurationService): boolean {16const setting = configurationService.getValue<IEditorSemanticHighlightingOptions>(SEMANTIC_HIGHLIGHTING_SETTING_ID, { overrideIdentifier: model.getLanguageId(), resource: model.uri })?.enabled;17if (typeof setting === 'boolean') {18return setting;19}20return themeService.getColorTheme().semanticHighlighting;21}222324