Skip to content

Commit 9cf0937

Browse files
author
Kartik Raj
committed
Try something out
1 parent 59d72f7 commit 9cf0937

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/client/common/interpreterPathService.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { ConfigurationChangeEvent, ConfigurationTarget, Event, EventEmitter, Uri
99
import { IWorkspaceService } from './application/types';
1010
import { PythonSettings } from './configSettings';
1111
import { isTestExecution } from './constants';
12-
import { FileSystemPaths } from './platform/fs-paths';
1312
import {
1413
IDisposable,
1514
IDisposableRegistry,
@@ -40,14 +39,12 @@ export class InterpreterPathService implements IInterpreterPathService {
4039
return this._didChangeInterpreterEmitter.event;
4140
}
4241
public _didChangeInterpreterEmitter = new EventEmitter<InterpreterConfigurationScope>();
43-
private fileSystemPaths: FileSystemPaths;
4442
constructor(
4543
@inject(IPersistentStateFactory) private readonly persistentStateFactory: IPersistentStateFactory,
4644
@inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService,
4745
@inject(IDisposableRegistry) disposables: IDisposable[]
4846
) {
4947
disposables.push(this.workspaceService.onDidChangeConfiguration(this.onDidChangeConfiguration.bind(this)));
50-
this.fileSystemPaths = FileSystemPaths.withDefaults();
5148
}
5249

5350
public async onDidChangeConfiguration(event: ConfigurationChangeEvent) {
@@ -128,9 +125,7 @@ export class InterpreterPathService implements IInterpreterPathService {
128125
settingKey = `WORKSPACE_FOLDER_INTERPRETER_PATH_${folderKey}`;
129126
} else {
130127
settingKey = this.workspaceService.workspaceFile
131-
? `WORKSPACE_INTERPRETER_PATH_${this.fileSystemPaths.normCase(
132-
this.workspaceService.workspaceFile.fsPath
133-
)}`
128+
? `WORKSPACE_INTERPRETER_PATH_${this.workspaceService.workspaceFile.fsPath}`
134129
: // Only a single folder is opened, use fsPath of the folder as key
135130
`WORKSPACE_FOLDER_INTERPRETER_PATH_${folderKey}`;
136131
}
@@ -165,7 +160,7 @@ export class InterpreterPathService implements IInterpreterPathService {
165160
public async _copyWorkspaceValueToNewStorage(resource: Resource, value: string | undefined): Promise<void> {
166161
// Copy workspace setting into the new storage if it hasn't been copied already
167162
const workspaceKey = this.workspaceService.workspaceFile
168-
? this.fileSystemPaths.normCase(this.workspaceService.workspaceFile.fsPath)
163+
? this.workspaceService.workspaceFile.fsPath
169164
: undefined;
170165
if (!workspaceKey) {
171166
return;

src/test/common/interpreterPathService.unit.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ suite('Interpreter Path Service', async () => {
126126

127127
test('If the one-off transfer to new storage has not happened yet for the workspace, do it and record the transfer', async () => {
128128
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
129-
const expectedWorkspaceKey = 'PATH\\TO\\WORKSPACEFILE';
129+
const expectedWorkspaceKey = workspaceFileUri.fsPath;
130130
const update = sinon.stub(InterpreterPathService.prototype, 'update');
131131
const persistentState = TypeMoq.Mock.ofType<IPersistentState<string[]>>();
132132
workspaceService.setup((w) => w.workspaceFile).returns(() => workspaceFileUri);
@@ -148,7 +148,7 @@ suite('Interpreter Path Service', async () => {
148148

149149
test('If the one-off transfer to new storage has already happened for the workspace, do not update and simply return', async () => {
150150
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
151-
const expectedWorkspaceKey = 'PATH\\TO\\WORKSPACEFILE';
151+
const expectedWorkspaceKey = workspaceFileUri.fsPath;
152152
const update = sinon.stub(InterpreterPathService.prototype, 'update');
153153
const persistentState = TypeMoq.Mock.ofType<IPersistentState<string[]>>();
154154
workspaceService.setup((w) => w.workspaceFile).returns(() => workspaceFileUri);
@@ -330,7 +330,7 @@ suite('Interpreter Path Service', async () => {
330330

331331
test('Workspace settings are correctly updated in case of multiroot folders', async () => {
332332
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
333-
const expectedSettingKey = 'WORKSPACE_INTERPRETER_PATH_PATH\\TO\\WORKSPACEFILE';
333+
const expectedSettingKey = `WORKSPACE_INTERPRETER_PATH_${workspaceFileUri.fsPath}`;
334334
const persistentState = TypeMoq.Mock.ofType<IPersistentState<string | undefined>>();
335335
workspaceService.setup((w) => w.getWorkspaceFolderIdentifier(resource)).returns(() => resource.fsPath);
336336
workspaceService.setup((w) => w.workspaceFile).returns(() => workspaceFileUri);
@@ -507,7 +507,7 @@ suite('Interpreter Path Service', async () => {
507507

508508
test('Inspecting settings returns as expected in case of multiroot folders', async () => {
509509
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
510-
const expectedWorkspaceSettingKey = 'WORKSPACE_INTERPRETER_PATH_PATH\\TO\\WORKSPACEFILE';
510+
const expectedWorkspaceSettingKey = `WORKSPACE_INTERPRETER_PATH_${workspaceFileUri.fsPath}`;
511511
const expectedWorkspaceFolderSettingKey = `WORKSPACE_FOLDER_INTERPRETER_PATH_${resource.fsPath}`;
512512
const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
513513
// A workspace file is present in case of multiroot workspace folders

0 commit comments

Comments
 (0)