*/
export function getMimeTypes(resource: URI | null, firstLine?: string): string[] {
}
/**
Frontier kind: Code frontier
unlabeled · c_e79a9f9d0aca
10 tests · 8888 LOC · 42 files · introduces 0 tests · 50 LOC · 1 file
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.
Every exact file and test below is linked only from the concept that introduces it.
mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/editor/test/common/services/languagesAssociations.test|title=LanguagesAssociations Specificity priority 1|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/editor/test/common/services/languagesAssociations.test|title=LanguagesAssociations Specificity priority 2|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/charCode.test|title=CharCode has good values|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/path.test|title=Paths (Node Implementation) path|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI File paths containing apostrophes break URI parsing and cannot be opened #276075|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI URI#file, win-speciale|occurrence=1Every collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
1 file ranked by introduced lines: 50 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
*/
export function getMimeTypes(resource: URI | null, firstLine?: string): string[] {
}
/**
}
function getAssociations(resource: URI | null, firstLine?: string): IdAndMime[] {
languagesAssociations.ts
let path: string | undefined;
if (resource) {
switch (resource.scheme) {
case Schemas.file:
path = resource.fsPath;
break;
const metadata = DataUri.parseMetaData(resource);
path = metadata.get(DataUri.META_DATA_LABEL);
break;
}
// File path not relevant for language detection of cell
path = undefined;
break;
path = resource.path;
}
if (!path) {
return [{ id: 'unknown', mime: Mimes.unknown }];
}
path = path.toLowerCase();
const filename = basename(path);
// 1.) User configured mappings have highest priority
const configuredLanguage = getAssociationByPath(path, filename, userRegisteredAssociations);
if (configuredLanguage) {
return [configuredLanguage, { id: PLAINTEXT_LANGUAGE_ID, mime: Mimes.text }];
}
}
function getAssociationByPath(path: string, filename: string, associations: ILanguageAssociationItem[]): ILanguageAssociationItem | undefined {
languagesAssociations.ts
let filenameMatch: ILanguageAssociationItem | undefined = undefined;
let patternMatch: ILanguageAssociationItem | undefined = undefined;
let extensionMatch: ILanguageAssociationItem | undefined = undefined;
// We want to prioritize associations based on the order they are registered so that the last registered
// association wins over all other. This is for https://github.com/microsoft/vscode/issues/20074
for (let i = associations.length - 1; i >= 0; i--) {
const association = associations[i];
// First exact name match
if (equals(filename, association.filename, true)) {
filenameMatch = association;
break; // take it!
}
// Longest pattern match
if (association.filepattern) {
if (!patternMatch || association.filepattern.length > patternMatch.filepattern!.length) {
const target = association.filepatternOnPath ? path : filename; // match on full path if pattern contains path separator
}
}
// Longest extension match
if (association.extension) {
if (!extensionMatch || association.extension.length > extensionMatch.extension!.length) {
if (endsWithIgnoreCase(filename, association.extension)) {
}
}
// 1.) Exact name match has second highest priority
if (filenameMatch) {
return filenameMatch;
}
// 2.) Match on pattern
if (patternMatch) {
return patternMatch;
}
// 3.) Match on extension comes next
if (extensionMatch) {
return extensionMatch;
}