modesRegistry.ts ×3

Frontier kind: Code frontier

unlabeled · c_9a2649f2a226

920 tests · 6589 LOC · 35 files · introduces 0 tests · 77 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
3 ranges77 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
882 ranges6589 lines · 35 files · Browse complete extent
All tests (intent)
920 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 77 introduced LOC across 3 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/languages/modesRegistry.ts 77 introduced LOC · 3 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- modesRegistry.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import * as nls from '../../../nls.js';
7 > import { Emitter, Event } from '../../../base/common/event.js';
8 > import { ILanguageExtensionPoint } from './language.js';
9 > import { Registry } from '../../../platform/registry/common/platform.js';
10 > import { Disposable, IDisposable } from '../../../base/common/lifecycle.js';
11 > import { Mimes } from '../../../base/common/mime.js';
12 > import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from '../../../platform/configuration/common/configurationRegistry.js';
13 >
14 > // Define extension point ids
15 > export const Extensions = {
16 > ModesRegistry: 'editor.modesRegistry'
17 > };
18 >
19 > export class EditorModesRegistry extends Disposable {
20 >
21 > private readonly _languages: ILanguageExtensionPoint[];
22 >
23 > private readonly _onDidChangeLanguages = this._register(new Emitter<void>());
24 > public readonly onDidChangeLanguages: Event<void> = this._onDidChangeLanguages.event;
25 >
26 > constructor() {
27 > super();
28 > this._languages = [];
29 > }
30 >
31 > public registerLanguage(def: ILanguageExtensionPoint): IDisposable {
32 > this._languages.push(def);
33 > this._onDidChangeLanguages.fire(undefined);
34 > return {
35 > dispose: () => {
36 for (let i = 0, len = this._languages.length; i < len; i++) {
37 if (this._languages[i] === def) {
41 }
42 }
44 > }
45 >
46 > public getLanguages(): ReadonlyArray<ILanguageExtensionPoint> {
47 return this._languages;
48 }
50 >
51 > export const ModesRegistry = new EditorModesRegistry();
52 > Registry.add(Extensions.ModesRegistry, ModesRegistry);
53 >
54 > export const PLAINTEXT_LANGUAGE_ID = 'plaintext';
55 > export const PLAINTEXT_EXTENSION = '.txt';
56 >
57 > ModesRegistry.registerLanguage({
58 > id: PLAINTEXT_LANGUAGE_ID,
59 > extensions: [PLAINTEXT_EXTENSION],
60 > aliases: [nls.localize('plainText.alias', "Plain Text"), 'text'],
61 > mimetypes: [Mimes.text]
62 > });
63 >
64 > Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
65 > .registerDefaultConfigurations([{
66 > overrides: {
67 > '[plaintext]': {
68 > 'editor.unicodeHighlight.ambiguousCharacters': false,
69 > 'editor.unicodeHighlight.invisibleCharacters': false
70 > },
71 > // TODO: Below is a workaround for: https://github.com/microsoft/vscode/issues/240567
72 > '[go]': {
73 > 'editor.insertSpaces': false
74 > },
75 > '[makefile]': {
76 > 'editor.insertSpaces': false,
77 > },
78 > '[shellscript]': {
79 > 'files.eol': '\n'
80 > },
81 > '[yaml]': {
82 > 'editor.insertSpaces': true,
83 > 'editor.tabSize': 2
84 > }
85 > }
86 > }]);