提交 05188623 编写于 作者: I isidor

do not use envService.userHome

#94506
上级 0fdef6e7
......@@ -7,12 +7,12 @@ import * as osPath from 'vs/base/common/path';
import * as platform from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import * as nls from 'vs/nls';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IFileService } from 'vs/platform/files/common/files';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
const CONTROL_CODES = '\\u0000-\\u0020\\u007f-\\u009f';
const WEB_LINK_REGEX = new RegExp('(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s' + CONTROL_CODES + '"]{2,}[^\\s' + CONTROL_CODES + '"\')}\\],:;.!?]', 'ug');
......@@ -38,7 +38,7 @@ export class LinkDetector {
@IEditorService private readonly editorService: IEditorService,
@IFileService private readonly fileService: IFileService,
@IOpenerService private readonly openerService: IOpenerService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IRemotePathService private readonly remotePathService: IRemotePathService,
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
) {
// noop
......@@ -120,7 +120,7 @@ export class LinkDetector {
}
if (path[0] === '~') {
const userHome = this.environmentService.userHome;
const userHome = this.remotePathService.userHomeSync;
if (userHome) {
path = osPath.join(userHome.fsPath, path.substring(1));
}
......
......@@ -17,7 +17,6 @@ import { IDebugSession, IDebugService, CONTEXT_LOADED_SCRIPTS_ITEM_TYPE } from '
import { Source } from 'vs/workbench/contrib/debug/common/debugSource';
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { tildify } from 'vs/base/common/labels';
import { isWindows } from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
......@@ -40,6 +39,7 @@ import { IViewDescriptorService } from 'vs/workbench/common/views';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
const NEW_STYLE_COMPRESS = true;
......@@ -241,12 +241,12 @@ class RootFolderTreeItem extends BaseTreeItem {
class RootTreeItem extends BaseTreeItem {
constructor(private _environmentService: IEnvironmentService, private _contextService: IWorkspaceContextService, private _labelService: ILabelService) {
constructor(private _remotePathService: IRemotePathService, private _contextService: IWorkspaceContextService, private _labelService: ILabelService) {
super(undefined, 'Root');
}
add(session: IDebugSession): SessionTreeItem {
return this.createIfNeeded(session.getId(), () => new SessionTreeItem(this._labelService, this, session, this._environmentService, this._contextService));
return this.createIfNeeded(session.getId(), () => new SessionTreeItem(this._labelService, this, session, this._remotePathService, this._contextService));
}
find(session: IDebugSession): SessionTreeItem {
......@@ -262,7 +262,7 @@ class SessionTreeItem extends BaseTreeItem {
private _map = new Map<string, BaseTreeItem>();
private _labelService: ILabelService;
constructor(labelService: ILabelService, parent: BaseTreeItem, session: IDebugSession, private _environmentService: IEnvironmentService, private rootProvider: IWorkspaceContextService) {
constructor(labelService: ILabelService, parent: BaseTreeItem, session: IDebugSession, private _remotePathService: IRemotePathService, private rootProvider: IWorkspaceContextService) {
super(parent, session.getLabel(), true);
this._labelService = labelService;
this._session = session;
......@@ -347,7 +347,7 @@ class SessionTreeItem extends BaseTreeItem {
} else {
// on unix try to tildify absolute paths
path = normalize(path);
const userHome = this._environmentService.userHome;
const userHome = this._remotePathService.userHomeSync;
if (userHome && !isWindows) {
path = tildify(path, userHome.fsPath);
}
......@@ -424,9 +424,9 @@ export class LoadedScriptsView extends ViewPane {
@IEditorService private readonly editorService: IEditorService,
@IContextKeyService readonly contextKeyService: IContextKeyService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IDebugService private readonly debugService: IDebugService,
@ILabelService private readonly labelService: ILabelService,
@IRemotePathService private readonly remotePathService: IRemotePathService,
@IOpenerService openerService: IOpenerService,
@IThemeService themeService: IThemeService,
@ITelemetryService telemetryService: ITelemetryService,
......@@ -446,7 +446,7 @@ export class LoadedScriptsView extends ViewPane {
this.filter = new LoadedScriptsFilter();
const root = new RootTreeItem(this.environmentService, this.contextService, this.labelService);
const root = new RootTreeItem(this.remotePathService, this.contextService, this.labelService);
this.treeLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
this._register(this.treeLabels);
......
......@@ -21,6 +21,7 @@ import { ExtensionsRegistry } from 'vs/workbench/services/extensions/common/exte
import { match } from 'vs/base/common/glob';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
const resourceLabelFormattersExtPoint = ExtensionsRegistry.registerExtensionPoint<ResourceLabelFormatter[]>({
extensionPoint: 'resourceLabelFormatters',
......@@ -101,6 +102,7 @@ export class LabelService extends Disposable implements ILabelService {
constructor(
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IRemotePathService private readonly remotePathService: IRemotePathService
) {
super();
}
......@@ -264,7 +266,7 @@ export class LabelService extends Disposable implements ILabelService {
}
if (formatting.tildify && !forceNoTildify) {
const userHome = this.environmentService.userHome;
const userHome = this.remotePathService.userHomeSync;
if (userHome) {
label = tildify(label, userHome.fsPath);
}
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { TestEnvironmentService } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestEnvironmentService, TestRemotePathService } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
import { URI } from 'vs/base/common/uri';
import { sep } from 'vs/base/common/path';
......@@ -17,7 +17,7 @@ suite('URI Label', () => {
let labelService: LabelService;
setup(() => {
labelService = new LabelService(TestEnvironmentService, new TestContextService());
labelService = new LabelService(TestEnvironmentService, new TestContextService(), new TestRemotePathService(TestEnvironmentService));
});
test('file scheme', function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册