Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)

* Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d

* Fix vs unit tests and hygiene issue

* Fix strict null check issue
This commit is contained in:
Chris LaFreniere
2019-06-10 18:27:09 -07:00
committed by GitHub
parent ff38bc8143
commit d15a3fcc98
926 changed files with 19529 additions and 11383 deletions

View File

@@ -33,8 +33,8 @@ import { FileChangesEvent, FileChangeType, IFileService } from 'vs/platform/file
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { TreeResourceNavigator2, WorkbenchObjectTree, getSelectionKeyboardEvent } from 'vs/platform/list/browser/listService';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IPatternInfo, ISearchComplete, ISearchConfiguration, ISearchConfigurationProperties, ITextQuery, SearchErrorCode, VIEW_ID } from 'vs/workbench/services/search/common/search';
import { ILocalProgressService, IProgressService } from 'vs/platform/progress/common/progress';
import { IPatternInfo, ISearchComplete, ISearchConfiguration, ISearchConfigurationProperties, ITextQuery, SearchErrorCode, VIEW_ID, VIEWLET_ID } from 'vs/workbench/services/search/common/search';
import { ISearchHistoryService, ISearchHistoryValues } from 'vs/workbench/contrib/search/common/searchHistoryService';
import { diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, editorFindMatchHighlight, editorFindMatchHighlightBorder, listActiveSelectionForeground } from 'vs/platform/theme/common/colorRegistry';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
@@ -59,7 +59,7 @@ import { relativePath } from 'vs/base/common/resources';
import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { Memento } from 'vs/workbench/common/memento';
import { Memento, MementoObject } from 'vs/workbench/common/memento';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
const $ = dom.$;
@@ -102,8 +102,8 @@ export class SearchView extends ViewletPanel {
private tree: WorkbenchObjectTree<RenderableMatch>;
private treeLabels: ResourceLabels;
private viewletState: object;
private globalMemento: object;
private viewletState: MementoObject;
private globalMemento: MementoObject;
private messagesElement: HTMLElement;
private messageDisposables: IDisposable[] = [];
private searchWidgetsContainerElement: HTMLElement;
@@ -129,6 +129,7 @@ export class SearchView extends ViewletPanel {
options: IViewletPanelOptions,
@IFileService private readonly fileService: IFileService,
@IEditorService private readonly editorService: IEditorService,
@ILocalProgressService private readonly localProgressService: ILocalProgressService,
@IProgressService private readonly progressService: IProgressService,
@INotificationService private readonly notificationService: INotificationService,
@IDialogService private readonly dialogService: IDialogService,
@@ -517,7 +518,7 @@ export class SearchView extends ViewletPanel {
return;
}
const progressRunner = this.progressService.show(100);
const progressRunner = this.localProgressService.show(100);
const occurrences = this.viewModel.searchResult.count();
const fileCount = this.viewModel.searchResult.fileCount();
@@ -1193,7 +1194,7 @@ export class SearchView extends ViewletPanel {
const options: ITextQueryBuilderOptions = {
_reason: 'searchView',
extraFileResources: getOutOfWorkspaceEditorResources(this.editorService, this.contextService),
extraFileResources: this.instantiationService.invokeFunction(getOutOfWorkspaceEditorResources),
maxResults: SearchView.MAX_TEXT_RESULTS,
disregardIgnoreFiles: !useExcludesAndIgnoreFiles || undefined,
disregardExcludeSettings: !useExcludesAndIgnoreFiles || undefined,
@@ -1265,7 +1266,10 @@ export class SearchView extends ViewletPanel {
}
private doSearch(query: ITextQuery, options: ITextQueryBuilderOptions, excludePatternText: string, includePatternText: string): Thenable<void> {
const progressRunner = this.progressService.show(/*infinite=*/true);
let progressComplete: () => void;
this.progressService.withProgress({ location: VIEWLET_ID }, _progress => {
return new Promise(resolve => progressComplete = resolve);
});
this.searchWidget.searchInput.clearMessage();
this.searching = true;
@@ -1280,7 +1284,7 @@ export class SearchView extends ViewletPanel {
this.searching = false;
// Complete up to 100% as needed
progressRunner.done();
progressComplete();
// Do final render, then expand if just 1 file with less than 50 matches
this.onSearchResultsChanged();
@@ -1375,7 +1379,7 @@ export class SearchView extends ViewletPanel {
} else {
this.searching = false;
this.updateActions();
progressRunner.done();
progressComplete();
this.searchWidget.searchInput.showMessage({ content: e.message, type: MessageType.ERROR });
this.viewModel.searchResult.clear();
@@ -1507,7 +1511,7 @@ export class SearchView extends ViewletPanel {
this.searchWithoutFolderMessageElement = this.clearMessage();
const textEl = dom.append(this.searchWithoutFolderMessageElement,
$('p', undefined, nls.localize('searchWithoutFolder', "You have not yet opened a folder. Only open files are currently searched - ")));
$('p', undefined, nls.localize('searchWithoutFolder', "You have not opened or specified a folder. Only open files are currently searched - ")));
const openFolderLink = dom.append(textEl,
$('a.pointer.prominent', { tabindex: 0 }, nls.localize('openFolder', "Open Folder")));
@@ -1695,21 +1699,9 @@ export class SearchView extends ViewletPanel {
super.saveState();
}
private _toDispose: IDisposable[] = [];
protected _register<T extends IDisposable>(t: T): T {
if (this.isDisposed) {
console.warn('Registering disposable on object that has already been disposed.');
t.dispose();
} else {
this._toDispose.push(t);
}
return t;
}
dispose(): void {
this.isDisposed = true;
this.saveState();
this._toDispose = dispose(this._toDispose);
super.dispose();
}
}