Skip to content

Commit 639b6e3

Browse files
author
Kartik Raj
committed
Attempt to contribute a resolver
1 parent 7e6eb78 commit 639b6e3

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

src/client/apiTypes.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,6 @@ type VersionInfo = {
115115
export interface EnvironmentDetails {
116116
executable: {
117117
path: string;
118-
run: {
119-
// Functions would only require the arguments. The env provider can internally decide on the commands.
120-
// Support option of whether to run as a process or VSCode terminal.
121-
// However note we cannot pass this into the debugger at the moment, as VSCode itself handles execution.
122-
// Gotta add support in VSCode for that, they already support that for LSP.
123-
// TODO: Gotta support this for upstream debugger
124-
exec: Function;
125-
shellExec: Function; // Only for backwards compatibility.
126-
execObservable: Function;
127-
/**
128-
* Uses a VSCode terminal.
129-
* */
130-
terminalExec: () => void;
131-
/**
132-
* Any environment variables that can be used to activate the environment, if supported.
133-
* If not provided, Python extension itself uses the other execution APIs to calculate it.
134-
*/
135-
env?: { [key: string]: string | null | undefined };
136-
};
137118
bitness?: Architecture;
138119
sysPrefix: string;
139120
};
@@ -164,10 +145,15 @@ type EnvironmentDetailsByProvider = Partial<EnvironmentDetails> & Pick<Environme
164145

165146
interface IEnvironmentProvider {
166147
createLocator: ILocatorFactory;
167-
getEnvironmentDetails: (env: EnvInfo) => Promise<EnvironmentDetailsByProvider | undefined>;
148+
canIdentifyEnvironment: (env: BaseEnvInfo) => Promise<boolean>;
149+
/**
150+
* This is only called if this provider can identify the environment.
151+
* Returns details or `undefined` if it was found if env is invalid.
152+
*/
153+
getEnvironmentDetails: (env: BaseEnvInfo) => Promise<EnvironmentDetailsByProvider | undefined>;
168154
}
169155

170-
export type ILocatorFactory = INonWorkspaceLocatorFactory | IWorkspaceLocatorFactory;
156+
export type ILocatorFactory = IWorkspaceLocatorFactory | INonWorkspaceLocatorFactory;
171157
export type INonWorkspaceLocatorFactory = () => ILocatorAPI;
172158
export type IWorkspaceLocatorFactory = (root: string) => ILocatorAPI;
173159

@@ -176,8 +162,11 @@ export interface ILocatorAPI {
176162
readonly onChanged?: Event<LocatorEnvsChangedEvent>;
177163
}
178164

179-
export type EnvInfo = {
165+
export type EnvInfo = BaseEnvInfo & {
180166
envSources: EnvSource[];
167+
};
168+
169+
export type BaseEnvInfo = {
181170
executablePath: string;
182171
envPath?: string;
183172
};

0 commit comments

Comments
 (0)