MCPcopy Create free account
hub / github.com/facebook/pyrefly / runMainFile

Function runMainFile

lsp/src/codeLens.ts:218–243  ·  view source on GitHub ↗
(
  args: RunMainArgs,
  pythonEnv: PythonEnvironment,
)

Source from the content-addressed store, hash-verified

216}
217
218async function runMainFile(
219 args: RunMainArgs,
220 pythonEnv: PythonEnvironment,
221): Promise<void> {
222 const uri = parseUri(args.uri);
223 if (!uri) {
224 return;
225 }
226 const interpreter = await pythonEnv.getInterpreterPath(uri);
227 if (!interpreter) {
228 void showRunnableCodeLensError(
229 uri,
230 'missing-interpreter',
231 'Pyrefly could not determine a Python interpreter for this file. Ensure the correct interpreter is selected in your IDE before using runnable CodeLens.',
232 );
233 return;
234 }
235 await executeProcessTask(
236 uri,
237 args.cwd,
238 {type: TASK_SOURCE, action: 'runMain'},
239 'Pyrefly: Run File',
240 interpreter,
241 [uri.fsPath],
242 );
243}
244
245async function runTestAtLocation(
246 args: RunTestArgs,

Callers 1

registerCodeLensCommandsFunction · 0.85

Calls 4

parseUriFunction · 0.85
executeProcessTaskFunction · 0.85
getInterpreterPathMethod · 0.80

Tested by

no test coverage detected