Skip to content

Commit fb4fa59

Browse files
committed
help for test runs
1 parent 405bc4c commit fb4fa59

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

src/features/settings/settingHelpers.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { PythonProject } from '../../api';
1111
import { DEFAULT_ENV_MANAGER_ID, DEFAULT_PACKAGE_MANAGER_ID } from '../../common/constants';
1212
import { traceError, traceInfo, traceWarn } from '../../common/logging';
13-
import { getConfiguration, getWorkspaceFile, getWorkspaceFolders } from '../../common/workspace.apis';
13+
import * as workspaceApis from '../../common/workspace.apis';
1414
import { PythonProjectManager, PythonProjectSettings } from '../../internal.api';
1515

1616
function getSettings(
@@ -42,7 +42,7 @@ export function isDefaultEnvManagerBroken(): boolean {
4242
}
4343

4444
export function getDefaultEnvManagerSetting(wm: PythonProjectManager, scope?: Uri): string {
45-
const config = getConfiguration('python-envs', scope);
45+
const config = workspaceApis.getConfiguration('python-envs', scope);
4646
const settings = getSettings(wm, config, scope);
4747
if (settings && settings.envManager.length > 0) {
4848
return settings.envManager;
@@ -69,7 +69,7 @@ export function getDefaultPkgManagerSetting(
6969
scope?: ConfigurationScope | null,
7070
defaultId?: string,
7171
): string {
72-
const config = getConfiguration('python-envs', scope);
72+
const config = workspaceApis.getConfiguration('python-envs', scope);
7373

7474
const settings = getSettings(wm, config, scope);
7575
if (settings && settings.packageManager.length > 0) {
@@ -123,11 +123,11 @@ export async function setAllManagerSettings(edits: EditAllManagerSettings[]): Pr
123123
}
124124
});
125125

126-
const workspaceFile = getWorkspaceFile();
126+
const workspaceFile = workspaceApis.getWorkspaceFile();
127127
const promises: Thenable<void>[] = [];
128128

129129
workspaces.forEach((es, w) => {
130-
const config = getConfiguration('python-envs', w);
130+
const config = workspaceApis.getConfiguration('python-envs', w);
131131
const overrides = config.get<PythonProjectSettings[]>('pythonProjects', []);
132132
const projectsInspect = config.inspect<PythonProjectSettings[]>('pythonProjects');
133133
const existingProjectsSetting =
@@ -192,7 +192,7 @@ export async function setAllManagerSettings(edits: EditAllManagerSettings[]): Pr
192192
}
193193
});
194194

195-
const config = getConfiguration('python-envs', undefined);
195+
const config = workspaceApis.getConfiguration('python-envs', undefined);
196196
edits
197197
.filter((e) => !e.project)
198198
.forEach((e) => {
@@ -253,7 +253,7 @@ export async function setEnvironmentManager(edits: EditEnvManagerSettings[]): Pr
253253
const promises: Thenable<void>[] = [];
254254

255255
workspaces.forEach((es, w) => {
256-
const config = getConfiguration('python-envs', w.uri);
256+
const config = workspaceApis.getConfiguration('python-envs', w.uri);
257257
const overrides = config.get<PythonProjectSettings[]>('pythonProjects', []);
258258
const projectsInspect = config.inspect<PythonProjectSettings[]>('pythonProjects');
259259
const existingProjectsSetting = projectsInspect?.workspaceValue ?? undefined;
@@ -285,7 +285,7 @@ export async function setEnvironmentManager(edits: EditEnvManagerSettings[]): Pr
285285
}
286286
});
287287

288-
const config = getConfiguration('python-envs', undefined);
288+
const config = workspaceApis.getConfiguration('python-envs', undefined);
289289
edits
290290
.filter((e) => !e.project)
291291
.forEach((e) => {
@@ -337,7 +337,7 @@ export async function setPackageManager(edits: EditPackageManagerSettings[]): Pr
337337
const promises: Thenable<void>[] = [];
338338

339339
workspaces.forEach((es, w) => {
340-
const config = getConfiguration('python-envs', w.uri);
340+
const config = workspaceApis.getConfiguration('python-envs', w.uri);
341341
const overrides = config.get<PythonProjectSettings[]>('pythonProjects', []);
342342
const projectsInspect = config.inspect<PythonProjectSettings[]>('pythonProjects');
343343
const existingProjectsSetting = projectsInspect?.workspaceValue ?? undefined;
@@ -374,7 +374,7 @@ export async function setPackageManager(edits: EditPackageManagerSettings[]): Pr
374374
}
375375
});
376376

377-
const config = getConfiguration('python-envs', undefined);
377+
const config = workspaceApis.getConfiguration('python-envs', undefined);
378378
edits
379379
.filter((e) => !e.project)
380380
.forEach((e) => {
@@ -403,7 +403,7 @@ export interface EditProjectSettings {
403403
export async function addPythonProjectSetting(edits: EditProjectSettings[]): Promise<void> {
404404
const noWorkspace: EditProjectSettings[] = [];
405405
const workspaces = new Map<WorkspaceFolder, EditProjectSettings[]>();
406-
const globalConfig = getConfiguration('python-envs', undefined);
406+
const globalConfig = workspaceApis.getConfiguration('python-envs', undefined);
407407
const envManager = globalConfig.get<string>('defaultEnvManager', DEFAULT_ENV_MANAGER_ID);
408408
const pkgManager = globalConfig.get<string>('defaultPackageManager', DEFAULT_PACKAGE_MANAGER_ID);
409409

@@ -420,11 +420,11 @@ export async function addPythonProjectSetting(edits: EditProjectSettings[]): Pro
420420
traceError(`Unable to find workspace for ${e.project.uri.fsPath}`);
421421
});
422422

423-
const isMultiroot = (getWorkspaceFolders() ?? []).length > 1;
423+
const isMultiroot = (workspaceApis.getWorkspaceFolders() ?? []).length > 1;
424424

425425
const promises: Thenable<void>[] = [];
426426
workspaces.forEach((es, w) => {
427-
const config = getConfiguration('python-envs', w.uri);
427+
const config = workspaceApis.getConfiguration('python-envs', w.uri);
428428
const overrides = config.get<PythonProjectSettings[]>('pythonProjects', []);
429429
es.forEach((e) => {
430430
if (isMultiroot) {
@@ -473,7 +473,7 @@ export async function removePythonProjectSetting(edits: EditProjectSettings[]):
473473

474474
const promises: Thenable<void>[] = [];
475475
workspaces.forEach((es, w) => {
476-
const config = getConfiguration('python-envs', w.uri);
476+
const config = workspaceApis.getConfiguration('python-envs', w.uri);
477477
const overrides = config.get<PythonProjectSettings[]>('pythonProjects', []);
478478
es.forEach((e) => {
479479
const pwPath = path.normalize(e.project.uri.fsPath);
@@ -497,7 +497,7 @@ export async function removePythonProjectSetting(edits: EditProjectSettings[]):
497497
* @param newUri The new URI of the project folder after rename/move
498498
*/
499499
export async function updatePythonProjectSettingPath(oldUri: Uri, newUri: Uri): Promise<void> {
500-
const workspaceFolders = getWorkspaceFolders() ?? [];
500+
const workspaceFolders = workspaceApis.getWorkspaceFolders() ?? [];
501501

502502
// Find the workspace folder that contains the old path
503503
let targetWorkspace: WorkspaceFolder | undefined;
@@ -514,7 +514,7 @@ export async function updatePythonProjectSettingPath(oldUri: Uri, newUri: Uri):
514514
return;
515515
}
516516

517-
const config = getConfiguration('python-envs', targetWorkspace.uri);
517+
const config = workspaceApis.getConfiguration('python-envs', targetWorkspace.uri);
518518
const overrides = config.get<PythonProjectSettings[]>('pythonProjects', []);
519519
const oldNormalizedPath = path.normalize(oldUri.fsPath);
520520

@@ -536,7 +536,7 @@ export async function updatePythonProjectSettingPath(oldUri: Uri, newUri: Uri):
536536
* @returns The user-configured value or undefined if not set by user
537537
*/
538538
export function getSettingWindowScope<T>(section: string, key: string): T | undefined {
539-
const config = getConfiguration(section);
539+
const config = workspaceApis.getConfiguration(section);
540540
const inspect = config.inspect<T>(key);
541541
if (!inspect) {
542542
return undefined;
@@ -564,7 +564,7 @@ export function getSettingWindowScope<T>(section: string, key: string): T | unde
564564
* @returns The user-configured value or undefined if not set by user
565565
*/
566566
export function getSettingWorkspaceScope<T>(section: string, key: string, scope?: Uri): T | undefined {
567-
const config = getConfiguration(section, scope);
567+
const config = workspaceApis.getConfiguration(section, scope);
568568
const inspect = config.inspect<T>(key);
569569
if (!inspect) {
570570
return undefined;
@@ -590,7 +590,7 @@ export function getSettingWorkspaceScope<T>(section: string, key: string, scope?
590590
* @returns The user-configured value or undefined if not set by user
591591
*/
592592
export function getSettingUserScope<T>(section: string, key: string): T | undefined {
593-
const config = getConfiguration(section);
593+
const config = workspaceApis.getConfiguration(section);
594594
const inspect = config.inspect<T>(key);
595595
if (!inspect) {
596596
return undefined;

0 commit comments

Comments
 (0)