You've already forked inshellisense
mirror of
https://github.com/wavetermdev/inshellisense.git
synced 2026-04-22 15:25:33 -07:00
ce8025aaed
* feat: implement xonsh support (partial) Signed-off-by: Chapman Pendery <cpendery@vt.edu> * feat: implement xonsh support (partial) Signed-off-by: Chapman Pendery <cpendery@vt.edu> * refactor: xonsh support to work with new shell integration mechanism Signed-off-by: Chapman Pendery <cpendery@vt.edu> * build: drop old xonsh integration Signed-off-by: Chapman Pendery <cpendery@vt.edu> * feat: enable xonsh testing Signed-off-by: Chapman Pendery <cpendery@vt.edu> * fix: generator test Signed-off-by: Chapman Pendery <cpendery@vt.edu> * fix: newline chars Signed-off-by: Chapman Pendery <cpendery@vt.edu> * fix: drop only clause Signed-off-by: Chapman Pendery <cpendery@vt.edu> --------- Signed-off-by: Chapman Pendery <cpendery@vt.edu>
29 lines
833 B
Plaintext
29 lines
833 B
Plaintext
import os
|
|
|
|
def __is_prompt_start() -> str:
|
|
return "\001" + "\x1b]6973;PS\x07"
|
|
|
|
|
|
def __is_prompt_end() -> str:
|
|
return "\001" + "\x1b]6973;PE\x07" + "\002"
|
|
|
|
|
|
def __is_escape_value(value: str) -> str:
|
|
byte_list = [bytes([byte]).decode("utf-8") for byte in list(value.encode("utf-8"))]
|
|
return "".join(
|
|
[
|
|
"\\x3b" if byte == ";" else "\\\\" if byte == "\\" else byte
|
|
for byte in byte_list
|
|
]
|
|
)
|
|
|
|
def __is_update_cwd() -> str:
|
|
return f"\x1b]6973;CWD;{__is_escape_value(os.getcwd())}\x07" + "\002"
|
|
|
|
$PROMPT_FIELDS['__is_prompt_start'] = __is_prompt_start
|
|
$PROMPT_FIELDS['__is_prompt_end'] = __is_prompt_end
|
|
$PROMPT_FIELDS['__is_update_cwd'] = __is_update_cwd
|
|
if $ISTERM_TESTING:
|
|
$PROMPT = "> "
|
|
|
|
$PROMPT = "{__is_prompt_start}{__is_update_cwd}" + $PROMPT + "{__is_prompt_end}" |