提交 d33df695 编写于 作者: J Johannes Rieken

debt - adopt UriDisplayService for reference search

上级 2ba14ee1
......@@ -9,20 +9,16 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ReferencesModel } from './referencesModel';
import { ReferenceWidget, LayoutData } from './referencesWidget';
import { Range } from 'vs/editor/common/core/range';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Position } from 'vs/editor/common/core/position';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { Location } from 'vs/editor/common/modes';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { CancelablePromise } from 'vs/base/common/async';
......@@ -56,14 +52,10 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
editor: ICodeEditor,
@IContextKeyService contextKeyService: IContextKeyService,
@ICodeEditorService private readonly _editorService: ICodeEditorService,
@ITextModelService private readonly _textModelResolverService: ITextModelService,
@INotificationService private readonly _notificationService: INotificationService,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
@IStorageService private readonly _storageService: IStorageService,
@IThemeService private readonly _themeService: IThemeService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@optional(IEnvironmentService) private _environmentService: IEnvironmentService
) {
this._editor = editor;
this._referenceSearchVisible = ctxReferenceSearchVisible.bindTo(contextKeyService);
......@@ -106,7 +98,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
}));
const storageKey = 'peekViewLayout';
const data = <LayoutData>JSON.parse(this._storageService.get(storageKey, undefined, '{}'));
this._widget = new ReferenceWidget(this._editor, this._defaultTreeKeyboardSupport, data, this._textModelResolverService, this._contextService, this._themeService, this._instantiationService, this._environmentService);
this._widget = this._instantiationService.createInstance(ReferenceWidget, this._editor, this._defaultTreeKeyboardSupport, data);
this._widget.setTitle(nls.localize('labelLoading', "Loading..."));
this._widget.show(range);
this._disposables.push(this._widget.onDidClose(() => {
......
......@@ -6,7 +6,7 @@
import { localize } from 'vs/nls';
import { Event, Emitter } from 'vs/base/common/event';
import { basename, dirname } from 'vs/base/common/paths';
import { basename } from 'vs/base/common/paths';
import { IDisposable, dispose, IReference } from 'vs/base/common/lifecycle';
import * as strings from 'vs/base/common/strings';
import URI from 'vs/base/common/uri';
......@@ -46,14 +46,6 @@ export class OneReference {
return this._parent.uri;
}
public get name(): string {
return this._parent.name;
}
public get directory(): string {
return this._parent.directory;
}
public get range(): IRange {
return this._range;
}
......@@ -135,14 +127,6 @@ export class FileReferences implements IDisposable {
return this._uri;
}
public get name(): string {
return basename(this.uri.fsPath);
}
public get directory(): string {
return dirname(this.uri.fsPath);
}
public get preview(): FilePreview {
return this._preview;
}
......
......@@ -7,7 +7,6 @@
import 'vs/css!./media/referencesWidget';
import * as nls from 'vs/nls';
import { onUnexpectedError } from 'vs/base/common/errors';
import { getPathLabel } from 'vs/base/common/labels';
import { Event, Emitter } from 'vs/base/common/event';
import { IDisposable, dispose, IReference } from 'vs/base/common/lifecycle';
import { Schemas } from 'vs/base/common/network';
......@@ -44,6 +43,9 @@ import { WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { Location } from 'vs/editor/common/modes';
import { ClickBehavior } from 'vs/base/parts/tree/browser/treeDefaults';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { dirname, basenameOrAuthority } from 'vs/base/common/resources';
class DecorationsManager implements IDisposable {
......@@ -530,11 +532,10 @@ export class ReferenceWidget extends PeekViewWidget {
editor: ICodeEditor,
private _defaultTreeKeyboardSupport: boolean,
public layoutData: LayoutData,
private _textModelResolverService: ITextModelService,
private _contextService: IWorkspaceContextService,
themeService: IThemeService,
private _instantiationService: IInstantiationService,
private _environmentService: IEnvironmentService
@IThemeService themeService: IThemeService,
@ITextModelService private _textModelResolverService: ITextModelService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IUriDisplayService private _uriDisplay: IUriDisplayService
) {
super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true });
......@@ -780,7 +781,7 @@ export class ReferenceWidget extends PeekViewWidget {
// Update widget header
if (reference.uri.scheme !== Schemas.inMemory) {
this.setTitle(reference.name, getPathLabel(reference.directory, this._environmentService, this._contextService));
this.setTitle(basenameOrAuthority(reference.uri), this._uriDisplay.getLabel(dirname(reference.uri), false));
} else {
this.setTitle(nls.localize('peekView.alternateTitle', "References"));
}
......
......@@ -5,16 +5,12 @@
'use strict';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ReferencesController } from 'vs/editor/contrib/referenceSearch/referencesController';
......@@ -24,28 +20,20 @@ export class StandaloneReferencesController extends ReferencesController {
editor: ICodeEditor,
@IContextKeyService contextKeyService: IContextKeyService,
@ICodeEditorService editorService: ICodeEditorService,
@ITextModelService textModelResolverService: ITextModelService,
@INotificationService notificationService: INotificationService,
@IInstantiationService instantiationService: IInstantiationService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IStorageService storageService: IStorageService,
@IThemeService themeService: IThemeService,
@IConfigurationService configurationService: IConfigurationService,
@optional(IEnvironmentService) environmentService: IEnvironmentService
) {
super(
true,
editor,
contextKeyService,
editorService,
textModelResolverService,
notificationService,
instantiationService,
contextService,
storageService,
themeService,
configurationService,
environmentService
);
}
}
......
......@@ -4,16 +4,12 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ReferencesController } from 'vs/editor/contrib/referenceSearch/referencesController';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
......@@ -23,29 +19,21 @@ export class WorkbenchReferencesController extends ReferencesController {
public constructor(
editor: ICodeEditor,
@IContextKeyService contextKeyService: IContextKeyService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@ITextModelService textModelResolverService: ITextModelService,
@ICodeEditorService editorService: ICodeEditorService,
@INotificationService notificationService: INotificationService,
@IInstantiationService instantiationService: IInstantiationService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IStorageService storageService: IStorageService,
@IThemeService themeService: IThemeService,
@IConfigurationService configurationService: IConfigurationService,
@optional(IEnvironmentService) environmentService: IEnvironmentService
) {
super(
false,
editor,
contextKeyService,
codeEditorService,
textModelResolverService,
editorService,
notificationService,
instantiationService,
contextService,
storageService,
themeService,
configurationService,
environmentService
);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册