microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.38k stars 28.61k forks source link

Support fish shell integration automatic injection #139400

Closed Tyriar closed 1 year ago

Tyriar commented 2 years ago

Parent issue https://github.com/microsoft/vscode/issues/133084


Update: Activate the fish shell integration by following these instructions: https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation

We're keeping this open until automatic injection is looked into.

Tyriar commented 2 years ago

Deferring to focus on polishing how shell integration works in general

zgracem commented 2 years ago

Final implementation details aside, fish's event handing will make at least some of this dead easy:

# ~/.config/fish/conf.d/vscode-shellintegration.fish

function __vsc_esc # just a little helper
    builtin printf "\e]633;%s\a" (string join ";" $argv)
end

function __vsc_cmd_before --on-event fish_preexec
    __vsc_esc C
    __vsc_esc E "$argv"
end

function __vsc_cmd_after --on-event fish_postexec
    __vsc_esc D $status
end

function __vsc_update_cwd --on-event fish_prompt
    __vsc_esc P "Cwd=$PWD"
end

Some will be more difficult, at least to deploy auto-magically, because fish's prompts are the output of shell functions, not the contents of variables:

Fish does not use the $PS1, $PS2 and so on variables. Instead the prompt is the output of the fish_prompt function... and the fish_right_prompt function for the right prompt.

So to transparently preserve the user's original prompt, like the bash script does, would require modifying a shell function on-the-fly, not just a variable. Yikes.

That said, I put the above code, plus the following, in my own config—

# ~/.config/fish/conf.d/vscode-shellintegration.fish (cont'd.)

function __vsc_fish_prompt_before; __vsc_esc A; end
function __vsc_fish_prompt_after; __vsc_esc B; end
function __vsc_fish_rprompt_before; __vsc_esc H; end
function __vsc_fish_rprompt_after; __vsc_esc I; end

# ~/.config/fish/functions/fish_prompt.fish

function fish_prompt
    __vsc_fish_prompt_before
    # ...my existing code...
    __vsc_fish_prompt_after
end

# ~/.config/fish/functions/fish_right_prompt.fish

function fish_right_prompt
    __vsc_fish_rprompt_before
    # ...my existing code...
    __vsc_fish_rprompt_after
end

—and I had all of VS Code's documented shell integration features working perfectly with VS Code v1.70.0 + fish 3.5.1.

It's only a proof of concept, but hopefully this saves somebody a few web searches down the line, at least. :)

Tyriar commented 2 years ago

@zgracem very handy info thanks! The bash script handles both PS1 and PRONPT_COMMAND, might be able to wrap the function automatically in a similar way?

zgracem commented 2 years ago

@Tyriar Well, fish doesn't have PROMPT_COMMAND either: if you want something to run right before the prompt displays, you put it in a function with --on-event fish_prompt.

There is, alas, no event handler that runs after displaying the prompt but before accepting input (which is where you'd want CommandStart). There are also no events specific to the right-side prompt only.

FWIW, there's also no PS2 equivalent in fish—"instead it leaves the lines indented to show that the commandline isn’t complete yet"—but the lack of ContinuationStart and ContinuationEnd sequences in the above didn't seem to have any noticeable impact on VS Code's ability to parse the terminal in my testing.

Tyriar commented 2 years ago

@zgracem ah I see, I think this stuff should still work though. We actually don't currently use some of these positions and the 633 E sequence kind of removes the need for them all together. So if there are limitations like this we can just take note for the future, like when finalizing the sequences this month.

The limitations imposed on us by the Windows backend are much more frustrating to deal with than this sounds 🥲

If you want to put a PR out with just the script as a starting point (just the script) we could then give it a try and see if we can get it in as an experimental thing. I guess just manually installing until it's considered stable, plus the automatic injection was a handful for the other shells. You could also move the 633 A to just after 633 D, I'd expect that to work fine.

kidonng commented 2 years ago

I've been wanting to do this since last month, and @zgracem's comment finally motivated me to put up a fish plugin here: https://github.com/kidonng/vscode.fish

So to transparently preserve the user's original prompt, like the bash script does, would require modifying a shell function on-the-fly, not just a variable. Yikes.

The trick I have seen in kitty's automatic shell integration is that they wait for a fish_prompt event and then initialize the code, at which time the prompt function should be ready however they are defined.

Tyriar commented 2 years ago

@kidonng FYI those sequences may change as they are yet to be finalized (https://github.com/microsoft/vscode/issues/155639).

zgracem commented 2 years ago

@Tyriar Now that @kiddong has reminded me fish can do e.g. functions --copy fish_prompt _original_fish_prompt (which I just... totally blanked on yesterday 🤦🏼‍♀️), I think I could put together an experimental PR for this—one that could be easily tweaked if/when the escape sequences are finalized.

Tyriar commented 2 years ago

Also thanks to a PR from @babakks, the fish history file is now loaded so run recent command pulls from it when fish is active 🎉 https://github.com/microsoft/vscode/pull/156058

image

Tyriar commented 2 years ago

@zgracem that would be fantastic 👍

Tyriar commented 2 years ago

Thanks everyone! The script should be available in tomorrow's Insiders, see https://github.com/microsoft/vscode-docs/pull/5560 for manual install instructions (replace code with code-insiders) 🎉

I'll keep this issue open until we no longer consider it experimental.

jonasbb commented 2 years ago

@Tyriar The new fish_prompt function does not work properly in my case. My fish configuration uses a right prompt and shows the exit code of the command (green check mark). The exit code is always shown as good, even if the executed program returns a non-0 code. The right prompt is also misaligned. It is one line below where it is supposed to be.

Screenshot from 2022-08-31 12-26-29

https://github.com/microsoft/vscode/blob/8d28ffac6d57b230d74ff00ce1083c5867040902/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish#L113-L117

The status code issue seems to be caused by executing __vsc_fish_prompt_start first, because this will overwrite $status and $pipestatus. The misaligned right prompt seems to relate to some newline shenanigans fish does. It removes the last newline from the prompt, but since __vsc_fish_cmd_start is after the prompt it doesn't work any longer. I found these related links: https://github.com/kovidgoyal/kitty/issues/4032, https://github.com/kovidgoyal/kitty/commit/f277cbf3f3fe03cecaec7e619bf8d8970d945dfa

If I change the above snippet to this it seems to work better for me.

    # No fish_mode_prompt, so put everything in fish_prompt.
    function fish_prompt
      set --local prompt (__vsc_fish_prompt)
      __vsc_fish_prompt_start
      if set -q prompt[2]
        builtin printf '%s\n' $prompt[1..-2] # print all but last element of array, each followed by a new line
      end
      builtin printf '%s' $prompt[-1] # print the last component without a newline
      __vsc_fish_cmd_start
    end
Tyriar commented 2 years ago

@jonasbb thanks for the report! Do you want to submit a PR or should I try out the fix?

jonasbb commented 2 years ago

@Tyriar I am not interested in progressing this further or submitting a PR.

Tyriar commented 2 years ago

@jonasbb no worries, thanks for reporting 🙂

nickserv commented 1 year ago

Isn't this already done? https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation

Or is this about automatic integration?

Tyriar commented 1 year ago

@nickmccurdy I was keeping it open until the kinks were worked out, plus automatic injection would be great if it's possible. Not sure anyone has looked into it yet.

meganrogge commented 1 year ago

@Tyriar should we change the title of this issue or create a new one to capture automatic injection?

mkhl commented 1 year ago

i think the right way to add automatic injection would be to append a directory to XDG_DATA_DIRS that contains the integration script in a vendor_conf.d subdirectory (see https://github.com/fish-shell/fish-shell/blob/fa932533f2e7d8425f57dd14fcb0e01de2c9797f/share/config.fish#L60)

Tyriar commented 1 year ago

@mkhl we wouldn't be able to stick it in XDG_DATA_DIRS though in case a user has a file there already. Changing XDG_DATA_DIRS also seems dangerous and I think this would only work on Linux

mkhl commented 1 year ago

@Tyriar it sounds like you may be confused as to what XDG_DATA_DIRS is so i whipped up a pr for this, with links to the relevant spec and fish docs. alternatively i'm confused as to what you might mean.

@we wouldn't be able to stick it in XDG_DATA_DIRS though in case a user has a file there already.

XDG_DATA_DIRS is a set of directories to search for data files, ordered by preference. we'd be adding a directory to the end of it so what a user may already have there is irrelevant, and our directory would be part of the vscode distribution so the user really shouldn't have any files in there. aside from that user things go in XDG_DATA_HOME, XDG_DATA_DIRS is for system components.

Changing XDG_DATA_DIRS also seems dangerous

i'm not sure what danger you see there. we're adding another directory to find data files in; we're not preventing any other data files from being found.

and I think this would only work on Linux

this is documented universal fish behavior on any system it supports. i linked the literal default fish configuration above that demonstrates this. also back when i last used a mac most tools did support the xdg base directories, including fish (and nix, which makes rather heavy use of XDG_DATA_DIRS). the only ones that didn't still don't on linux (like electron 😒).

Tyriar commented 1 year ago

@mkhl oh it's a list of dirs, I thought this was setting a single dir. And you're right we don't need to worry about Windows here. Thanks, will check out the PR soon 👍

jonasbb commented 1 year ago

@Tyriar Since the issue is now closed, is the problem reported here https://github.com/microsoft/vscode/issues/139400#issuecomment-1232759033 something you would still want to fix? It doesn't seem to be fixed on main so far.

Tyriar commented 1 year ago

@jonasbb thanks for the reminder, I forked it off to https://github.com/microsoft/vscode/issues/169407

Tyriar commented 1 year ago

To verify:

mkhl commented 1 year ago

yep, works for me!

connor4312 commented 1 year ago

Unfortunately this does not work in a newly-installed fish shell via homebrew on macOS.

https://user-images.githubusercontent.com/2230985/214718214-9f07233e-730c-4a0c-a73d-89668faa807f.mp4

Pty host logs:

2023-01-25 15:42:28.109 [trace] IPty#resize 97 19
2023-01-25 15:42:28.560 [trace] ptyService#setLayoutInfo [{"isActive":true,"activePersistentProcessId":8,"terminals":[{"relativeSize":1,"terminal":8}]}]
2023-01-25 15:42:30.379 [trace] IPty#resize 70 19
2023-01-25 15:42:30.409 [trace] IPty#onData 

]633;A➜  node ]633;B
2023-01-25 15:42:30.416 [debug] CommandDetectionCapability#handlePromptStart 0 4
2023-01-25 15:42:30.416 [debug] CommandDetectionCapability#handleCommandStart 8 4
2023-01-25 15:42:30.433 [trace] persistentTerminalProcess#ctor 12 [object Arguments]
2023-01-25 15:42:30.434 [debug] MutationLogger "Persistent process "12" interaction state" set to "None", reason: initialized
2023-01-25 15:42:30.443 [trace] ptyService#start 12
2023-01-25 15:42:30.443 [trace] persistentTerminalProcess#start 12 false
2023-01-25 15:42:30.444 [trace] IPty#spawn /usr/local/bin/fish ["-l"] {"name":"xterm-256color","cwd":"/Users/connor/Github/js-debug-demos/node","env":{"MallocNanoZone":"0","USER":"connor","COMMAND_MODE":"unix2003","__CFBundleIdentifier":"com.microsoft.VSCodeInsiders","PATH":"/Users/connor/opt/anaconda3/condabin:/Users/connor/.nvm/versions/node/v16.16.0/bin:/opt/local/bin:/opt/local/sbin:/Users/connor/.elan/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Users/connor/.cargo/bin:/Users/copeet/.cargo/bin:./node_modules/.bin:/Users/connor/.elan/bin:/Users/connor/.dotnet:/Users/connor/Library/Python/3.10/bin","LOGNAME":"connor","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.0S61V0plIe/Listeners","HOME":"/Users/connor","SHELL":"/bin/zsh","TMPDIR":"/var/folders/q1/7d0txh0j6gg7gj9_wf70qcgm0000gn/T/","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCodeInsiders.89288079.89288085","XPC_FLAGS":"0x0","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","SHLVL":"0","PWD":"/","OLDPWD":"/","ZSH":"/Users/connor/.oh-my-zsh","PAGER":"less","LESS":"-R","LSCOLORS":"Gxfxcxdxbxegedabagacad","NVM_DIR":"/Users/connor/.nvm","NVM_CD_FLAGS":"-q","NVM_BIN":"/Users/connor/.nvm/versions/node/v16.16.0/bin","NVM_INC":"/Users/connor/.nvm/versions/node/v16.16.0/include/node","GPG_AGENT_INFO":"/tmp/gpg-r8reJH/S.gpg-agent:3492:1","CONDA_EXE":"/Users/connor/opt/anaconda3/bin/conda","CONDA_PYTHON_EXE":"/Users/connor/opt/anaconda3/bin/python","CONDA_SHLVL":"0","NVS_HOME":"/Users/connor/.nvs","NVS_ROOT":"/Users/connor/.nvs","NVS_OS":"darwin","NVS_USE_XZ":"1","PKG_CONFIG_PATH":":/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/libpq/lib/pkgconfig","_":"/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron","TERM_PROGRAM":"vscode","TERM_PROGRAM_VERSION":"1.75.0-insider","LANG":"en_US.UTF-8","COLORTERM":"truecolor","NODE_OPTIONS":"--require \"/Users/connor/Library/Application Support/Code - Insiders/User/workspaceStorage/fd17a064a6aa3bd02a30485dca7fd792/ms-vscode.js-debug-nightly/bootloader.js\" ","VSCODE_INSPECTOR_OPTIONS":":::{\"inspectorIpc\":\"/var/folders/q1/7d0txh0j6gg7gj9_wf70qcgm0000gn/T/node-cdp.51340-0.sock.deferred\",\"deferredMode\":true,\"waitForDebugger\":\"\",\"execPath\":\"/Users/connor/.nvm/versions/node/v16.16.0/bin/node\",\"onlyEntrypoint\":false,\"autoAttachMode\":\"smart\",\"aaPatterns\":[\"/Users/connor/Github/js-debug-demos/node/**\",\"!**/node_modules/**\",\"**/$KNOWN_TOOLS$/**\"]}","GIT_ASKPASS":"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass.sh","VSCODE_GIT_ASKPASS_NODE":"/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin)","VSCODE_GIT_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_GIT_ASKPASS_MAIN":"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass-main.js","VSCODE_GIT_IPC_HANDLE":"/var/folders/q1/7d0txh0j6gg7gj9_wf70qcgm0000gn/T/vscode-git-8519a0a448.sock","VSCODE_INJECTION":"1","XDG_DATA_DIRS":"/usr/local/share:/usr/share:/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/contrib/xdg_data"},"cols":66,"rows":19,"useConpty":false,"conptyInheritCursor":false}
2023-01-25 15:42:30.477 [trace] IPty#onData Welcome to fish, the friendly interactive shell
Type help(B for instructions on how to use fish

2023-01-25 15:42:30.484 [trace] IPty#onData [?2004h
2023-01-25 15:42:30.550 [trace] IPty#resize 70 19
2023-01-25 15:42:30.578 [trace] IPty#onData ]0;~/G/j/node(B
2023-01-25 15:42:30.578 [trace] IPty#onData 
connor(B@(BMacBook-Pro-2(B ~/G/j/node(B(B> 

2023-01-25 15:42:30.610 [trace] IPty#onData ]0;~/G/j/node(B
connor(B@(BMacBook-Pro-2(B ~/G/j/node(B(B> 

2023-01-25 15:42:30.972 [trace] ptyService#setLayoutInfo [{"isActive":false,"activePersistentProcessId":8,"terminals":[{"relativeSize":1,"terminal":8}]},{"isActive":true,"activePersistentProcessId":12,"terminals":[{"relativeSize":1,"terminal":12}]}]
2023-01-25 15:42:31.308 [debug] MutationLogger "Persistent process "12" interaction state" set to "Session", reason: input
2023-01-25 15:42:31.308 [trace] IPty#write e
2023-01-25 15:42:31.309 [trace] IPty#onData e

2023-01-25 15:42:31.309 [trace] IPty#onData cho "asdf"
(B
2023-01-25 15:42:31.310 [trace] IPty#onData echo "asdf"
(B
2023-01-25 15:42:31.389 [trace] IPty#write c
2023-01-25 15:42:31.390 [trace] IPty#onData cho "asdf"
(B
2023-01-25 15:42:31.396 [trace] IPty#write h
2023-01-25 15:42:31.396 [trace] IPty#onData ho "asdf"
(B
2023-01-25 15:42:31.484 [trace] IPty#write o
2023-01-25 15:42:31.485 [trace] IPty#onData o "asdf"
(B
2023-01-25 15:42:31.485 [trace] IPty#onData echo "asdf"
(B
2023-01-25 15:42:31.628 [trace] IPty#write  
2023-01-25 15:42:31.628 [trace] IPty#onData  "asdf"
(B
2023-01-25 15:42:31.628 [trace] IPty#onData  "asdf"
(B
2023-01-25 15:42:31.839 [trace] IPty#write "
2023-01-25 15:42:31.839 [trace] IPty#onData "asdf"
(B
2023-01-25 15:42:31.839 [trace] IPty#onData "asdf"
(B
2023-01-25 15:42:31.850 [trace] IPty#write :
2023-01-25 15:42:31.851 [trace] IPty#onData :(B

2023-01-25 15:42:31.851 [trace] IPty#onData :
(B
2023-01-25 15:42:31.872 [trace] IPty#onData cat.js" 
(B
2023-01-25 15:42:31.917 [trace] IPty#write a
2023-01-25 15:42:31.918 [trace] IPty#onData a(B

2023-01-25 15:42:31.931 [trace] IPty#write s
2023-01-25 15:42:31.931 [trace] IPty#onData s
(B
2023-01-25 15:42:31.971 [trace] IPty#write d
2023-01-25 15:42:31.971 [trace] IPty#onData d
(B
2023-01-25 15:42:32.011 [trace] IPty#write f
2023-01-25 15:42:32.011 [trace] IPty#onData f
(B
2023-01-25 15:42:32.780 [trace] IPty#write "
2023-01-25 15:42:32.780 [trace] IPty#onData "
(B
2023-01-25 15:42:32.780 [trace] IPty#onData ":asdf"
(B
2023-01-25 15:42:33.196 [trace] IPty#write 
2023-01-25 15:42:33.196 [trace] IPty#onData 

2023-01-25 15:42:33.197 [trace] IPty#onData (B[?2004l
2023-01-25 15:42:33.198 [trace] IPty#onData ]0;echo ":asdf" ~/G/j/node(B
2023-01-25 15:42:33.198 [trace] IPty#onData :asdf
⏎(B                                                                     
⏎ 

2023-01-25 15:42:33.198 [trace] IPty#onData [?2004h
2023-01-25 15:42:33.232 [trace] IPty#onData ]0;~/G/j/node(B
2023-01-25 15:42:33.232 [trace] IPty#onData connor(B@(BMacBook-Pro-2(B ~/G/j/node(B(B> 

2023-01-25 15:42:35.197 [trace] IPty#pid
meganrogge commented 1 year ago

what's your FISH_VERSION @connor4312 ? Also what is the output of code-insiders --locate-shell-integration-path fish?

meganrogge commented 1 year ago

works for me with this info:

Screenshot 2023-01-26 at 10 54 39 AM

Tyriar commented 1 year ago

@meganrogge did you manually install shell integration? This issue is about automatic injection, the update in the original issue was to help users manually activate it before this was done.

meganrogge commented 1 year ago

Yes I did

meganrogge commented 1 year ago

and disabled automatic injection (set terminal.integrated.shellIntegration.enabled: false) as you see in the screenshot. it also works for me in a subshell, so I know that i'm testing / verifying manual injection

meganrogge commented 1 year ago

it also works for me with automatic injection

connor4312 commented 1 year ago

FISH_VERSION is 3.6.0, and the shell integration path is

/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish
Tyriar commented 1 year ago

Looking at the code it doesn't look like we actually copy a file to out/vs/workbench/contrib/xdg_data:

https://github.com/microsoft/vscode/blob/e72968afc68d9f80eb1d872637305c3a256a413b/src/vs/platform/terminal/node/terminalEnvironment.ts#L171-L175

🤔

connor4312 commented 1 year ago

hm, the path does appear to exist

image

Manually executing it with fish results in an exit code of 1 and no output, however

meganrogge commented 1 year ago

yeah I think what happened was I already had the injection config in my fish file when I tested automatic injection - likely from testing manual injection at one pt

mkhl commented 1 year ago

Argh, I had removed the manual integration but still have other FinalTerm-compatible shell integration and probably thought this was working because of that 😔On 26. Jan 2023, at 18:19, Megan Rogge @.***> wrote: yeah I think what happened was I already had the injection config in my fish file when I tested automatic injection - likely from testing manual injection at one pt

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Tyriar commented 1 year ago

To verify make sure you don't manually activate shell integration in your config.fish, then check with and without terminal.integrated.shellIntegration.enabled and make sure shell integration works and doesn't work respectively.

roblourens commented 1 year ago

When I open a terminal in the fish shell and run some commands, then run "Run recent command", the commands in the fish terminal don't show up, I assume that means it's not working for me

Tyriar commented 1 year ago

@roblourens works for me:

Screenshot 2023-05-30 at 2 43 13 pm

Do you see the grey/blue/red dot?

roblourens commented 1 year ago

No, I guess shell integration is not enabled in the fish profile, I'm not sure how to troubleshoot that.

nickserv commented 1 year ago

Is there supposed to be automatic integration in stable VSCode now? It doesn't seem to be working for me, but manual integration still does.

No, I guess shell integration is not enabled in the fish profile, I'm not sure how to troubleshoot that.

@roblourens Open ~/.config/fish/config.fish and make sure it contains the manual integration code:

string match -q "$TERM_PROGRAM" "vscode"
and . (code --locate-shell-integration-path fish)
Tyriar commented 1 year ago

@nickmccurdy he's trying to test the newly fixed automatic injection in Insiders

Tyriar commented 1 year ago

@roblourens can you run echo $XDG_DATA_DIRS? Also enabling trace logs and getting the pty host log when launching would be helpful (be mindful of any sensitive environment variables)

roblourens commented 1 year ago

Here's my pty host log which includes $XDG_DATA_DIRS

2023-05-31 15:26:49.557 [warning] Persistent process "1": Process had no disconnect runners but was an orphan
2023-05-31 15:26:49.562 [info] Persistent process reconnection "1"
2023-05-31 15:26:49.564 [warning] Persistent process "2": Process had no disconnect runners but was an orphan
2023-05-31 15:26:49.565 [info] Persistent process reconnection "2"
2023-05-31 15:26:49.566 [warning] Persistent process "3": Process had no disconnect runners but was an orphan
2023-05-31 15:26:49.566 [info] Persistent process reconnection "3"
2023-05-31 15:26:49.666 [info] Persistent process "1": Replaying 2800 chars and 1 size events
2023-05-31 15:26:49.723 [info] Persistent process "2": Replaying 176 chars and 1 size events
2023-05-31 15:26:49.741 [info] Persistent process "3": Replaying 919 chars and 1 size events
2023-05-31 15:27:35.251 [trace] persistentTerminalProcess#detach 4 false
2023-05-31 15:27:35.252 [trace] IPty#kill
2023-05-31 15:27:35.253 [trace] persistentTerminalProcess#detach 5 false
2023-05-31 15:27:39.095 [trace] ptyService#getLayoutInfo {"workspaceId":"8338a30b496627da2895dbdd30a6acb8"}
2023-05-31 15:27:39.099 [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
2023-05-31 15:27:39.099 [trace] IPty#pid
2023-05-31 15:27:39.101 [trace] ptyService#returnLayoutInfo [{"isActive":true,"activePersistentProcessId":5,"terminals":[{"terminal":{"id":5,"title":"fish","titleSource":2,"pid":10945,"workspaceId":"8338a30b496627da2895dbdd30a6acb8","workspaceName":"jupyter","cwd":"/datadrive/jupyter","isOrphan":true,"icon":{"id":"terminal","defaults":{"fontCharacter":"\\ea85"}},"environmentVariableCollections":[["ms-python.python",[["PYTHONUNBUFFERED",{"variable":"PYTHONUNBUFFERED","value":"1","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["PYTHONIOENCODING",{"variable":"PYTHONIOENCODING","value":"utf-8","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VIRTUAL_ENV",{"variable":"VIRTUAL_ENV","value":"/datadrive/jupyter/.venv","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["SHLVL",{"variable":"SHLVL","value":"3","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["PATH",{"variable":"PATH","value":"/datadrive/jupyter/.venv/bin:/home/roblou/bashrc:/home/roblou/.cargo/bin:/home/roblou/.local/bin:/home/roblou/bin:/dotprofile:/home/roblou/.cargo/bin:/home/roblou/.local/bin:/home/roblou/bin:/home/roblou/bashrc:/home/roblou/.nvm/versions/node/v16.14.2/bin:/dotprofile:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["PS1",{"variable":"PS1","value":"(.venv) ","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["_",{"variable":"_","value":"/datadrive/jupyter/.venv/bin/python","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}]],[]],["vscode.git",[["GIT_ASKPASS",{"variable":"GIT_ASKPASS","value":"/snap/code-insiders/1310/usr/share/code-insiders/resources/app/extensions/git/dist/askpass.sh","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_NODE",{"variable":"VSCODE_GIT_ASKPASS_NODE","value":"/snap/code-insiders/1310/usr/share/code-insiders/code-insiders","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_EXTRA_ARGS",{"variable":"VSCODE_GIT_ASKPASS_EXTRA_ARGS","value":"--ms-enable-electron-run-as-node","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_MAIN",{"variable":"VSCODE_GIT_ASKPASS_MAIN","value":"/snap/code-insiders/1310/usr/share/code-insiders/resources/app/extensions/git/dist/askpass-main.js","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_IPC_HANDLE",{"variable":"VSCODE_GIT_IPC_HANDLE","value":"/run/user/1000/vscode-git-e70ddd7ed3.sock","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}]],[]]],"hasChildProcesses":false,"shellIntegrationNonce":"4719e4fe-bae2-4a4b-b02f-eaf6329cb786"},"relativeSize":1}]}]
2023-05-31 15:27:40.280 [trace] persistentTerminalProcess#attach 5
2023-05-31 15:27:40.281 [info] Persistent process reconnection "5"
2023-05-31 15:27:40.304 [trace] ptyService#start 5
2023-05-31 15:27:40.304 [trace] persistentTerminalProcess#start 5 true
2023-05-31 15:27:40.311 [info] Persistent process "5": Replaying 494 chars and 1 size events
2023-05-31 15:27:40.311 [trace] Flow control: Cleared all unacknowledged chars, forcing resume
2023-05-31 15:27:40.354 [trace] IPty#resize 80 30
2023-05-31 15:27:40.360 [trace] IPty#onData ]0;fis
2023-05-31 15:27:40.361 [trace] IPty#onData h  /datadrive/jupyter(B

2023-05-31 15:27:40.362 [trace] IPty#onData roblou@robfast /d/jupyter(B> 
2023-05-31 15:27:40.958 [trace] ptyService#setLayoutInfo [{"isActive":true,"activePersistentProcessId":5,"terminals":[{"relativeSize":0,"terminal":5}]}]
2023-05-31 15:27:50.178 [trace] IPty#resize 145 27
2023-05-31 15:27:50.180 [trace] IPty#onData 
2023-05-31 15:27:50.182 [trace] IPty#onData ]0;fish  /datadrive/
2023-05-31 15:27:50.182 [trace] IPty#onData jupyter(B

roblou@robfast /d/jupyter(B> 
2023-05-31 15:27:50.723 [trace] ptyService#setLayoutInfo [{"isActive":true,"activePersistentProcessId":5,"terminals":[{"relativeSize":1,"terminal":5}]}]
2023-05-31 15:27:54.109 [trace] IPty#resize 133 28
2023-05-31 15:27:54.113 [trace] IPty#onData ]0;fish  /datadrive/jupyter
2023-05-31 15:27:54.114 [trace] IPty#onData (B

roblou@robfast /d/jupyter(B> 
2023-05-31 15:27:54.174 [trace] persistentTerminalProcess#ctor 6 [object Arguments]
2023-05-31 15:27:54.180 [debug] MutationLogger "Persistent process "6" interaction state" set to "None", reason: initialized
2023-05-31 15:27:54.216 [trace] ptyService#start 6
2023-05-31 15:27:54.216 [trace] persistentTerminalProcess#start 6 false
2023-05-31 15:27:54.218 [trace] IPty#spawn /usr/bin/fish [] {"name":"xterm-256color","cwd":"/datadrive/jupyter","env":{"VNCDESKTOP":"robfast.nhgzsvf1fvxejaw4kclr0gvfpf.dx.internal.cloudapp.net:1 (roblou)","LESSOPEN":"| /usr/bin/lesspipe %s","MAIL":"/var/mail/roblou","USER":"roblou","SSH_CLIENT":"187.189.212.34 24549 22","GIO_MODULE_DIR":"/home/roblou/snap/code-insiders/common/.cache/gio-modules","DEBUG":"1","SSH_AGENT_PID":"31436","SHLVL":"3","HOME":"/home/roblou","DESKTOP_SESSION":"xfce","GTK_PATH":"/snap/code-insiders/1310/usr/lib/x86_64-linux-gnu/gtk-3.0","SSH_TTY":"/dev/pts/1","NVM_BIN":"/home/roblou/.nvm/versions/node/v16.14.2/bin","GTK_IM_MODULE_FILE":"/home/roblou/snap/code-insiders/common/.cache/immodules/immodules.cache","BASHRC":"yes","GTK_MODULES":"gail:atk-bridge","DBUS_SESSION_BUS_ADDRESS":"unix:path=/run/user/1000/bus","COLORTERM":"truecolor","GLADE_MODULE_PATH":":","LC_TERMINAL_VERSION":"3.4.8","VSC_LAUNCHER_GITHUB_TOKEN":"snip","NVM_DIR":"/home/roblou/.nvm","DOTPROFILE":"yes","_BASH_RC_COUNTER":"+++","LOGNAME":"roblou","XDG_SESSION_ID":"12448","TERM":"xterm-256color","PATH":"/datadrive/jupyter/.venv/bin:/home/roblou/bashrc:/home/roblou/.cargo/bin:/home/roblou/.local/bin:/home/roblou/bin:/dotprofile:/home/roblou/.cargo/bin:/home/roblou/.local/bin:/home/roblou/bin:/home/roblou/bashrc:/home/roblou/.nvm/versions/node/v16.14.2/bin:/dotprofile:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin","GLADE_PIXMAP_PATH":":","GTK_EXE_PREFIX":"/snap/code-insiders/1310/usr","SESSION_MANAGER":"local/robfast:@/tmp/.ICE-unix/31426,unix/robfast:/tmp/.ICE-unix/31426","XDG_MENU_PREFIX":"xfce-","GNOME_TERMINAL_SCREEN":"/org/gnome/Terminal/screen/b2b28d11_28d2_4ed2_877e_30dbaef098de","XDG_RUNTIME_DIR":"/run/user/1000","DISPLAY":":1.0","LOCPATH":"/snap/code-insiders/1310/usr/lib/locale","LANG":"C.UTF-8","XDG_CURRENT_DESKTOP":"XFCE","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:","GNOME_TERMINAL_SERVICE":":1.1091221","SSH_AUTH_SOCK":"/tmp/ssh-uH4iruTxftbx/agent.31435","GLADE_CATALOG_PATH":":","GSETTINGS_SCHEMA_DIR":"/home/roblou/snap/code-insiders/1310/.local/share/glib-2.0/schemas","SHELL":"/bin/bash","QT_ACCESSIBILITY":"1","LESSCLOSE":"/usr/bin/lesspipe %s %s","LC_TERMINAL":"iTerm2","LC_ALL":"en_US.UTF-8","PWD":"/home/roblou","SSH_CONNECTION":"187.189.212.34 24549 10.0.0.6 22","NVM_CD_FLAGS":"","XDG_DATA_DIRS":"/home/roblou/snap/code-insiders/1310/.local/share:/home/roblou/snap/code-insiders/1310:/snap/code-insiders/1310/usr/share:/usr/share/xfce4:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share:/snap/code-insiders/1310/usr/share/code-insiders/resources/app/out/vs/workbench/contrib/terminal/browser/media/fish_xdg_data","XDG_CONFIG_DIRS":"/etc/xdg","VTE_VERSION":"5202","CHROME_DESKTOP":"code-insiders-url-handler.desktop","ORIGINAL_XDG_CURRENT_DESKTOP":"XFCE","GDK_BACKEND":"x11","TERM_PROGRAM":"vscode","TERM_PROGRAM_VERSION":"1.79.0-insider","PYTHONUNBUFFERED":"1","PYTHONIOENCODING":"utf-8","VIRTUAL_ENV":"/datadrive/jupyter/.venv","PS1":"(.venv) ","_":"/datadrive/jupyter/.venv/bin/python","GIT_ASKPASS":"/snap/code-insiders/1310/usr/share/code-insiders/resources/app/extensions/git/dist/askpass.sh","VSCODE_GIT_ASKPASS_NODE":"/snap/code-insiders/1310/usr/share/code-insiders/code-insiders","VSCODE_GIT_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_GIT_ASKPASS_MAIN":"/snap/code-insiders/1310/usr/share/code-insiders/resources/app/extensions/git/dist/askpass-main.js","VSCODE_GIT_IPC_HANDLE":"/run/user/1000/vscode-git-e70ddd7ed3.sock","VSCODE_INJECTION":"1","VSCODE_NONCE":"585e9f12-902b-4984-9d3d-a78cbc5cb266"},"cols":131,"rows":28,"useConpty":false,"conptyInheritCursor":false}
2023-05-31 15:27:54.243 [trace] IPty#onData ]0;fish  /datadrive/jupyter(B
2023-05-31 15:27:54.248 [trace] IPty#onData Welcome to fish, the friendly interactive shell

2023-05-31 15:27:54.258 [trace] IPty#onData [?2004h
2023-05-31 15:27:54.261 [trace] IPty#onData ]7;file://robfast/datadrive/jupyter
2023-05-31 15:27:54.264 [trace] IPty#resize 133 28
2023-05-31 15:27:54.274 [trace] IPty#onData ]0;fish  /datadrive/jupyter
2023-05-31 15:27:54.275 [trace] IPty#onData (B⏎(B                                                                                                                                    
⏎ 
roblou@robfast /d/jupyter(B> 
2023-05-31 15:27:54.277 [trace] IPty#onData ]0;fish  /datadrive/jupyter
2023-05-31 15:27:54.278 [trace] IPty#onData (B
roblou@robfast /d/jupyter(B> 
2023-05-31 15:27:54.760 [trace] ptyService#setLayoutInfo [{"isActive":false,"activePersistentProcessId":5,"terminals":[{"relativeSize":1,"terminal":5}]},{"isActive":true,"activePersistentProcessId":6,"terminals":[{"relativeSize":1,"terminal":6}]}]
2023-05-31 15:27:55.751 [trace] ptyService#shutDown 5 false
2023-05-31 15:27:55.829 [trace] IPty#resize 133 28
2023-05-31 15:27:55.979 [trace] IPty#resize 147 28
2023-05-31 15:27:55.982 [trace] IPty#onData ]0;fish  /datadrive/jupyter(B
2023-05-31 15:27:55.982 [trace] IPty#onData 
roblou@robfast /d/jupyter(B> 
2023-05-31 15:27:56.002 [trace] IPty#kill
2023-05-31 15:27:56.003 [trace] IPty#onData 
(B[?2004l
2023-05-31 15:27:56.470 [trace] ptyService#setLayoutInfo [{"isActive":true,"activePersistentProcessId":6,"terminals":[{"relativeSize":1,"terminal":6}]}]
2023-05-31 15:27:57.003 [debug] MutationLogger "Persistent process "6" interaction state" set to "Session", reason: input
2023-05-31 15:27:57.003 [trace] IPty#write [200~>[201~
2023-05-31 15:27:57.006 [trace] IPty#onData >
2023-05-31 15:27:57.009 [trace] IPty#onData ]0;fish  /datadrive/jupyter(B
2023-05-31 15:27:57.009 [trace] IPty#onData 
roblou@robfast /d/jupyter(B> >>(B
2023-05-31 15:27:57.011 [trace] IPty#onData egret.jpg (B
2023-05-31 15:27:58.393 [trace] IPty#write 
2023-05-31 15:27:58.396 [trace] IPty#onData ^C(B
2023-05-31 15:27:58.398 [trace] IPty#onData 
2023-05-31 15:27:58.401 [trace] IPty#onData 

2023-05-31 15:27:58.406 [trace] IPty#onData ]0;fish  /datadrive/jupyter(B
roblou@robfast /d/jupyter(B> 
2023-05-31 15:27:59.888 [trace] IPty#write [200~>[201~
2023-05-31 15:27:59.891 [trace] IPty#onData >
2023-05-31 15:27:59.893 [trace] IPty#onData ]0;fish  /datadrive/jupyter(B
2023-05-31 15:27:59.894 [trace] IPty#onData roblou@robfast /d/jupyter(B> >>(B
2023-05-31 15:27:59.895 [trace] IPty#onData egret.jpg (B
2023-05-31 15:28:00.829 [trace] IPty#write 
2023-05-31 15:28:00.829 [trace] IPty#onData 
2023-05-31 15:28:12.114 [trace] IPty#resize 147 38
2023-05-31 15:28:12.118 [trace] IPty#onData 
2023-05-31 15:28:12.118 [trace] IPty#onData ]
2023-05-31 15:28:12.119 [trace] IPty#onData 0
2023-05-31 15:28:12.119 [trace] IPty#onData ;
2023-05-31 15:28:12.120 [trace] IPty#onData f
2023-05-31 15:28:12.121 [trace] IPty#onData ish  /datadrive/jupyter(B
2023-05-31 15:28:12.122 [trace] IPty#onData roblou@robfast /d/jupyter(B> 
2023-05-31 15:28:12.603 [trace] ptyService#setLayoutInfo [{"isActive":true,"activePersistentProcessId":6,"terminals":[{"relativeSize":1,"terminal":6}]}]
2023-05-31 15:28:17.787 [trace] IPty#write [200~echo $XDG_DATA_DIRS[201~
2023-05-31 15:28:17.790 [trace] IPty#onData echo $XDG_DATA_DIRS
2023-05-31 15:28:17.792 [trace] IPty#onData ]0;fish  /datadrive/jupyter
2023-05-31 15:28:17.793 [trace] IPty#onData (B
roblou@robfast /d/jupyter(B> echo $XDG_DATA_DIRSecho(B $XDG_DATA_DIRS(B
2023-05-31 15:28:18.524 [trace] IPty#write 
2023-05-31 15:28:18.524 [trace] IPty#onData 
(B
2023-05-31 15:28:18.525 [trace] IPty#onData [?2004l]0;echo  /datadrive/jup
2023-05-31 15:28:18.526 [trace] IPty#onData yter(B
/home/roblou/snap/code-insiders/1310/.local/share:/home/roblou/snap/code-insiders/1310:/snap/code-insiders/1310/usr/share:/usr/share/xfce4:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share:/snap/code-insiders/1310/usr/share/code-insiders/resources/app/out/vs/workbench/contrib/terminal/browser/media/fish_xdg_data
[?2004h
2023-05-31 15:28:18.528 [trace] IPty#onData ]0;fish  /datadrive/jupyter(B
2023-05-31 15:28:18.529 [trace] IPty#onData ⏎(B                                                                                                                                                  
⏎ 
roblou@robfast /d/jupyter(B> 
meganrogge commented 1 year ago

this isn't working for me after I removed my $XDG_DATA_DIRS

Screenshot 2023-05-31 at 8 05 35 PM

Tyriar commented 1 year ago

@meganrogge what do you mean by removed your XDG_DATA_DIRS?


@roblourens weird, it's there so it should be run afaik.

"XDG_DATA_DIRS":"/home/roblou/snap/code-insiders/1310/.local/share:/home/roblou/snap/code-insiders/1310:/snap/code-insiders/1310/usr/share:/usr/share/xfce4:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share:/snap/code-insiders/1310/usr/share/code-insiders/resources/app/out/vs/workbench/contrib/terminal/browser/media/fish_xdg_data"

@mkhl any idea what could be going wrong here wrt the XDG_DATA_DIR auto activation?

meganrogge commented 1 year ago

I think I had manually enabled fish shell integration which is why it was working. In order to undo that, to test automatic injection, I removed that directory. Then it didn't work

meganrogge commented 1 year ago

IE my expectation was after undoing manual injection, it would work automatically. That wasn't the case.