Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python_files/normalizeSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ def traverse_file(whole_file_content, start_line, end_line, was_highlighted): #

try:
parsed_file_content = ast.parse(whole_file_content)
except Exception:
# Handle case where user is attempting to run code where file contains deprecated Python code.
except Exception as e:
# Handle case where user is attempting to run code where file contains invalid Python code.
# Let typescript side know and show warning message.
return {
"normalized_smart_result": "deprecated",
"normalized_smart_result": repr("vscode-python error: " + repr(e)),
"which_line_next": 0,
}

Expand Down Expand Up @@ -289,7 +289,7 @@ def get_next_block_lineno(which_line_next):
)
normalized = result["normalized_smart_result"]
which_line_next = result["which_line_next"]
if normalized == "deprecated":
if "vscode-python error: " in normalized:
data = json.dumps(
{"normalized": normalized, "attach_bracket_paste": attach_bracket_paste}
)
Expand Down
2 changes: 1 addition & 1 deletion src/client/terminals/codeExecution/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
const result = await normalizeOutput.promise;
const object = JSON.parse(result);

if (activeEditor?.selection && smartSendSettingsEnabledVal && object.normalized !== 'deprecated') {
if (activeEditor?.selection && smartSendSettingsEnabledVal && !object.normalized.includes('vscode-python error: ')) {
const lineOffset = object.nextBlockLineno - activeEditor!.selection.start.line - 1;
await this.moveToNextBlock(lineOffset, activeEditor);
}
Expand Down
Loading