未验证 提交 14140d2a 编写于 作者: A Alex Dima

Revert "Merge pull request #109049 from digeff/searchView/context/extensionPoints"

This reverts commit a1bb5ac2, reversing
changes made to 9a08a107.
上级 31c03460
...@@ -62,7 +62,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation ...@@ -62,7 +62,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import { IExtHostDecorations } from 'vs/workbench/api/common/extHostDecorations'; import { IExtHostDecorations } from 'vs/workbench/api/common/extHostDecorations';
import { IExtHostTask } from 'vs/workbench/api/common/extHostTask'; import { IExtHostTask } from 'vs/workbench/api/common/extHostTask';
import { IExtHostDebugService } from 'vs/workbench/api/common/extHostDebugService'; import { IExtHostDebugService } from 'vs/workbench/api/common/extHostDebugService';
import { ExtHostSearch } from 'vs/workbench/api/common/extHostSearch'; import { IExtHostSearch } from 'vs/workbench/api/common/extHostSearch';
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService'; import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
...@@ -123,11 +123,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I ...@@ -123,11 +123,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostCommands = rpcProtocol.set(ExtHostContext.ExtHostCommands, accessor.get(IExtHostCommands)); const extHostCommands = rpcProtocol.set(ExtHostContext.ExtHostCommands, accessor.get(IExtHostCommands));
const extHostTerminalService = rpcProtocol.set(ExtHostContext.ExtHostTerminalService, accessor.get(IExtHostTerminalService)); const extHostTerminalService = rpcProtocol.set(ExtHostContext.ExtHostTerminalService, accessor.get(IExtHostTerminalService));
const extHostDebugService = rpcProtocol.set(ExtHostContext.ExtHostDebugService, accessor.get(IExtHostDebugService)); const extHostDebugService = rpcProtocol.set(ExtHostContext.ExtHostDebugService, accessor.get(IExtHostDebugService));
const extHostSearch = rpcProtocol.set(ExtHostContext.ExtHostSearch, accessor.get(IExtHostSearch));
const extHostTask = rpcProtocol.set(ExtHostContext.ExtHostTask, accessor.get(IExtHostTask)); const extHostTask = rpcProtocol.set(ExtHostContext.ExtHostTask, accessor.get(IExtHostTask));
const extHostOutputService = rpcProtocol.set(ExtHostContext.ExtHostOutputService, accessor.get(IExtHostOutputService)); const extHostOutputService = rpcProtocol.set(ExtHostContext.ExtHostOutputService, accessor.get(IExtHostOutputService));
// manually create and register addressable instances // manually create and register addressable instances
const extHostSearch = rpcProtocol.set(ExtHostContext.ExtHostSearch, new ExtHostSearch(rpcProtocol, uriTransformer, extHostLogService, extHostCommands));
const extHostUrls = rpcProtocol.set(ExtHostContext.ExtHostUrls, new ExtHostUrls(rpcProtocol)); const extHostUrls = rpcProtocol.set(ExtHostContext.ExtHostUrls, new ExtHostUrls(rpcProtocol));
const extHostDocuments = rpcProtocol.set(ExtHostContext.ExtHostDocuments, new ExtHostDocuments(rpcProtocol, extHostDocumentsAndEditors)); const extHostDocuments = rpcProtocol.set(ExtHostContext.ExtHostDocuments, new ExtHostDocuments(rpcProtocol, extHostDocumentsAndEditors));
const extHostDocumentContentProviders = rpcProtocol.set(ExtHostContext.ExtHostDocumentContentProviders, new ExtHostDocumentContentProvider(rpcProtocol, extHostDocumentsAndEditors, extHostLogService)); const extHostDocumentContentProviders = rpcProtocol.set(ExtHostContext.ExtHostDocumentContentProviders, new ExtHostDocumentContentProvider(rpcProtocol, extHostDocumentsAndEditors, extHostLogService));
......
...@@ -14,7 +14,6 @@ import { ILogService } from 'vs/platform/log/common/log'; ...@@ -14,7 +14,6 @@ import { ILogService } from 'vs/platform/log/common/log';
import { IRawFileQuery, ISearchCompleteStats, IFileQuery, IRawTextQuery, IRawQuery, ITextQuery, IFolderQuery } from 'vs/workbench/services/search/common/search'; import { IRawFileQuery, ISearchCompleteStats, IFileQuery, IRawTextQuery, IRawQuery, ITextQuery, IFolderQuery } from 'vs/workbench/services/search/common/search';
import { URI, UriComponents } from 'vs/base/common/uri'; import { URI, UriComponents } from 'vs/base/common/uri';
import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager'; import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager';
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
export interface IExtHostSearch extends ExtHostSearchShape { export interface IExtHostSearch extends ExtHostSearchShape {
registerTextSearchProvider(scheme: string, provider: vscode.TextSearchProvider): IDisposable; registerTextSearchProvider(scheme: string, provider: vscode.TextSearchProvider): IDisposable;
...@@ -38,27 +37,8 @@ export class ExtHostSearch implements ExtHostSearchShape { ...@@ -38,27 +37,8 @@ export class ExtHostSearch implements ExtHostSearchShape {
constructor( constructor(
@IExtHostRpcService private extHostRpc: IExtHostRpcService, @IExtHostRpcService private extHostRpc: IExtHostRpcService,
@IURITransformerService protected _uriTransformer: IURITransformerService, @IURITransformerService protected _uriTransformer: IURITransformerService,
@ILogService protected _logService: ILogService, @ILogService protected _logService: ILogService
commands: ExtHostCommands, ) { }
) {
commands.registerArgumentProcessor({
processArgument: arg => {
if (arg && Array.isArray(arg)) {
return arg.map(matchContext => {
if (matchContext.$mid === 13 /* SearchViewContextMid */) {
const filteredProperties = { ...matchContext };
delete filteredProperties.renderableMatch;
return filteredProperties;
} else {
return matchContext;
}
});
} else {
return arg;
}
}
});
}
protected _transformScheme(scheme: string): string { protected _transformScheme(scheme: string): string {
return this._uriTransformer.transformOutgoingScheme(scheme); return this._uriTransformer.transformOutgoingScheme(scheme);
......
...@@ -176,11 +176,6 @@ const apiMenus: IAPIMenu[] = [ ...@@ -176,11 +176,6 @@ const apiMenus: IAPIMenu[] = [
id: MenuId.TimelineItemContext, id: MenuId.TimelineItemContext,
description: localize('view.timelineContext', "The Timeline view item context menu") description: localize('view.timelineContext', "The Timeline view item context menu")
}, },
{
key: 'search/context',
id: MenuId.SearchContext,
description: localize('menus.searchContext', "The search context menu")
},
]; ];
namespace schema { namespace schema {
......
...@@ -19,7 +19,6 @@ import { ExtHostSearch, reviveQuery } from 'vs/workbench/api/common/extHostSearc ...@@ -19,7 +19,6 @@ import { ExtHostSearch, reviveQuery } from 'vs/workbench/api/common/extHostSearc
import { Schemas } from 'vs/base/common/network'; import { Schemas } from 'vs/base/common/network';
import { NativeTextSearchManager } from 'vs/workbench/services/search/node/textSearchManager'; import { NativeTextSearchManager } from 'vs/workbench/services/search/node/textSearchManager';
import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager'; import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager';
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
export class NativeExtHostSearch extends ExtHostSearch { export class NativeExtHostSearch extends ExtHostSearch {
...@@ -33,9 +32,8 @@ export class NativeExtHostSearch extends ExtHostSearch { ...@@ -33,9 +32,8 @@ export class NativeExtHostSearch extends ExtHostSearch {
@IExtHostInitDataService initData: IExtHostInitDataService, @IExtHostInitDataService initData: IExtHostInitDataService,
@IURITransformerService _uriTransformer: IURITransformerService, @IURITransformerService _uriTransformer: IURITransformerService,
@ILogService _logService: ILogService, @ILogService _logService: ILogService,
commands: ExtHostCommands,
) { ) {
super(extHostRpc, _uriTransformer, _logService, commands); super(extHostRpc, _uriTransformer, _logService);
if (initData.remote.isRemote && initData.remote.authority) { if (initData.remote.isRemote && initData.remote.authority) {
this._registerEHSearchProviders(); this._registerEHSearchProviders();
......
...@@ -15,7 +15,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur ...@@ -15,7 +15,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { getSelectionKeyboardEvent, WorkbenchObjectTree } from 'vs/platform/list/browser/listService'; import { getSelectionKeyboardEvent, WorkbenchObjectTree } from 'vs/platform/list/browser/listService';
import { IFileMatchContext, IFolderMatchWithResourceContext, IRenderableMatchContext, SearchView } from 'vs/workbench/contrib/search/browser/searchView'; import { SearchView } from 'vs/workbench/contrib/search/browser/searchView';
import * as Constants from 'vs/workbench/contrib/search/common/constants'; import * as Constants from 'vs/workbench/contrib/search/common/constants';
import { IReplaceService } from 'vs/workbench/contrib/search/common/replace'; import { IReplaceService } from 'vs/workbench/contrib/search/common/replace';
import { FolderMatch, FileMatch, FolderMatchWithResource, Match, RenderableMatch, searchMatchComparer, SearchResult } from 'vs/workbench/contrib/search/common/searchModel'; import { FolderMatch, FileMatch, FolderMatchWithResource, Match, RenderableMatch, searchMatchComparer, SearchResult } from 'vs/workbench/contrib/search/common/searchModel';
...@@ -776,8 +776,7 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction { ...@@ -776,8 +776,7 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction {
} }
} }
export const copyPathCommand: ICommandHandler = async (accessor, fileMatchArg: [IFileMatchContext | IFolderMatchWithResourceContext] | undefined) => { export const copyPathCommand: ICommandHandler = async (accessor, fileMatch: FileMatch | FolderMatchWithResource | undefined) => {
let fileMatch = fileMatchArg ? fileMatchArg[0].renderableMatch : undefined; // For the time being we only support single-select
if (!fileMatch) { if (!fileMatch) {
const selection = getSelectedRow(accessor); const selection = getSelectedRow(accessor);
if (!(selection instanceof FileMatch || selection instanceof FolderMatchWithResource)) { if (!(selection instanceof FileMatch || selection instanceof FolderMatchWithResource)) {
...@@ -853,8 +852,7 @@ function folderMatchToString(folderMatch: FolderMatchWithResource | FolderMatch, ...@@ -853,8 +852,7 @@ function folderMatchToString(folderMatch: FolderMatchWithResource | FolderMatch,
} }
const maxClipboardMatches = 1e4; const maxClipboardMatches = 1e4;
export const copyMatchCommand: ICommandHandler = async (accessor, matchArg: [IRenderableMatchContext] | undefined) => { export const copyMatchCommand: ICommandHandler = async (accessor, match: RenderableMatch | undefined) => {
let match = matchArg ? matchArg[0].renderableMatch : undefined; // For the time being we only support single-select
if (!match) { if (!match) {
const selection = getSelectedRow(accessor); const selection = getSelectedRow(accessor);
if (!selection) { if (!selection) {
......
...@@ -71,7 +71,6 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle ...@@ -71,7 +71,6 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { Orientation } from 'vs/base/browser/ui/sash/sash'; import { Orientation } from 'vs/base/browser/ui/sash/sash';
import { searchDetailsIcon } from 'vs/workbench/contrib/search/browser/searchIcons'; import { searchDetailsIcon } from 'vs/workbench/contrib/search/browser/searchIcons';
import { Range } from 'vs/editor/common/core/range';
const $ = dom.$; const $ = dom.$;
...@@ -86,90 +85,6 @@ export enum SearchViewPosition { ...@@ -86,90 +85,6 @@ export enum SearchViewPosition {
Panel Panel
} }
export type SearchViewContextMid = 13;
export const SearchViewContextMid = 13;
export interface IMatchContext {
/** Identifies which kind of match this is (text,file,folder) */
matchingKind: 'textMatch';
/** vscode id for this match */
id: string;
/** The text that was matched */
matchedText: string;
/** Text we would replace the matched text for, if we apply the match */
replacementText: string;
/** uri of the file were this match happened */
uri: URI;
/** location of where the matched text is inside the file */
matchRange: Range;
renderableMatch: Match;
$mid: SearchViewContextMid;
}
export interface IFileMatchContext {
/** Identifies which kind of match this is (text,file,folder) */
matchingKind: 'fileMatch';
/** uri of the file were all these matches happened */
uri: URI;
/** matches for this particular file */
matches: IMatchContext[];
renderableMatch: FileMatch;
$mid: SearchViewContextMid;
}
export interface IFolderMatchContext {
/** Identifies which kind of match this is (text,file,folder) */
matchingKind: 'folderMatch';
/** vscode id for this match */
id: string;
/** matches for this particular folder */
matches: IFileMatchContext[];
/** resource that might be associate with this match */
resource: URI | null;
renderableMatch: FolderMatch;
$mid: SearchViewContextMid;
}
export interface IFolderMatchWithResourceContext extends IFolderMatchContext {
resource: URI;
renderableMatch: FolderMatchWithResource;
}
export type IRenderableMatchContext = (IMatchContext | IFileMatchContext | IFolderMatchContext);
function toMatchContext(match: Match): IMatchContext {
return {
matchingKind: 'textMatch',
id: match.id(),
uri: URI.parse(match.parent().id()),
matchedText: match.fullMatchText(),
replacementText: match.replaceString,
matchRange: match.range(),
renderableMatch: match,
$mid: SearchViewContextMid
};
}
function toFileMatchContext(fileMatch: FileMatch): IFileMatchContext {
return {
matchingKind: 'fileMatch',
uri: URI.parse(fileMatch.id()),
matches: fileMatch.matches().map(toMatchContext),
renderableMatch: fileMatch,
$mid: SearchViewContextMid
};
}
function toFolderMatchContext<T extends IFolderMatchContext>(folderMatch: FolderMatch): T {
return {
matchingKind: 'folderMatch',
matches: folderMatch.matches().map(toFileMatchContext),
id: folderMatch.id(),
renderableMatch: folderMatch,
$mid: SearchViewContextMid
} as T;
}
const SEARCH_CANCELLED_MESSAGE = nls.localize('searchCanceled', "Search was canceled before any results could be found - "); const SEARCH_CANCELLED_MESSAGE = nls.localize('searchCanceled', "Search was canceled before any results could be found - ");
export class SearchView extends ViewPane { export class SearchView extends ViewPane {
...@@ -865,24 +780,13 @@ export class SearchView extends ViewPane { ...@@ -865,24 +780,13 @@ export class SearchView extends ViewPane {
e.browserEvent.preventDefault(); e.browserEvent.preventDefault();
e.browserEvent.stopPropagation(); e.browserEvent.stopPropagation();
const match = e.element;
let context: IRenderableMatchContext | undefined = undefined;
if (match instanceof FileMatch) {
context = toFileMatchContext(match);
} else if (match instanceof Match) {
context = toMatchContext(match);
} else if (match instanceof FolderMatch) {
context = toFolderMatchContext(match);
context.resource = match.resource;
}
const actions: IAction[] = []; const actions: IAction[] = [];
const actionsDisposable = createAndFillInContextMenuActions(this.contextMenu, { shouldForwardArgs: true }, actions); const actionsDisposable = createAndFillInContextMenuActions(this.contextMenu, { shouldForwardArgs: true }, actions);
this.contextMenuService.showContextMenu({ this.contextMenuService.showContextMenu({
getAnchor: () => e.anchor, getAnchor: () => e.anchor,
getActions: () => actions, getActions: () => actions,
getActionsContext: () => [context], getActionsContext: () => e.element,
onHide: () => dispose(actionsDisposable) onHide: () => dispose(actionsDisposable)
}); });
} }
......
...@@ -158,10 +158,6 @@ export class Match { ...@@ -158,10 +158,6 @@ export class Match {
getMatchString(): string { getMatchString(): string {
return this._oneLinePreviewText.substring(this._rangeInPreviewText.startColumn - 1, this._rangeInPreviewText.endColumn - 1); return this._oneLinePreviewText.substring(this._rangeInPreviewText.startColumn - 1, this._rangeInPreviewText.endColumn - 1);
} }
toJSON(): object {
return {}; // We send an IRenderableMatchContext to the extensions
}
} }
export class FileMatch extends Disposable implements IFileMatch { export class FileMatch extends Disposable implements IFileMatch {
...@@ -449,10 +445,6 @@ export class FileMatch extends Disposable implements IFileMatch { ...@@ -449,10 +445,6 @@ export class FileMatch extends Disposable implements IFileMatch {
this._onDispose.fire(); this._onDispose.fire();
super.dispose(); super.dispose();
} }
toJSON(): object {
return {}; // We send an IRenderableMatchContext to the extensions
}
} }
export interface IChangeEvent { export interface IChangeEvent {
...@@ -643,10 +635,6 @@ export class FolderMatch extends Disposable { ...@@ -643,10 +635,6 @@ export class FolderMatch extends Disposable {
this._onDispose.fire(); this._onDispose.fire();
super.dispose(); super.dispose();
} }
toJSON(): object {
return {}; // We send an IRenderableMatchContext to the extensions
}
} }
/** /**
......
...@@ -23,7 +23,6 @@ import { mock } from 'vs/base/test/common/mock'; ...@@ -23,7 +23,6 @@ import { mock } from 'vs/base/test/common/mock';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager'; import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager';
import { NativeTextSearchManager } from 'vs/workbench/services/search/node/textSearchManager'; import { NativeTextSearchManager } from 'vs/workbench/services/search/node/textSearchManager';
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
let rpcProtocol: TestRPCProtocol; let rpcProtocol: TestRPCProtocol;
let extHostSearch: NativeExtHostSearch; let extHostSearch: NativeExtHostSearch;
...@@ -147,8 +146,7 @@ suite('ExtHostSearch', () => { ...@@ -147,8 +146,7 @@ suite('ExtHostSearch', () => {
rpcProtocol, rpcProtocol,
new class extends mock<IExtHostInitDataService>() { remote = { isRemote: false, authority: undefined, connectionData: null }; }, new class extends mock<IExtHostInitDataService>() { remote = { isRemote: false, authority: undefined, connectionData: null }; },
new URITransformerService(null), new URITransformerService(null),
logService, logService
new ExtHostCommands(rpcProtocol, new NullLogService())
); );
this._pfs = mockPFS as any; this._pfs = mockPFS as any;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册