Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3 (#6516)

* Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3

* fix tests
This commit is contained in:
Anthony Dresser
2019-07-28 15:15:24 -07:00
committed by GitHub
parent aacf1e7f1c
commit 1d56a17f32
292 changed files with 19784 additions and 1873 deletions

View File

@@ -1,3 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.5 8.25C22.5 11.9779 19.4779 15 15.75 15C12.0221 15 9 11.9779 9 8.25C9 4.52208 12.0221 1.5 15.75 1.5C19.4779 1.5 22.5 4.52208 22.5 8.25ZM24 8.25C24 12.8063 20.3063 16.5 15.75 16.5C13.8323 16.5 12.0674 15.8457 10.6664 14.7481L2.62509 23.8677L1.5 22.8756L9.57353 13.7195C8.28334 12.2636 7.5 10.3483 7.5 8.25C7.5 3.69365 11.1937 0 15.75 0C20.3063 0 24 3.69365 24 8.25Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 8.25C22 11.9779 18.9779 15 15.25 15C11.5221 15 8.5 11.9779 8.5 8.25C8.5 4.52208 11.5221 1.5 15.25 1.5C18.9779 1.5 22 4.52208 22 8.25ZM23.5 8.25C23.5 12.8063 19.8063 16.5 15.25 16.5C13.3323 16.5 11.5674 15.8457 10.1664 14.7481L2.12509 23.8677L1 22.8756L9.07353 13.7195C7.78334 12.2636 7 10.3483 7 8.25C7 3.69365 10.6937 0 15.25 0C19.8063 0 23.5 3.69365 23.5 8.25Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 535 B

View File

@@ -67,7 +67,7 @@ class ReplacePreviewModel extends Disposable {
resolve(replacePreviewUri: URI): Promise<ITextModel> {
const fileResource = toFileResource(replacePreviewUri);
const fileMatch = <FileMatch>this.searchWorkbenchService.searchModel.searchResult.matches().filter(match => match.resource().toString() === fileResource.toString())[0];
const fileMatch = <FileMatch>this.searchWorkbenchService.searchModel.searchResult.matches().filter(match => match.resource.toString() === fileResource.toString())[0];
return this.textModelResolverService.createModelReference(fileResource).then(ref => {
ref = this._register(ref);
const sourceModel = ref.object.textEditorModel;
@@ -112,8 +112,8 @@ export class ReplaceService implements IReplaceService {
const fileMatch = element instanceof Match ? element.parent() : element;
return this.editorService.openEditor({
leftResource: fileMatch.resource(),
rightResource: toReplaceResource(fileMatch.resource()),
leftResource: fileMatch.resource,
rightResource: toReplaceResource(fileMatch.resource),
label: nls.localize('fileReplaceChanges', "{0} ↔ {1} (Replace Preview)", fileMatch.name(), fileMatch.name()),
options: {
preserveFocus,
@@ -139,8 +139,8 @@ export class ReplaceService implements IReplaceService {
}
updateReplacePreview(fileMatch: FileMatch, override: boolean = false): Promise<void> {
const replacePreviewUri = toReplaceResource(fileMatch.resource());
return Promise.all([this.textModelResolverService.createModelReference(fileMatch.resource()), this.textModelResolverService.createModelReference(replacePreviewUri)])
const replacePreviewUri = toReplaceResource(fileMatch.resource);
return Promise.all([this.textModelResolverService.createModelReference(fileMatch.resource), this.textModelResolverService.createModelReference(replacePreviewUri)])
.then(([sourceModelRef, replaceModelRef]) => {
const sourceModel = sourceModelRef.object.textEditorModel;
const replaceModel = replaceModelRef.object.textEditorModel;
@@ -200,7 +200,7 @@ export class ReplaceService implements IReplaceService {
private createEdit(match: Match, text: string, resource: URI | null = null): ResourceTextEdit {
const fileMatch: FileMatch = match.parent();
const resourceEdit: ResourceTextEdit = {
resource: resource !== null ? resource : fileMatch.resource(),
resource: resource !== null ? resource : fileMatch.resource,
edits: [{
range: match.range(),
text: text

View File

@@ -219,7 +219,7 @@ CommandsRegistry.registerCommand({
const viewletService = accessor.get(IViewletService);
const explorerService = accessor.get(IExplorerService);
const contextService = accessor.get(IWorkspaceContextService);
const uri = fileMatch.resource();
const uri = fileMatch.resource;
viewletService.openViewlet(VIEWLET_ID_FILES, false).then((viewlet: ExplorerViewlet) => {
if (uri && contextService.isInsideWorkspace(uri)) {

View File

@@ -654,14 +654,14 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction {
}
private hasSameParent(element: RenderableMatch): boolean {
return element && element instanceof Match && element.parent().resource() === this.element.parent().resource();
return element && element instanceof Match && element.parent().resource === this.element.parent().resource;
}
private hasToOpenFile(): boolean {
const activeEditor = this.editorService.activeEditor;
const file = activeEditor ? activeEditor.getResource() : undefined;
if (file) {
return file.toString() === this.element.parent().resource().toString();
return file.toString() === this.element.parent().resource.toString();
}
return false;
}
@@ -674,7 +674,7 @@ function uriToClipboardString(resource: URI): string {
export const copyPathCommand: ICommandHandler = async (accessor, fileMatch: FileMatch | FolderMatch) => {
const clipboardService = accessor.get(IClipboardService);
const text = uriToClipboardString(fileMatch.resource());
const text = uriToClipboardString(fileMatch.resource);
await clipboardService.writeText(text);
};
@@ -712,7 +712,7 @@ function fileMatchToString(fileMatch: FileMatch, maxMatches: number): { text: st
.slice(0, maxMatches)
.map(match => matchToString(match, 2));
return {
text: `${uriToClipboardString(fileMatch.resource())}${lineDelimiter}${matchTextRows.join(lineDelimiter)}`,
text: `${uriToClipboardString(fileMatch.resource)}${lineDelimiter}${matchTextRows.join(lineDelimiter)}`,
count: matchTextRows.length
};
}

View File

@@ -115,11 +115,11 @@ export class FolderMatchRenderer extends Disposable implements ITreeRenderer<Fol
renderElement(node: ITreeNode<FolderMatch, any>, index: number, templateData: IFolderMatchTemplate): void {
const folderMatch = node.element;
if (folderMatch.hasResource()) {
const workspaceFolder = this.contextService.getWorkspaceFolder(folderMatch.resource());
if (workspaceFolder && resources.isEqual(workspaceFolder.uri, folderMatch.resource())) {
templateData.label.setFile(folderMatch.resource(), { fileKind: FileKind.ROOT_FOLDER, hidePath: true });
const workspaceFolder = this.contextService.getWorkspaceFolder(folderMatch.resource);
if (workspaceFolder && resources.isEqual(workspaceFolder.uri, folderMatch.resource)) {
templateData.label.setFile(folderMatch.resource, { fileKind: FileKind.ROOT_FOLDER, hidePath: true });
} else {
templateData.label.setFile(folderMatch.resource(), { fileKind: FileKind.FOLDER });
templateData.label.setFile(folderMatch.resource, { fileKind: FileKind.FOLDER });
}
} else {
templateData.label.setLabel(nls.localize('searchFolderMatch.other.label', "Other files"));
@@ -185,8 +185,8 @@ export class FileMatchRenderer extends Disposable implements ITreeRenderer<FileM
renderElement(node: ITreeNode<FileMatch, any>, index: number, templateData: IFileMatchTemplate): void {
const fileMatch = node.element;
templateData.el.setAttribute('data-resource', fileMatch.resource().toString());
templateData.label.setFile(fileMatch.resource(), { hideIcon: false });
templateData.el.setAttribute('data-resource', fileMatch.resource.toString());
templateData.label.setFile(fileMatch.resource, { hideIcon: false });
const count = fileMatch.count();
templateData.badge.setCount(count);
templateData.badge.setTitleFormat(count > 1 ? nls.localize('searchMatches', "{0} matches found", count) : nls.localize('searchMatch', "{0} match found", count));
@@ -316,7 +316,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider<Rende
}
if (element instanceof FileMatch) {
const path = this.labelService.getUriLabel(element.resource(), { relative: true }) || element.resource().fsPath;
const path = this.labelService.getUriLabel(element.resource, { relative: true }) || element.resource.fsPath;
return nls.localize('fileMatchAriaLabel', "{0} matches in file {1} of folder {2}, Search result", element.count(), element.name(), paths.dirname(path));
}
@@ -362,7 +362,7 @@ export class SearchDND implements ITreeDragAndDrop<RenderableMatch> {
const element = elements[0];
return element instanceof FileMatch ?
resources.basename(element.resource()) :
resources.basename(element.resource) :
undefined;
}
@@ -370,7 +370,7 @@ export class SearchDND implements ITreeDragAndDrop<RenderableMatch> {
const elements = (data as ElementsDragAndDropData<RenderableMatch>).elements;
const resources: URI[] = elements
.filter(e => e instanceof FileMatch)
.map((fm: FileMatch) => fm.resource());
.map((fm: FileMatch) => fm.resource);
if (resources.length) {
// Apply some datatransfer types to allow for dragging the element outside of the application

View File

@@ -633,7 +633,7 @@ export class SearchView extends ViewletPanel {
};
this.treeLabels = this._register(this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility }));
this.tree = this._register(<WorkbenchObjectTree<RenderableMatch, any>>this.instantiationService.createInstance(WorkbenchObjectTree,
this.tree = this._register(this.instantiationService.createInstance(WorkbenchObjectTree,
this.resultsElement,
delegate,
[
@@ -896,13 +896,13 @@ export class SearchView extends ViewletPanel {
0 :
dom.getTotalHeight(this.messagesElement);
const searchResultContainerSize = this.size.height -
const searchResultContainerHeight = this.size.height -
messagesSize -
dom.getTotalHeight(this.searchWidgetsContainerElement);
this.resultsElement.style.height = searchResultContainerSize + 'px';
this.resultsElement.style.height = searchResultContainerHeight + 'px';
this.tree.layout(searchResultContainerSize, this.size.width);
this.tree.layout(searchResultContainerHeight, this.size.width);
}
protected layoutBody(height: number, width: number): void {
@@ -1542,7 +1542,7 @@ export class SearchView extends ViewletPanel {
open(element: FileMatchOrMatch, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise<void> {
const selection = this.getSelectionFrom(element);
const resource = element instanceof Match ? element.parent().resource() : (<FileMatch>element).resource();
const resource = element instanceof Match ? element.parent().resource : (<FileMatch>element).resource;
return this.editorService.openEditor({
resource: resource,
options: {
@@ -1600,7 +1600,7 @@ export class SearchView extends ViewletPanel {
if (!this.untitledEditorService.isDirty(resource)) {
const matches = this.viewModel.searchResult.matches();
for (let i = 0, len = matches.length; i < len; i++) {
if (resource.toString() === matches[i].resource().toString()) {
if (resource.toString() === matches[i].resource.toString()) {
this.viewModel.searchResult.remove(matches[i]);
}
}
@@ -1614,11 +1614,8 @@ export class SearchView extends ViewletPanel {
const matches = this.viewModel.searchResult.matches();
for (let i = 0, len = matches.length; i < len; i++) {
if (e.contains(matches[i].resource(), FileChangeType.DELETED)) {
this.viewModel.searchResult.remove(matches[i]);
}
}
const changedMatches = matches.filter(m => e.contains(m.resource, FileChangeType.DELETED));
this.viewModel.searchResult.remove(changedMatches);
}
getActions(): IAction[] {