Skip to content

Use shell integration to denote success/failure #22487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 21, 2023
Prev Previous commit
Next Next commit
clean up
  • Loading branch information
anthonykim1 committed Nov 21, 2023
commit a0098282ff1e1705dd3a7f41d65ea4843eb5b0b5
12 changes: 0 additions & 12 deletions pythonFiles/normalizeSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,11 @@

import ast
import json

# import os
# import pathlib
import re
import sys
import textwrap
from typing import Iterable

# script_dir = pathlib.Path(
# "User/anthonykim/Desktop/vscode-python/pythonFiles/lib/python"
# )
# sys.path.append(os.fspath(script_dir))
# import debugpy

# debugpy.connect(5678)
# debugpy.breakpoint()


def split_lines(source):
"""
Expand Down
6 changes: 2 additions & 4 deletions pythonFiles/pythonrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def my_excepthook(self, type, value, traceback):
self.original_excepthook(type, value, traceback)


class PS1:
class ps1:
hooks = repl_hooks()
sys.excepthook = hooks.my_excepthook
sys.displayhook = hooks.my_displayhook
Expand All @@ -38,18 +38,16 @@ def __str__(self):
else:
exit_code = 0

# Pythonic way :)
result = f"{chr(27)}]633;D;{exit_code}0{chr(7)}{chr(27)}]633;A{chr(7)}{original_ps1}{chr(27)}]633;B{chr(7)}{chr(27)}]633;C{chr(7)}"

# result = "{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(
# command_finished="\x1b]633;D;" + str(exit_code) + "0\x07",
# prompt_started="\x1b]633;A\x07",
# prompt=original_ps1,
# command_start="\x1b]633;B\x07",
# # There's no preexec hook?
# command_executed="\x1b]633;C\x07",
# )
return result


sys.ps1 = PS1()
sys.ps1 = ps1()
2 changes: 1 addition & 1 deletion src/client/common/terminal/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class TerminalService implements ITerminalService, Disposable {
this.terminalShellType = this.terminalHelper.identifyTerminalShell(this.terminal);
this.terminal = this.terminalManager.createTerminal({
name: this.options?.title || 'Python',
env: { PYTHONSTARTUP: this.envVarScript }, // pass it down to terminalServiceFactory that will eventually pass the env to create terminal
env: { PYTHONSTARTUP: this.envVarScript },
hideFromUser: this.options?.hideFromUser,
});
this.terminalAutoActivator.disableAutoActivation(this.terminal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class TerminalCodeExecutionProvider implements ICodeExecutionService {
await this.getTerminalService(resource).sendText(code);
}
public async initializeRepl(resource: Resource) {
const terminalService = this.getTerminalService(resource); // pass in env here?
const terminalService = this.getTerminalService(resource);
if (this.replActive && (await this.replActive)) {
await terminalService.show();
return;
Expand Down