mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-20 02:34:37 +01:00
Fixed issue -filtering by extension in Change Language Mode (#112435)
* Fixed issue -filtering by extension in Change Language Mode * Removed unnecessary metaHighlights from quickInputList Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
This commit is contained in:
co-authored by
Benjamin Pasero
parent
d8a7c31aba
commit
7aee2c7d45
@@ -34,6 +34,7 @@ interface IListElement {
|
||||
readonly index: number;
|
||||
readonly item: IQuickPickItem;
|
||||
readonly saneLabel: string;
|
||||
readonly saneMeta?: string;
|
||||
readonly saneAriaLabel: string;
|
||||
readonly saneDescription?: string;
|
||||
readonly saneDetail?: string;
|
||||
@@ -49,6 +50,7 @@ class ListElement implements IListElement, IDisposable {
|
||||
index!: number;
|
||||
item!: IQuickPickItem;
|
||||
saneLabel!: string;
|
||||
saneMeta!: string;
|
||||
saneAriaLabel!: string;
|
||||
saneDescription?: string;
|
||||
saneDetail?: string;
|
||||
@@ -247,6 +249,7 @@ export class QuickInputList {
|
||||
matchOnDescription = false;
|
||||
matchOnDetail = false;
|
||||
matchOnLabel = true;
|
||||
matchOnMeta = true;
|
||||
sortByLabel = true;
|
||||
private readonly _onChangedAllVisibleChecked = new Emitter<boolean>();
|
||||
onChangedAllVisibleChecked: Event<boolean> = this._onChangedAllVisibleChecked.event;
|
||||
@@ -420,6 +423,7 @@ export class QuickInputList {
|
||||
if (item.type !== 'separator') {
|
||||
const previous = index && inputElements[index - 1];
|
||||
const saneLabel = item.label && item.label.replace(/\r?\n/g, ' ');
|
||||
const saneMeta = item.meta && item.meta.replace(/\r?\n/g, ' ');
|
||||
const saneDescription = item.description && item.description.replace(/\r?\n/g, ' ');
|
||||
const saneDetail = item.detail && item.detail.replace(/\r?\n/g, ' ');
|
||||
const saneAriaLabel = item.ariaLabel || [saneLabel, saneDescription, saneDetail]
|
||||
@@ -431,6 +435,7 @@ export class QuickInputList {
|
||||
index,
|
||||
item,
|
||||
saneLabel,
|
||||
saneMeta,
|
||||
saneAriaLabel,
|
||||
saneDescription,
|
||||
saneDetail,
|
||||
@@ -602,8 +607,9 @@ export class QuickInputList {
|
||||
const labelHighlights = this.matchOnLabel ? withNullAsUndefined(matchesFuzzyIconAware(query, parseLabelWithIcons(element.saneLabel))) : undefined;
|
||||
const descriptionHighlights = this.matchOnDescription ? withNullAsUndefined(matchesFuzzyIconAware(query, parseLabelWithIcons(element.saneDescription || ''))) : undefined;
|
||||
const detailHighlights = this.matchOnDetail ? withNullAsUndefined(matchesFuzzyIconAware(query, parseLabelWithIcons(element.saneDetail || ''))) : undefined;
|
||||
const metaHighlights = this.matchOnMeta ? withNullAsUndefined(matchesFuzzyIconAware(query, parseLabelWithIcons(element.saneMeta || ''))) : undefined;
|
||||
|
||||
if (labelHighlights || descriptionHighlights || detailHighlights) {
|
||||
if (labelHighlights || descriptionHighlights || detailHighlights || metaHighlights) {
|
||||
element.labelHighlights = labelHighlights;
|
||||
element.descriptionHighlights = descriptionHighlights;
|
||||
element.detailHighlights = detailHighlights;
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface IQuickPickItem {
|
||||
type?: 'item';
|
||||
id?: string;
|
||||
label: string;
|
||||
meta?: string;
|
||||
ariaLabel?: string;
|
||||
description?: string;
|
||||
detail?: string;
|
||||
|
||||
@@ -1085,6 +1085,7 @@ export class ChangeModeAction extends Action {
|
||||
const languages = this.modeService.getRegisteredLanguageNames();
|
||||
const picks: QuickPickInput[] = languages.sort().map((lang, index) => {
|
||||
const modeId = this.modeService.getModeIdForLanguageName(lang.toLowerCase()) || 'unknown';
|
||||
const extensions = this.modeService.getExtensions(lang).join(' ');
|
||||
let description: string;
|
||||
if (currentLanguageId === lang) {
|
||||
description = nls.localize('languageDescription', "({0}) - Configured Language", modeId);
|
||||
@@ -1094,6 +1095,7 @@ export class ChangeModeAction extends Action {
|
||||
|
||||
return {
|
||||
label: lang,
|
||||
meta: extensions,
|
||||
iconClasses: getIconClassesForModeId(modeId),
|
||||
description
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user