( uri: vscode.Uri, kind: string, message: string, )
| 108 | } |
| 109 | |
| 110 | async function showRunnableCodeLensError( |
| 111 | uri: vscode.Uri, |
| 112 | kind: string, |
| 113 | message: string, |
| 114 | ): Promise<void> { |
| 115 | const workspaceFolder = vscode.workspace.getWorkspaceFolder(uri); |
| 116 | const errorKey = `${kind}:${workspaceFolder?.uri.toString() ?? 'workspace'}`; |
| 117 | if (shownRunnableCodeLensErrors.has(errorKey)) { |
| 118 | return; |
| 119 | } |
| 120 | shownRunnableCodeLensErrors.add(errorKey); |
| 121 | const action = await vscode.window.showErrorMessage( |
| 122 | message, |
| 123 | OPEN_RUNNABLE_CODE_LENS_SETTING, |
| 124 | DISABLE_RUNNABLE_CODE_LENS, |
| 125 | ); |
| 126 | if (action === OPEN_RUNNABLE_CODE_LENS_SETTING) { |
| 127 | await vscode.commands.executeCommand( |
| 128 | 'workbench.action.openSettings', |
| 129 | 'python.pyrefly.runnableCodeLens', |
| 130 | ); |
| 131 | } else if (action === DISABLE_RUNNABLE_CODE_LENS) { |
| 132 | await disableRunnableCodeLens(uri); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | async function canImportModule( |
| 137 | interpreter: string, |
no test coverage detected