Skip to content

Commit

Permalink
Remove more usages
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Feb 28, 2024
1 parent f53299b commit 2876547
Show file tree
Hide file tree
Showing 2 changed files with 237 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
} from './interpreterKernelSpecFinderHelper.node';
import { getDisplayPath } from '../../../platform/common/platform/fs-paths.node';
import { raceCancellation } from '../../../platform/common/cancellation';
import { getCachedEnvironments, resolvedPythonEnvToJupyterEnv } from '../../../platform/interpreter/helpers';
import { resolvableInstance } from '../../../test/datascience/helpers';

Check warning on line 29 in src/kernels/raw/finder/localPythonAndRelatedNonPythonKernelSpecFinder.node.ts

View workflow job for this annotation

GitHub Actions / Lint

'resolvableInstance' is defined but never used

Check failure on line 29 in src/kernels/raw/finder/localPythonAndRelatedNonPythonKernelSpecFinder.node.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected path "../../../test/datascience/helpers" imported in restricted zone. Importing test modules from ./src/test into extension code is not allowed

Check failure on line 29 in src/kernels/raw/finder/localPythonAndRelatedNonPythonKernelSpecFinder.node.ts

View workflow job for this annotation

GitHub Actions / Build VSIX

'resolvableInstance' is declared but its value is never read.

Check failure on line 29 in src/kernels/raw/finder/localPythonAndRelatedNonPythonKernelSpecFinder.node.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (ubuntu-latest, 3.10)

'resolvableInstance' is declared but its value is never read.

Check failure on line 29 in src/kernels/raw/finder/localPythonAndRelatedNonPythonKernelSpecFinder.node.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (macos-latest, 3.10)

'resolvableInstance' is declared but its value is never read.

Check failure on line 29 in src/kernels/raw/finder/localPythonAndRelatedNonPythonKernelSpecFinder.node.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (windows-latest, 3.10)

'resolvableInstance' is declared but its value is never read.

type InterpreterId = string;

Expand Down Expand Up @@ -215,7 +217,8 @@ export class LocalPythonAndRelatedNonPythonKernelSpecFinder extends LocalKernelS
// It is also possible the user deleted a python environment,
// E.g. user deleted a conda env or a virtual env and they refreshed the list of interpreters/kernels.
// We should now remove those kernels as well.
const validInterpreterIds = new Set(this.interpreterService.resolvedEnvironments.map((i) => i.id));
const validInterpreterIds = new Set(getCachedEnvironments().map((i) => i.id));
// const validInterpreterIds = new Set(this.interpreterService.resolvedEnvironments.map((i) => i.id));
const kernelsThatPointToInvalidValidInterpreters = Array.from(this._kernels.values()).filter((item) => {
if (item.interpreter && !validInterpreterIds.has(item.interpreter.id)) {
return true;
Expand Down Expand Up @@ -277,15 +280,13 @@ export class LocalPythonAndRelatedNonPythonKernelSpecFinder extends LocalKernelS
}

private async listKernelsImplementation(cancelToken: CancellationToken, forceRefresh: boolean) {
const interpreters = this.extensionChecker.isPythonExtensionInstalled
? this.interpreterService.resolvedEnvironments
: [];
const interpreters = this.extensionChecker.isPythonExtensionInstalled ? getCachedEnvironments() : [];
const interpreterPromise = Promise.all(
interpreters.map(async (interpreter) => {
let finder = this.interpreterKernelSpecs.get(interpreter.id);
if (!finder) {
finder = new InterpreterSpecificKernelSpecsFinder(
interpreter,
resolvedPythonEnvToJupyterEnv(interpreter)!,
this.interpreterService,
this.jupyterPaths,
this.extensionChecker,
Expand Down
Loading

0 comments on commit 2876547

Please sign in to comment.