-
Notifications
You must be signed in to change notification settings - Fork 29k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add suggestions for ext filter in the Settings editor search widget #148076
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,8 @@ import { Orientation, Sizing, SplitView } from 'vs/base/browser/ui/splitview/spl | |
import { Color } from 'vs/base/common/color'; | ||
import { ILanguageService } from 'vs/editor/common/languages/language'; | ||
import { SettingsSearchFilterDropdownMenuActionViewItem } from 'vs/workbench/contrib/preferences/browser/settingsSearchMenu'; | ||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; | ||
import { ExtensionType } from 'vs/platform/extensions/common/extensions'; | ||
|
||
export const enum SettingsFocusContext { | ||
Search, | ||
|
@@ -202,6 +204,8 @@ export class SettingsEditor2 extends EditorPane { | |
private settingsTreeScrollTop = 0; | ||
private dimension!: DOM.Dimension; | ||
|
||
private installedExtensionIds: string[] = []; | ||
|
||
constructor( | ||
@ITelemetryService telemetryService: ITelemetryService, | ||
@IWorkbenchConfigurationService private readonly configurationService: IWorkbenchConfigurationService, | ||
|
@@ -218,7 +222,8 @@ export class SettingsEditor2 extends EditorPane { | |
@IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService, | ||
@IWorkspaceTrustManagementService private readonly workspaceTrustManagementService: IWorkspaceTrustManagementService, | ||
@IExtensionService private readonly extensionService: IExtensionService, | ||
@ILanguageService private readonly languageService: ILanguageService | ||
@ILanguageService private readonly languageService: ILanguageService, | ||
@IExtensionManagementService extensionManagementService: IExtensionManagementService | ||
) { | ||
super(SettingsEditor2.ID, telemetryService, themeService, storageService); | ||
this.delayedFilterLogging = new Delayer<void>(1000); | ||
|
@@ -269,6 +274,10 @@ export class SettingsEditor2 extends EditorPane { | |
if (ENABLE_LANGUAGE_FILTER && !SettingsEditor2.SUGGESTIONS.includes(`@${LANGUAGE_SETTING_TAG}`)) { | ||
SettingsEditor2.SUGGESTIONS.push(`@${LANGUAGE_SETTING_TAG}`); | ||
} | ||
|
||
extensionManagementService.getInstalled(ExtensionType.System).then(extensions => { | ||
this.installedExtensionIds = extensions.map(extension => extension.identifier.id); | ||
}); | ||
} | ||
|
||
override get minimumWidth(): number { return SettingsEditor2.EDITOR_MIN_WIDTH; } | ||
|
@@ -538,6 +547,11 @@ export class SettingsEditor2 extends EditorPane { | |
return `@${LANGUAGE_SETTING_TAG}${languageId} `; | ||
}).sort(); | ||
return sortedLanguages.filter(langFilter => !query.includes(langFilter)); | ||
} else if (queryParts[queryParts.length - 1].startsWith(`@${EXTENSION_SETTING_TAG}`)) { | ||
const installedExtensionsTags = this.installedExtensionIds.map(extensionId => { | ||
return `@${EXTENSION_SETTING_TAG}${extensionId} `; | ||
}).sort(); | ||
return installedExtensionsTags.filter(extFilter => !query.includes(extFilter)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether we can show the "display name" of the extension in the suggest widget as well? Maybe you can return a "detail" or "description" to show next to the ID There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll look into returning completion items for that case. |
||
} else if (queryParts[queryParts.length - 1].startsWith('@')) { | ||
return SettingsEditor2.SUGGESTIONS.filter(tag => !query.includes(tag)).map(tag => tag.endsWith(':') ? tag : tag + ' '); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ export class SettingsSearchFilterDropdownMenuActionViewItem extends DropdownMenu | |
localize('extSettingsSearch', "Extension ID..."), | ||
localize('extSettingsSearchTooltip', "Add extension ID filter"), | ||
`@${EXTENSION_SETTING_TAG}`, | ||
false | ||
true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change makes it so the completions list activates after the user selects the option from the funnel button. |
||
), | ||
this.createAction( | ||
'featuresSettingsSearch', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a similar hack that PreferencesSearchService uses to "unwrap" the result from the async API.