Skip to content

Commit 13fe219

Browse files
author
Benjamin Pasero
committed
debt - remote path => path service
1 parent 8d53e23 commit 13fe219

27 files changed

Lines changed: 111 additions & 102 deletions

File tree

src/vs/workbench/browser/parts/editor/tabsTitleControl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { withNullAsUndefined, assertAllDefined, assertIsDefined } from 'vs/base/
4343
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
4444
import { basenameOrAuthority } from 'vs/base/common/resources';
4545
import { RunOnceScheduler } from 'vs/base/common/async';
46-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
46+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
4747
import { IPath, win32, posix } from 'vs/base/common/path';
4848

4949
interface IEditorInputLabel {
@@ -97,7 +97,7 @@ export class TabsTitleControl extends TitleControl {
9797
@IConfigurationService configurationService: IConfigurationService,
9898
@IFileService fileService: IFileService,
9999
@IEditorService private readonly editorService: EditorServiceImpl,
100-
@IRemotePathService private readonly remotePathService: IRemotePathService
100+
@IPathService private readonly pathService: IPathService
101101
) {
102102
super(parent, accessor, group, contextMenuService, instantiationService, contextKeyService, keybindingService, telemetryService, notificationService, menuService, quickInputService, themeService, extensionService, configurationService, fileService);
103103

@@ -107,7 +107,7 @@ export class TabsTitleControl extends TitleControl {
107107
// Resolve the correct path library for the OS we are on
108108
// If we are connected to remote, this accounts for the
109109
// remote OS.
110-
(async () => this.path = await this.remotePathService.path)();
110+
(async () => this.path = await this.pathService.path)();
111111
}
112112

113113
protected registerListeners(): void {

src/vs/workbench/contrib/debug/browser/linkDetector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
1212
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
1313
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1414
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
15-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
15+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
1616

1717
const CONTROL_CODES = '\\u0000-\\u0020\\u007f-\\u009f';
1818
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 {
3838
@IEditorService private readonly editorService: IEditorService,
3939
@IFileService private readonly fileService: IFileService,
4040
@IOpenerService private readonly openerService: IOpenerService,
41-
@IRemotePathService private readonly remotePathService: IRemotePathService,
41+
@IPathService private readonly pathService: IPathService,
4242
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
4343
) {
4444
// noop
@@ -120,7 +120,7 @@ export class LinkDetector {
120120
}
121121

122122
if (path[0] === '~') {
123-
const userHome = this.remotePathService.resolvedUserHome;
123+
const userHome = this.pathService.resolvedUserHome;
124124
if (userHome) {
125125
path = osPath.join(userHome.fsPath, path.substring(1));
126126
}

src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { IViewDescriptorService } from 'vs/workbench/common/views';
3939
import { IOpenerService } from 'vs/platform/opener/common/opener';
4040
import { IThemeService } from 'vs/platform/theme/common/themeService';
4141
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
42-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
42+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
4343

4444
const NEW_STYLE_COMPRESS = true;
4545

@@ -241,12 +241,12 @@ class RootFolderTreeItem extends BaseTreeItem {
241241

242242
class RootTreeItem extends BaseTreeItem {
243243

244-
constructor(private _remotePathService: IRemotePathService, private _contextService: IWorkspaceContextService, private _labelService: ILabelService) {
244+
constructor(private _pathService: IPathService, private _contextService: IWorkspaceContextService, private _labelService: ILabelService) {
245245
super(undefined, 'Root');
246246
}
247247

248248
add(session: IDebugSession): SessionTreeItem {
249-
return this.createIfNeeded(session.getId(), () => new SessionTreeItem(this._labelService, this, session, this._remotePathService, this._contextService));
249+
return this.createIfNeeded(session.getId(), () => new SessionTreeItem(this._labelService, this, session, this._pathService, this._contextService));
250250
}
251251

252252
find(session: IDebugSession): SessionTreeItem {
@@ -262,7 +262,7 @@ class SessionTreeItem extends BaseTreeItem {
262262
private _map = new Map<string, BaseTreeItem>();
263263
private _labelService: ILabelService;
264264

265-
constructor(labelService: ILabelService, parent: BaseTreeItem, session: IDebugSession, private _remotePathService: IRemotePathService, private rootProvider: IWorkspaceContextService) {
265+
constructor(labelService: ILabelService, parent: BaseTreeItem, session: IDebugSession, private _pathService: IPathService, private rootProvider: IWorkspaceContextService) {
266266
super(parent, session.getLabel(), true);
267267
this._labelService = labelService;
268268
this._session = session;
@@ -347,7 +347,7 @@ class SessionTreeItem extends BaseTreeItem {
347347
} else {
348348
// on unix try to tildify absolute paths
349349
path = normalize(path);
350-
const userHome = this._remotePathService.resolvedUserHome;
350+
const userHome = this._pathService.resolvedUserHome;
351351
if (userHome && !isWindows) {
352352
path = tildify(path, userHome.fsPath);
353353
}
@@ -426,7 +426,7 @@ export class LoadedScriptsView extends ViewPane {
426426
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
427427
@IDebugService private readonly debugService: IDebugService,
428428
@ILabelService private readonly labelService: ILabelService,
429-
@IRemotePathService private readonly remotePathService: IRemotePathService,
429+
@IPathService private readonly pathService: IPathService,
430430
@IOpenerService openerService: IOpenerService,
431431
@IThemeService themeService: IThemeService,
432432
@ITelemetryService telemetryService: ITelemetryService,
@@ -446,7 +446,7 @@ export class LoadedScriptsView extends ViewPane {
446446

447447
this.filter = new LoadedScriptsFilter();
448448

449-
const root = new RootTreeItem(this.remotePathService, this.contextService, this.labelService);
449+
const root = new RootTreeItem(this.pathService, this.contextService, this.labelService);
450450

451451
this.treeLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
452452
this._register(this.treeLabels);

src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { getOutOfWorkspaceEditorResources, extractRangeFromFilter, IWorkbenchSea
1313
import { ISearchService, ISearchComplete } from 'vs/workbench/services/search/common/search';
1414
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
1515
import { untildify } from 'vs/base/common/labels';
16-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
16+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
1717
import { URI } from 'vs/base/common/uri';
1818
import { toLocalResource, dirname, basenameOrAuthority, isEqual } from 'vs/base/common/resources';
1919
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
@@ -158,7 +158,7 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
158158
@IInstantiationService private readonly instantiationService: IInstantiationService,
159159
@ISearchService private readonly searchService: ISearchService,
160160
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
161-
@IRemotePathService private readonly remotePathService: IRemotePathService,
161+
@IPathService private readonly pathService: IPathService,
162162
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
163163
@IFileService private readonly fileService: IFileService,
164164
@ILabelService private readonly labelService: ILabelService,
@@ -631,20 +631,20 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
631631
return;
632632
}
633633

634-
const userHome = await this.remotePathService.userHome;
634+
const userHome = await this.pathService.userHome;
635635
const detildifiedQuery = untildify(query.original, userHome.scheme === Schemas.file ? userHome.fsPath : userHome.path);
636636
if (token.isCancellationRequested) {
637637
return;
638638
}
639639

640-
const isAbsolutePathQuery = (await this.remotePathService.path).isAbsolute(detildifiedQuery);
640+
const isAbsolutePathQuery = (await this.pathService.path).isAbsolute(detildifiedQuery);
641641
if (token.isCancellationRequested) {
642642
return;
643643
}
644644

645645
if (isAbsolutePathQuery) {
646646
const resource = toLocalResource(
647-
await this.remotePathService.fileURI(detildifiedQuery),
647+
await this.pathService.fileURI(detildifiedQuery),
648648
this.environmentService.configuration.remoteAuthority
649649
);
650650

@@ -671,7 +671,7 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
671671

672672
// Convert relative paths to absolute paths over all folders of the workspace
673673
// and return them as results if the absolute paths exist
674-
const isAbsolutePathQuery = (await this.remotePathService.path).isAbsolute(query.original);
674+
const isAbsolutePathQuery = (await this.pathService.path).isAbsolute(query.original);
675675
if (!isAbsolutePathQuery) {
676676
const resources: URI[] = [];
677677
for (const folder of this.contextService.getWorkspace().folders) {

src/vs/workbench/contrib/search/common/queryBuilder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { isMultilineRegexSource } from 'vs/editor/common/model/textModelSearch';
1717
import * as nls from 'vs/nls';
1818
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1919
import { IWorkspaceContextService, IWorkspaceFolderData, toWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace';
20-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
20+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
2121
import { getExcludes, ICommonQueryProps, IFileQuery, IFolderQuery, IPatternInfo, ISearchConfiguration, ITextQuery, ITextSearchPreviewOptions, pathIncludedInQuery, QueryType } from 'vs/workbench/services/search/common/search';
2222

2323
/**
@@ -82,7 +82,7 @@ export class QueryBuilder {
8282
constructor(
8383
@IConfigurationService private readonly configurationService: IConfigurationService,
8484
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
85-
@IRemotePathService private readonly remotePathService: IRemotePathService
85+
@IPathService private readonly pathService: IPathService
8686
) {
8787
}
8888

@@ -239,7 +239,7 @@ export class QueryBuilder {
239239

240240
const segments = splitGlobPattern(pattern)
241241
.map(segment => {
242-
const userHome = this.remotePathService.resolvedUserHome;
242+
const userHome = this.pathService.resolvedUserHome;
243243
if (userHome) {
244244
return untildify(segment, userHome.scheme === Schemas.file ? userHome.fsPath : userHome.path);
245245
}

src/vs/workbench/contrib/search/test/browser/queryBuilder.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { TestConfigurationService } from 'vs/platform/configuration/test/common/
1212
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
1313
import { IWorkspaceContextService, toWorkspaceFolder, toWorkspaceFolders, Workspace } from 'vs/platform/workspace/common/workspace';
1414
import { ISearchPathsInfo, QueryBuilder } from 'vs/workbench/contrib/search/common/queryBuilder';
15-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
15+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
1616
import { IFileQuery, IFolderQuery, IPatternInfo, ITextQuery, QueryType } from 'vs/workbench/services/search/common/search';
17-
import { TestRemotePathService, TestEnvironmentService } from 'vs/workbench/test/browser/workbenchTestServices';
17+
import { TestPathService, TestEnvironmentService } from 'vs/workbench/test/browser/workbenchTestServices';
1818
import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
1919
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
2020

@@ -50,7 +50,7 @@ suite('QueryBuilder', () => {
5050

5151
instantiationService.stub(IWorkspaceContextService, mockContextService);
5252
instantiationService.stub(IEnvironmentService, TestEnvironmentService);
53-
instantiationService.stub(IRemotePathService, new TestRemotePathService());
53+
instantiationService.stub(IPathService, new TestPathService());
5454

5555
queryBuilder = instantiationService.createInstance(QueryBuilder);
5656
});

src/vs/workbench/contrib/search/test/electron-browser/queryBuilder.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
88
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
99
import { IWorkspaceContextService, toWorkspaceFolder, Workspace } from 'vs/platform/workspace/common/workspace';
1010
import { ISearchPathsInfo, QueryBuilder } from 'vs/workbench/contrib/search/common/queryBuilder';
11-
import { TestEnvironmentService, TestNativeRemotePathService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
11+
import { TestEnvironmentService, TestNativePathService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
1212
import { assertEqualSearchPathResults, getUri, patternsToIExpression, globalGlob, fixPath } from 'vs/workbench/contrib/search/test/browser/queryBuilder.test';
1313
import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
14-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
14+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
1515

1616
const DEFAULT_EDITOR_CONFIG = {};
1717
const DEFAULT_USER_CONFIG = { useRipgrep: true, useIgnoreFiles: true, useGlobalIgnoreFiles: true };
@@ -40,10 +40,10 @@ suite('QueryBuilder', () => {
4040

4141
instantiationService.stub(IWorkspaceContextService, mockContextService);
4242
instantiationService.stub(IEnvironmentService, TestEnvironmentService);
43-
instantiationService.stub(IRemotePathService, new TestNativeRemotePathService(TestEnvironmentService));
43+
instantiationService.stub(IPathService, new TestNativePathService(TestEnvironmentService));
4444

4545
queryBuilder = instantiationService.createInstance(QueryBuilder);
46-
await new Promise(resolve => setTimeout(resolve, 5)); // Wait for RemotePathService.userHome to resolve
46+
await new Promise(resolve => setTimeout(resolve, 5)); // Wait for IPathService.userHome to resolve
4747
});
4848

4949
suite('parseSearchPaths', () => {

src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { defaultSearchConfig, extractSearchQueryFromModel, parseSavedSearchEdito
2727
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
2828
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
2929
import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
30-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
30+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
3131
import { ISearchConfigurationProperties } from 'vs/workbench/services/search/common/search';
3232
import { ITextFileSaveOptions, ITextFileService, snapshotToString, stringToSnapshot } from 'vs/workbench/services/textfile/common/textfiles';
3333
import { IWorkingCopy, IWorkingCopyBackup, IWorkingCopyService, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService';
@@ -86,7 +86,7 @@ export class SearchEditorInput extends EditorInput {
8686
@IWorkingCopyService private readonly workingCopyService: IWorkingCopyService,
8787
@IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService,
8888
@ITelemetryService private readonly telemetryService: ITelemetryService,
89-
@IRemotePathService private readonly remotePathService: IRemotePathService,
89+
@IPathService private readonly pathService: IPathService,
9090
@IStorageService storageService: IStorageService,
9191
) {
9292
super();
@@ -284,7 +284,7 @@ export class SearchEditorInput extends EditorInput {
284284
const remoteAuthority = this.environmentService.configuration.remoteAuthority;
285285
const schemeFilter = remoteAuthority ? network.Schemas.vscodeRemote : network.Schemas.file;
286286

287-
return joinPath(this.fileDialogService.defaultFilePath(schemeFilter) || (await this.remotePathService.userHome), searchFileName);
287+
return joinPath(this.fileDialogService.defaultFilePath(schemeFilter) || (await this.pathService.userHome), searchFileName);
288288
}
289289
}
290290

src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
7070
import { RunAutomaticTasks } from 'vs/workbench/contrib/tasks/browser/runAutomaticTasks';
7171

7272
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
73-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
73+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
7474
import { format } from 'vs/base/common/jsonFormatter';
7575
import { ITextModelService } from 'vs/editor/common/services/resolverService';
7676
import { applyEdits } from 'vs/base/common/jsonEdit';
@@ -251,7 +251,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
251251
@IContextKeyService contextKeyService: IContextKeyService,
252252
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
253253
@ITerminalInstanceService private readonly terminalInstanceService: ITerminalInstanceService,
254-
@IRemotePathService private readonly remotePathService: IRemotePathService,
254+
@IPathService private readonly pathService: IPathService,
255255
@ITextModelService private readonly textModelResolverService: ITextModelService,
256256
@IPreferencesService private readonly preferencesService: IPreferencesService,
257257
@IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService
@@ -1482,7 +1482,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
14821482
this.modelService, this.configurationResolverService, this.telemetryService,
14831483
this.contextService, this.environmentService,
14841484
AbstractTaskService.OutputChannelId, this.fileService, this.terminalInstanceService,
1485-
this.remotePathService, this.viewDescriptorService,
1485+
this.pathService, this.viewDescriptorService,
14861486
(workspaceFolder: IWorkspaceFolder) => {
14871487
if (!workspaceFolder) {
14881488
return undefined;

src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { URI } from 'vs/base/common/uri';
4343
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
4444
import { Schemas } from 'vs/base/common/network';
4545
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
46-
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
46+
import { IPathService } from 'vs/workbench/services/path/common/pathService';
4747
import { env as processEnv, cwd as processCwd } from 'vs/base/common/process';
4848
import { IViewsService, IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views';
4949

@@ -200,7 +200,7 @@ export class TerminalTaskSystem implements ITaskSystem {
200200
private outputChannelId: string,
201201
private fileService: IFileService,
202202
private terminalInstanceService: ITerminalInstanceService,
203-
private remotePathService: IRemotePathService,
203+
private pathService: IPathService,
204204
private viewDescriptorService: IViewDescriptorService,
205205
taskSystemInfoResolver: TaskSystemInfoResolver,
206206
) {
@@ -960,7 +960,7 @@ export class TerminalTaskSystem implements ITaskSystem {
960960
windowsShellArgs = true;
961961
let basename = path.basename(shellLaunchConfig.executable!).toLowerCase();
962962
// If we don't have a cwd, then the terminal uses the home dir.
963-
const userHome = await this.remotePathService.userHome;
963+
const userHome = await this.pathService.userHome;
964964
if (basename === 'cmd.exe' && ((options.cwd && isUNC(options.cwd)) || (!options.cwd && isUNC(userHome.fsPath)))) {
965965
return undefined;
966966
}

0 commit comments

Comments
 (0)