Skip to content

Commit

Permalink
Merge branch 'main' into pouya/better-minimap-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
pouyakary authored Apr 10, 2024
2 parents 55deaa9 + 67f1ea8 commit d44d63d
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 85 deletions.
8 changes: 8 additions & 0 deletions src/vs/base/browser/ui/toggle/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ export class Toggle extends Widget {
this._hover.update(newTitle);
this.domNode.setAttribute('aria-label', newTitle);
}

set visible(visible: boolean) {
this.domNode.style.display = visible ? '' : 'none';
}

get visible() {
return this.domNode.style.display !== 'none';
}
}

export class Checkbox extends Widget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { mapObservableArrayCached } from 'vs/base/common/observableInternal/utils';
import { ISettableObservable, observableValueOpts } from 'vs/base/common/observableInternal/base';
import { itemsEquals, itemEquals } from 'vs/base/common/equals';
<<<<<<< HEAD
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
=======
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))

export class InlineCompletionsController extends Disposable {
static ID = 'editor.contrib.inlineCompletionsController';
Expand All @@ -59,15 +56,11 @@ export class InlineCompletionsController extends Disposable {
});
}
));
<<<<<<< HEAD
private readonly _enabledInConfig = observableFromEvent(this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.inlineSuggest).enabled);
private readonly _isScreenReaderEnabled = observableFromEvent(this._accessibilityService.onDidChangeScreenReaderOptimized, () => this._accessibilityService.isScreenReaderOptimized());
private readonly _editorDictationInProgress = observableFromEvent(this._contextKeyService.onDidChangeContext, () => this._contextKeyService.getContext(this.editor.getDomNode()).getValue('editorDictation.inProgress') === true);
private readonly _enabled = derived(this, reader => this._enabledInConfig.read(reader) && (!this._isScreenReaderEnabled.read(reader) || !this._editorDictationInProgress.read(reader)));

=======
private readonly _enabled = observableFromEvent(this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.inlineSuggest).enabled);
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
private readonly _fontFamily = observableFromEvent(this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.inlineSuggest).fontFamily);

private readonly _ghostTexts = derived(this, (reader) => {
Expand Down Expand Up @@ -107,10 +100,7 @@ export class InlineCompletionsController extends Disposable {
@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,
@IAccessibilitySignalService private readonly _accessibilitySignalService: IAccessibilitySignalService,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
<<<<<<< HEAD
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,
=======
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
) {
super();

Expand Down Expand Up @@ -164,10 +154,6 @@ export class InlineCompletionsController extends Disposable {
this.updateObservables(tx, getReason(e))
)));

<<<<<<< HEAD

=======
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
this._register(editor.onDidChangeCursorPosition(e => transaction(tx => {
/** @description InlineCompletionsController.onDidChangeCursorPosition */
this.updateObservables(tx, VersionIdChangeReason.Other);
Expand Down Expand Up @@ -336,4 +322,4 @@ function convertItemsToStableObservables<T>(items: IObservable<readonly T[]>, st
}));

return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider<ITextSearch

return {
openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview,
preserveInput: searchConfig.experimental.quickAccess.preserveInput,
preserveInput: searchConfig.quickAccess.preserveInput,
maxResults: searchConfig.maxResults,
smartCase: searchConfig.smartCase,
};
Expand Down
58 changes: 35 additions & 23 deletions src/vs/workbench/contrib/search/browser/search.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import 'vs/workbench/contrib/search/browser/searchActionsSymbol';
import 'vs/workbench/contrib/search/browser/searchActionsTopBar';
import 'vs/workbench/contrib/search/browser/searchActionsTextQuickAccess';
import { TEXT_SEARCH_QUICK_ACCESS_PREFIX, TextSearchQuickAccess } from 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess';
import { Extensions, IConfigurationMigrationRegistry } from 'vs/workbench/common/configuration';

registerSingleton(ISearchViewModelWorkbenchService, SearchViewModelWorkbenchService, InstantiationType.Delayed);
registerSingleton(ISearchHistoryService, SearchHistoryService, InstantiationType.Delayed);
Expand Down Expand Up @@ -108,12 +109,12 @@ quickAccessRegistry.registerQuickAccessProvider({
ctor: TextSearchQuickAccess,
prefix: TEXT_SEARCH_QUICK_ACCESS_PREFIX,
contextKey: 'inTextSearchPicker',
placeholder: nls.localize('textSearchPickerPlaceholder', "Search for text in your workspace files (experimental)."),
placeholder: nls.localize('textSearchPickerPlaceholder', "Search for text in your workspace files."),
helpEntries: [
{
description: nls.localize('textSearchPickerHelp', "Search for Text (Experimental)"),
description: nls.localize('textSearchPickerHelp', "Search for Text"),
commandId: Constants.SearchCommandIds.QuickTextSearchActionId,
commandCenterOrder: 65,
commandCenterOrder: 25,
}
]
});
Expand Down Expand Up @@ -203,14 +204,14 @@ configurationRegistry.registerConfiguration({
default: true
},
'search.quickOpen.history.filterSortOrder': {
'type': 'string',
'enum': ['default', 'recency'],
'default': 'default',
'enumDescriptions': [
type: 'string',
enum: ['default', 'recency'],
default: 'default',
enumDescriptions: [
nls.localize('filterSortOrder.default', 'History entries are sorted by relevance based on the filter value used. More relevant entries appear first.'),
nls.localize('filterSortOrder.recency', 'History entries are sorted by recency. More recently opened entries appear first.')
],
'description': nls.localize('filterSortOrder', "Controls sorting order of editor history in quick open when filtering.")
description: nls.localize('filterSortOrder', "Controls sorting order of editor history in quick open when filtering.")
},
'search.followSymlinks': {
type: 'boolean',
Expand Down Expand Up @@ -329,18 +330,18 @@ configurationRegistry.registerConfiguration({
markdownDescription: nls.localize('search.searchEditor.defaultNumberOfContextLines', "The default number of surrounding context lines to use when creating new Search Editors. If using `#search.searchEditor.reusePriorSearchConfiguration#`, this can be set to `null` (empty) to use the prior Search Editor's configuration.")
},
'search.sortOrder': {
'type': 'string',
'enum': [SearchSortOrder.Default, SearchSortOrder.FileNames, SearchSortOrder.Type, SearchSortOrder.Modified, SearchSortOrder.CountDescending, SearchSortOrder.CountAscending],
'default': SearchSortOrder.Default,
'enumDescriptions': [
type: 'string',
enum: [SearchSortOrder.Default, SearchSortOrder.FileNames, SearchSortOrder.Type, SearchSortOrder.Modified, SearchSortOrder.CountDescending, SearchSortOrder.CountAscending],
default: SearchSortOrder.Default,
enumDescriptions: [
nls.localize('searchSortOrder.default', "Results are sorted by folder and file names, in alphabetical order."),
nls.localize('searchSortOrder.filesOnly', "Results are sorted by file names ignoring folder order, in alphabetical order."),
nls.localize('searchSortOrder.type', "Results are sorted by file extensions, in alphabetical order."),
nls.localize('searchSortOrder.modified', "Results are sorted by file last modified date, in descending order."),
nls.localize('searchSortOrder.countDescending', "Results are sorted by count per file, in descending order."),
nls.localize('searchSortOrder.countAscending', "Results are sorted by count per file, in ascending order.")
],
'description': nls.localize('search.sortOrder', "Controls sorting order of search results.")
description: nls.localize('search.sortOrder', "Controls sorting order of search results.")
},
'search.decorations.colors': {
type: 'boolean',
Expand All @@ -353,25 +354,26 @@ configurationRegistry.registerConfiguration({
default: true
},
'search.defaultViewMode': {
'type': 'string',
'enum': [ViewMode.Tree, ViewMode.List],
'default': ViewMode.List,
'enumDescriptions': [
type: 'string',
enum: [ViewMode.Tree, ViewMode.List],
default: ViewMode.List,
enumDescriptions: [
nls.localize('scm.defaultViewMode.tree', "Shows search results as a tree."),
nls.localize('scm.defaultViewMode.list', "Shows search results as a list.")
],
'description': nls.localize('search.defaultViewMode', "Controls the default search result view mode.")
description: nls.localize('search.defaultViewMode', "Controls the default search result view mode.")
},
'search.quickAccess.preserveInput': {
type: 'boolean',
description: nls.localize('search.quickAccess.preserveInput', "Controls whether the last typed input to Quick Search should be restored when opening it the next time."),
default: false
},
'search.experimental.closedNotebookRichContentResults': {
type: 'boolean',
description: nls.localize('search.experimental.closedNotebookResults', "Show notebook editor rich content results for closed notebooks. Please refresh your search results after changing this setting."),
default: false
},
'search.experimental.quickAccess.preserveInput': {
'type': 'boolean',
'description': nls.localize('search.experimental.quickAccess.preserveInput', "Controls whether the last typed input to Quick Search should be restored when opening it the next time."),
'default': false
},

}
});

Expand All @@ -381,3 +383,13 @@ CommandsRegistry.registerCommand('_executeWorkspaceSymbolProvider', async functi
const result = await getWorkspaceSymbols(query);
return result.map(item => item.symbol);
});

// todo: @andreamah get rid of this after a few iterations
Registry.as<IConfigurationMigrationRegistry>(Extensions.ConfigurationMigration)
.registerConfigurationMigrations([{
key: 'search.experimental.quickAccess.preserveInput',
migrateFn: (value, _accessor) => ([
['search.quickAccess.preserveInput', { value }],
['search.experimental.quickAccess.preserveInput', { value: undefined }]
])
}]);
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ registerAction2(class TextSearchQuickAccessAction extends Action2 {
) {
super({
id: Constants.SearchCommandIds.QuickTextSearchActionId,
title: nls.localize2('quickTextSearch', "Quick Search (Experimental)"),
title: nls.localize2('quickTextSearch', "Quick Search"),
category,
f1: true
});
Expand Down
40 changes: 21 additions & 19 deletions src/vs/workbench/contrib/search/browser/searchFindInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class SearchFindInput extends ContextScopedFindInput {
private _filterChecked: boolean = false;
private readonly _onDidChangeAIToggle = this._register(new Emitter<boolean>());
public readonly onDidChangeAIToggle = this._onDidChangeAIToggle.event;
private shouldNotebookFilterBeVisible: boolean = false; // followed, but overriden by the whether aiToggle is visible

constructor(
container: HTMLElement | null,
Expand Down Expand Up @@ -66,25 +67,30 @@ export class SearchFindInput extends ContextScopedFindInput {
this.sparkleVisible = shouldShowAIButton;

this._register(this._aiButton.onChange(() => {
if (this.regex) {
this.regex.visible = !this._aiButton.checked;
}
if (this.wholeWords) {
this.wholeWords.visible = !this._aiButton.checked;
}
if (this.caseSensitive) {
this.caseSensitive.visible = !this._aiButton.checked;
}
if (this._aiButton.checked) {
this.regex?.disable();
this.wholeWords?.disable();
this.caseSensitive?.disable();
this._findFilter.disable();
this._findFilter.visible = false;
} else {
this.regex?.enable();
this.wholeWords?.enable();
this.caseSensitive?.enable();
this._findFilter.enable();
this.filterVisible = this.shouldNotebookFilterBeVisible;
}
this._updatePadding();

}));
}

private _updatePadding() {
this.inputBox.paddingRight =
(this.caseSensitive?.width() ?? 0) +
(this.wholeWords?.width() ?? 0) +
(this.regex?.width() ?? 0) +
(this.caseSensitive?.visible ? this.caseSensitive.width() : 0) +
(this.wholeWords?.visible ? this.wholeWords.width() : 0) +
(this.regex?.visible ? this.regex.width() : 0) +
(this._findFilter.visible ? this._findFilter.width() : 0) +
(this._aiButton.visible ? this._aiButton.width() : 0);
}
Expand All @@ -95,6 +101,10 @@ export class SearchFindInput extends ContextScopedFindInput {
}

set filterVisible(visible: boolean) {
this.shouldNotebookFilterBeVisible = visible;
if (this._aiButton.visible && this._aiButton.checked) {
return;
}
this._findFilter.visible = visible;
this.updateFilterStyles();
this._updatePadding();
Expand Down Expand Up @@ -138,12 +148,4 @@ class AIToggle extends Toggle {
inputActiveOptionBackground: opts.inputActiveOptionBackground
});
}

set visible(visible: boolean) {
this.domNode.style.display = visible ? '' : 'none';
}

get visible() {
return this.domNode.style.display !== 'none';
}
}
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/search/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const enum SearchCommandIds {
RevealInSideBarForSearchResults = 'search.action.revealInSideBar',
ReplaceInFilesActionId = 'workbench.action.replaceInFiles',
ShowAllSymbolsActionId = 'workbench.action.showAllSymbols',
QuickTextSearchActionId = 'workbench.action.experimental.quickTextSearch',
QuickTextSearchActionId = 'workbench.action.quickTextSearch',
CancelSearchActionId = 'search.action.cancel',
RefreshSearchResultsActionId = 'search.action.refreshSearchResults',
FocusNextSearchResultActionId = 'search.action.focusNextSearchResult',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ import { IStorageService, StorageScope, StorageTarget, WillSaveStateReason } fro
import { ITelemetryService, TelemetryLevel, firstSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry';
import { getTelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils';
import { defaultButtonStyles, defaultToggleStyles } from 'vs/platform/theme/browser/defaultStyles';
<<<<<<< HEAD
=======
import { IThemeService } from 'vs/platform/theme/common/themeService';
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
import { IWindowOpenable } from 'vs/platform/window/common/window';
import { IWorkspaceContextService, UNKNOWN_EMPTY_WINDOW_WORKSPACE } from 'vs/platform/workspace/common/workspace';
import { IRecentFolder, IRecentWorkspace, IRecentlyOpened, IWorkspacesService, isRecentFolder, isRecentWorkspace } from 'vs/platform/workspaces/common/workspaces';
Expand All @@ -71,11 +67,7 @@ import { startEntries } from 'vs/workbench/contrib/welcomeGettingStarted/common/
import { GroupDirection, GroupsOrder, IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IHostService } from 'vs/workbench/services/host/browser/host';
<<<<<<< HEAD
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
=======
import { ThemeSettings } from 'vs/workbench/services/themes/common/workbenchThemeService';
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
import { GettingStartedIndexList } from './gettingStartedList';
import { IWorkbenchAssignmentService } from 'vs/workbench/services/assignment/common/assignmentService';

Expand Down Expand Up @@ -182,11 +174,7 @@ export class GettingStartedPage extends EditorPane {
@ILanguageService private readonly languageService: ILanguageService,
@IFileService private readonly fileService: IFileService,
@IOpenerService private readonly openerService: IOpenerService,
<<<<<<< HEAD
@IWorkbenchThemeService public override readonly themeService: IWorkbenchThemeService,
=======
@IThemeService themeService: IThemeService,
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
@IWorkbenchThemeService protected override readonly themeService: IWorkbenchThemeService,
@IStorageService private storageService: IStorageService,
@IExtensionService private readonly extensionService: IExtensionService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
Expand Down Expand Up @@ -701,24 +689,16 @@ export class GettingStartedPage extends EditorPane {

postTrueKeysMessage();

<<<<<<< HEAD
this.stepDisposables.add(this.webview.onMessage(async e => {
=======
this.stepDisposables.add(this.webview.onMessage(e => {
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
const message: string = e.message as string;
if (message.startsWith('command:')) {
this.openerService.open(message, { allowCommands: true });
} else if (message.startsWith('setTheme:')) {
<<<<<<< HEAD
const themeId = message.slice('setTheme:'.length);
const theme = (await this.themeService.getColorThemes()).find(theme => theme.settingsId === themeId);
if (theme) {
this.themeService.setColorTheme(theme.id, ConfigurationTarget.USER);
}
=======
this.configurationService.updateValue(ThemeSettings.COLOR_THEME, message.slice('setTheme:'.length), ConfigurationTarget.USER);
>>>>>>> d446edf5c56 (Pick up latest TS for building VSCode (#209881))
} else {
console.error('Unexpected message', message);
}
Expand Down Expand Up @@ -1705,4 +1685,4 @@ export class GettingStartedInputSerializer implements IEditorSerializer {
} catch { }
return new GettingStartedInput({});
}
}
}
6 changes: 3 additions & 3 deletions src/vs/workbench/services/search/common/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,12 @@ export interface ISearchConfigurationProperties {
colors: boolean;
badges: boolean;
};
quickAccess: {
preserveInput: boolean;
};
defaultViewMode: ViewMode;
experimental: {
closedNotebookRichContentResults: boolean;
quickAccess: {
preserveInput: boolean;
};
};
}

Expand Down

0 comments on commit d44d63d

Please sign in to comment.