@@ -22,7 +22,7 @@ export function resolveScriptCommand$({
2222 ...result . value ,
2323 path . join ( extensionUri . fsPath , 'python' , 'scripts' , `${ tool } .py` ) ,
2424 ] ,
25- }
25+ } as const
2626 } ) ,
2727 )
2828}
@@ -37,9 +37,7 @@ export type ResolveScriptCommandResult =
3737 | SuccessResult < CommandArgs >
3838 | ErrorResult < 'NotFound' >
3939
40- function getPythonInterpreterPath$ (
41- resource : URI | undefined ,
42- ) : Observable < GetPythonInterpreterPathResult > {
40+ function getPythonInterpreterPath$ ( resource : URI | undefined ) {
4341 return defer ( async ( ) => getPythonExtensionApi ( ) ) . pipe (
4442 concatMap ( result => {
4543 if ( result . kind !== 'Success' ) return of ( result )
@@ -61,7 +59,7 @@ type GetPythonInterpreterPathResult =
6159 | SuccessResult < CommandArgs >
6260 | ErrorResult < 'NotFound' >
6361
64- async function getPythonExtensionApi ( ) : Promise < GetPythonExtensionApiResult > {
62+ async function getPythonExtensionApi ( ) {
6563 const pythonExtensionApi = await extensions
6664 . getExtension < PythonExtensionApi > ( 'ms-python.python' )
6765 ?. activate ( )
@@ -70,42 +68,31 @@ async function getPythonExtensionApi(): Promise<GetPythonExtensionApiResult> {
7068 return {
7169 kind : 'NotFoundError' ,
7270 message : 'Python extension not found.' ,
73- }
71+ } as const
7472
7573 await pythonExtensionApi . ready
7674
77- return { kind : 'Success' , value : pythonExtensionApi }
75+ return { kind : 'Success' , value : pythonExtensionApi } as const
7876}
7977
80- type GetPythonExtensionApiResult =
81- | SuccessResult < PythonExtensionApi >
82- | ErrorResult < 'NotFound' >
83-
84- function getPythonExecCommand ( {
85- api,
86- resource,
87- } : GetPythonExecCommandArgs ) : GetPythonExecCommandResult {
78+ function getPythonExecCommand ( { api, resource } : GetPythonExecCommandArgs ) {
8879 const command = api . settings . getExecutionDetails ( resource ) . execCommand
8980
9081 if ( isNil ( command ) || command . length === 0 )
9182 return {
9283 kind : 'NotFoundError' ,
9384 message :
9485 'Python interpreter cannot could not be retrieved from the Python extension.' ,
95- }
86+ } as const
9687
97- return { kind : 'Success' , value : [ ...command ] }
88+ return { kind : 'Success' , value : [ ...command ] } as const
9889}
9990
10091type GetPythonExecCommandArgs = {
10192 readonly api : PythonExtensionApi
10293 readonly resource : URI | undefined
10394}
10495
105- type GetPythonExecCommandResult =
106- | SuccessResult < string [ ] >
107- | ErrorResult < 'NotFound' >
108-
10996// Excerpt from: https://github.com/microsoft/vscode-python/blob/344c912a1c15d07eb9b14bf749c7529a7fa0877b/src/client/apiTypes.ts
11097type PythonExtensionApi = {
11198 ready : Promise < void >
0 commit comments