mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
search - update description of search.exclude
and add test for history (#208370)
This commit is contained in:
parent
2bb40a25d1
commit
16997b315c
|
@ -128,7 +128,7 @@ configurationRegistry.registerConfiguration({
|
|||
properties: {
|
||||
[SEARCH_EXCLUDE_CONFIG]: {
|
||||
type: 'object',
|
||||
markdownDescription: nls.localize('exclude', "Configure [glob patterns](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options) for excluding files and folders in fulltext searches and quick open. Inherits all glob patterns from the `#files.exclude#` setting."),
|
||||
markdownDescription: nls.localize('exclude', "Configure [glob patterns](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options) for excluding files and folders in fulltext searches and file search in quick open. To exclude files from the recently opened list in quick open, patterns must be absolute (for example `**/node_modules/**`). Inherits all glob patterns from the `#files.exclude#` setting."),
|
||||
default: { '**/node_modules': true, '**/bower_components': true, '**/*.code-search': true },
|
||||
additionalProperties: {
|
||||
anyOf: [
|
||||
|
|
|
@ -34,7 +34,7 @@ suite('HistoryService', function () {
|
|||
const TEST_EDITOR_ID = 'MyTestEditorForEditorHistory';
|
||||
const TEST_EDITOR_INPUT_ID = 'testEditorInputForHistoyService';
|
||||
|
||||
async function createServices(scope = GoScope.DEFAULT): Promise<[EditorPart, HistoryService, EditorService, ITextFileService, IInstantiationService]> {
|
||||
async function createServices(scope = GoScope.DEFAULT): Promise<[EditorPart, HistoryService, EditorService, ITextFileService, IInstantiationService, TestConfigurationService]> {
|
||||
const instantiationService = workbenchInstantiationService(undefined, disposables);
|
||||
|
||||
const part = await createEditorPart(instantiationService, disposables);
|
||||
|
@ -56,7 +56,7 @@ suite('HistoryService', function () {
|
|||
|
||||
const accessor = instantiationService.createInstance(TestServiceAccessor);
|
||||
|
||||
return [part, historyService, editorService, accessor.textFileService, instantiationService];
|
||||
return [part, historyService, editorService, accessor.textFileService, instantiationService, configurationService];
|
||||
}
|
||||
|
||||
const disposables = new DisposableStore();
|
||||
|
@ -660,12 +660,13 @@ suite('HistoryService', function () {
|
|||
}
|
||||
}
|
||||
|
||||
const [part, historyService, , , instantiationService] = await createServices();
|
||||
const [part, historyService, , , instantiationService, configurationService] = await createServices();
|
||||
configurationService.setUserConfiguration('search.exclude', '{ "**/node_modules/**": true }');
|
||||
|
||||
let history = historyService.getHistory();
|
||||
assert.strictEqual(history.length, 0);
|
||||
|
||||
const input1 = disposables.add(new TestFileEditorInput(URI.parse('foo://bar1'), TEST_EDITOR_INPUT_ID));
|
||||
const input1 = disposables.add(new TestFileEditorInput(URI.parse('foo://bar1/node_modules/test.txt'), TEST_EDITOR_INPUT_ID));
|
||||
await part.activeGroup.openEditor(input1, { pinned: true });
|
||||
|
||||
const input2 = disposables.add(new TestFileEditorInput(URI.parse('foo://bar2'), TEST_EDITOR_INPUT_ID));
|
||||
|
@ -693,6 +694,10 @@ suite('HistoryService', function () {
|
|||
assert.strictEqual(history.length, 3);
|
||||
assert.strictEqual(history[0].resource?.toString(), input4.resource.toString());
|
||||
|
||||
input1.dispose(); // disposing the editor will apply `search.exclude` rules
|
||||
history = historyService.getHistory();
|
||||
assert.strictEqual(history.length, 2);
|
||||
|
||||
return workbenchTeardown(instantiationService);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue