mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 12:40:19 -05:00
File extension association is not respected when file extension and language id share the same icon . Fixes #27475
This commit is contained in:
@@ -270,6 +270,7 @@ export function getIconClasses(modelService: IModelService, modeService: IModeSe
|
||||
for (let i = 1; i < dotSegments.length; i++) {
|
||||
classes.push(`${dotSegments.slice(i).join('.')}-ext-file-icon`); // add each combination of all found extensions if more than one
|
||||
}
|
||||
classes.push(`ext-file-icon`); // extra segment to increase file-ext score
|
||||
|
||||
// Configured Language
|
||||
let configuredLangId = getConfiguredLangId(modelService, resource);
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.file-icons-enabled .show-file-icons .vs_code_editor_walkthrough\.md-name-file-icon.md-ext-file-icon.markdown-lang-file-icon.file-icon::before {
|
||||
.file-icons-enabled .show-file-icons .vs_code_editor_walkthrough\.md-name-file-icon.md-ext-file-icon.ext-file-icon.markdown-lang-file-icon.file-icon::before {
|
||||
content: ' ';
|
||||
background-image: url('../../code-icon.svg');
|
||||
}
|
||||
|
||||
@@ -645,8 +645,11 @@ function _processIconThemeDocument(id: string, iconThemeDocumentPath: string, ic
|
||||
for (let fileExtension in fileExtensions) {
|
||||
let selectors: string[] = [];
|
||||
let segments = fileExtension.toLowerCase().split('.');
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
|
||||
if (segments.length) {
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
|
||||
}
|
||||
selectors.push('.ext-file-icon'); // extra segment to increase file-ext score
|
||||
}
|
||||
addSelector(`${qualifier} ${selectors.join('')}.file-icon::before`, fileExtensions[fileExtension]);
|
||||
result.hasFileIcons = true;
|
||||
@@ -659,8 +662,11 @@ function _processIconThemeDocument(id: string, iconThemeDocumentPath: string, ic
|
||||
fileName = fileName.toLowerCase();
|
||||
selectors.push(`.${escapeCSS(fileName)}-name-file-icon`);
|
||||
let segments = fileName.split('.');
|
||||
for (let i = 1; i < segments.length; i++) {
|
||||
selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
|
||||
if (segments.length) {
|
||||
for (let i = 1; i < segments.length; i++) {
|
||||
selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
|
||||
}
|
||||
selectors.push('.ext-file-icon'); // extra segment to increase file-ext score
|
||||
}
|
||||
addSelector(`${qualifier} ${selectors.join('')}.file-icon::before`, fileNames[fileName]);
|
||||
result.hasFileIcons = true;
|
||||
|
||||
@@ -32,11 +32,11 @@ export class Explorer extends Viewlet {
|
||||
public getExtensionSelector(fileName: string): string {
|
||||
const extension = fileName.split('.')[1];
|
||||
if (extension === 'js') {
|
||||
return 'js-ext-file-icon javascript-lang-file-icon';
|
||||
return 'js-ext-file-icon ext-file-icon javascript-lang-file-icon';
|
||||
} else if (extension === 'json') {
|
||||
return 'json-ext-file-icon json-lang-file-icon';
|
||||
return 'json-ext-file-icon ext-file-icon json-lang-file-icon';
|
||||
} else if (extension === 'md') {
|
||||
return 'md-ext-file-icon markdown-lang-file-icon';
|
||||
return 'md-ext-file-icon ext-file-icon markdown-lang-file-icon';
|
||||
}
|
||||
throw new Error('No class defined for this file extension');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user