未验证 提交 f29b61dd 编写于 作者: J Jakub Trąd 提交者: GitHub

Add property default show context value proeprty (#97920)

* Add property default show context value proeprty

* Change precedence

defaultShowContextValue takes precedence
over
reusePriorSearchConfiguration

* Respect 0 as a default context lines value
Co-authored-by: NJackson Kearl <jakearl@microsoft.com>
上级 113fd1b7
......@@ -831,6 +831,10 @@ configurationRegistry.registerConfiguration({
default: false,
markdownDescription: nls.localize('search.searchEditor.reusePriorSearchConfiguration', "When enabled, new Search Editors will reuse the includes, excludes, and flags of the previously opened Search Editor")
},
'search.searchEditor.defaultShowContextValue': {
type: ['number', 'null'],
default: null,
},
'search.sortOrder': {
'type': 'string',
'enum': [SearchSortOrder.Default, SearchSortOrder.FileNames, SearchSortOrder.Type, SearchSortOrder.Modified, SearchSortOrder.CountDescending, SearchSortOrder.CountAscending],
......
......@@ -304,11 +304,20 @@ export const getOrMakeSearchEditorInput = (
const storageService = accessor.get(IStorageService);
const configurationService = accessor.get(IConfigurationService);
const reuseOldSettings = configurationService.getValue<ISearchConfigurationProperties>('search').searchEditor?.reusePriorSearchConfiguration;
const searchEditorSettings = configurationService.getValue<ISearchConfigurationProperties>('search').searchEditor;
const reuseOldSettings = searchEditorSettings?.reusePriorSearchConfiguration;
const defaultShowContextValue = searchEditorSettings?.defaultShowContextValue;
const priorConfig: SearchConfiguration = reuseOldSettings ? new Memento(SearchEditorInput.ID, storageService).getMemento(StorageScope.WORKSPACE).searchConfig : {};
const defaultConfig = defaultSearchConfig();
let config = { ...defaultConfig, ...priorConfig, ...existingData.config };
if (defaultShowContextValue !== null && defaultShowContextValue !== undefined) {
config.contextLines = defaultShowContextValue;
}
const modelUri = existingData.modelUri ?? URI.from({ scheme: SearchEditorScheme, fragment: `${Math.random()}` });
const cacheKey = existingData.backingUri?.toString() ?? modelUri.toString();
......
......@@ -350,6 +350,7 @@ export interface ISearchConfigurationProperties {
searchEditor: {
doubleClickBehaviour: 'selectWord' | 'goToLocation' | 'openLocationToSide',
reusePriorSearchConfiguration: boolean,
defaultShowContextValue: number | null,
experimental: {}
};
sortOrder: SearchSortOrder;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册