Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita00d42c

Browse files
committed
Merge branch 'kinto/disable-with-pyrefly' of github.com:kinto0/vscode-python into kinto/disable-with-pyrefly
2 parentse11009d +c31fd31 commita00d42c

File tree

4 files changed

+11
-42
lines changed

4 files changed

+11
-42
lines changed

‎src/client/envExt/api.legacy.ts

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
import{Terminal,Uri,WorkspaceFolder}from'vscode';
4+
import{Terminal,Uri}from'vscode';
55
import{getEnvExtApi,getEnvironment}from'./api.internal';
66
import{EnvironmentType,PythonEnvironmentasPythonEnvironmentLegacy}from'../pythonEnvironments/info';
77
import{PythonEnvironment,PythonTerminalOptions}from'./types';
88
import{Architecture}from'../common/utils/platform';
99
import{parseVersion}from'../pythonEnvironments/base/info/pythonVersion';
1010
import{PythonEnvType}from'../pythonEnvironments/base/info';
11-
import{traceError,traceInfo}from'../logging';
11+
import{traceError}from'../logging';
1212
import{reportActiveInterpreterChanged}from'../environmentApi';
1313
import{getWorkspaceFolder,getWorkspaceFolders}from'../common/vscodeApis/workspaceApis';
1414

@@ -120,36 +120,6 @@ export async function getActiveInterpreterLegacy(resource?: Uri): Promise<Python
120120
returnpythonEnv ?toLegacyType(pythonEnv) :undefined;
121121
}
122122

123-
exportasyncfunctionensureEnvironmentContainsPythonLegacy(
124-
pythonPath:string,
125-
workspaceFolder:WorkspaceFolder|undefined,
126-
callback:()=>void,
127-
):Promise<void>{
128-
constapi=awaitgetEnvExtApi();
129-
constpythonEnv=awaitapi.resolveEnvironment(Uri.file(pythonPath));
130-
if(!pythonEnv){
131-
traceError(`EnvExt: Failed to resolve environment for${pythonPath}`);
132-
return;
133-
}
134-
135-
constenvType=toEnvironmentType(pythonEnv);
136-
if(envType===EnvironmentType.Conda){
137-
constpackages=awaitapi.getPackages(pythonEnv);
138-
if(packages&&packages.length>0&&packages.some((pkg)=>pkg.name.toLowerCase()==='python')){
139-
return;
140-
}
141-
traceInfo(`EnvExt: Python not found in${envType} environment${pythonPath}`);
142-
traceInfo(`EnvExt: Installing Python in${envType} environment${pythonPath}`);
143-
awaitapi.installPackages(pythonEnv,['python']);
144-
previousEnvMap.set(workspaceFolder?.uri.fsPath||'',pythonEnv);
145-
reportActiveInterpreterChanged({
146-
path:pythonPath,
147-
resource:workspaceFolder,
148-
});
149-
callback();
150-
}
151-
}
152-
153123
exportasyncfunctionsetInterpreterLegacy(pythonPath:string,uri:Uri|undefined):Promise<void>{
154124
constapi=awaitgetEnvExtApi();
155125
constpythonEnv=awaitapi.resolveEnvironment(Uri.file(pythonPath));

‎src/client/interpreter/interpreterService.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
}from'../pythonEnvironments/base/locator';
4646
import{sleep}from'../common/utils/async';
4747
import{useEnvExtension}from'../envExt/api.internal';
48-
import{ensureEnvironmentContainsPythonLegacy,getActiveInterpreterLegacy}from'../envExt/api.legacy';
48+
import{getActiveInterpreterLegacy}from'../envExt/api.legacy';
4949

5050
typeStoredPythonEnvironment=PythonEnvironment&{store?:boolean};
5151

@@ -290,9 +290,6 @@ export class InterpreterService implements Disposable, IInterpreterService {
290290
@cache(-1,true)
291291
privateasyncensureEnvironmentContainsPython(pythonPath:string,workspaceFolder:WorkspaceFolder|undefined){
292292
if(useEnvExtension()){
293-
awaitensureEnvironmentContainsPythonLegacy(pythonPath,workspaceFolder,()=>{
294-
this.didChangeInterpreterEmitter.fire(workspaceFolder?.uri);
295-
});
296293
return;
297294
}
298295

‎src/client/terminals/envCollectionActivation/service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,9 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
221221
env.PS1=awaitthis.getPS1(shell,resource,env);
222222
constdefaultPrependOptions=awaitthis.getPrependOptions();
223223

224-
constdeactivate=awaitthis.terminalDeactivateService.getScriptLocation(shell,resource);
225224
// Clear any previously set env vars from collection
226225
envVarCollection.clear();
227-
226+
constdeactivate=awaitthis.terminalDeactivateService.getScriptLocation(shell,resource);
228227
Object.keys(env).forEach((key)=>{
229228
if(shouldSkip(key)){
230229
return;

‎src/client/terminals/envCollectionActivation/shellIntegrationService.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { IDisposableRegistry, IPersistentStateFactory } from '../../common/types
1515
import{sleep}from'../../common/utils/async';
1616
import{traceError,traceVerbose}from'../../logging';
1717
import{IShellIntegrationDetectionService}from'../types';
18+
import{isTrusted}from'../../common/vscodeApis/workspaceApis';
1819

1920
/**
2021
* This is a list of shells which support shell integration:
@@ -151,10 +152,12 @@ export class ShellIntegrationDetectionService implements IShellIntegrationDetect
151152
* Creates a dummy terminal so that we are guaranteed a data write event for this shell type.
152153
*/
153154
privatecreateDummyHiddenTerminal(shell:string){
154-
this.terminalManager.createTerminal({
155-
shellPath:shell,
156-
hideFromUser:true,
157-
});
155+
if(isTrusted()){
156+
this.terminalManager.createTerminal({
157+
shellPath:shell,
158+
hideFromUser:true,
159+
});
160+
}
158161
}
159162
}
160163

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp