-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Support shell integration in oh-my-zsh and powerlevel10k #146587
Comments
Having the same issue. |
Refs romkatv/powerlevel10k#1827 Out of curiosity, P10K explicitly disables the integration (as it does not work anyway and yet makes the prompt slower). So, if someone tries to debug this situation, make sure to comment out the following line before testing: P10k is extensively used (has almost 30k stars), so it would be very nice if VS Code can manage to make the Shell Integration work with it. |
We'd like to support it, the summary of the discussion/situation around this was:
We will probably at some point document the sequences (it's still getting stabilized and subject to change) or maybe support the more common sequences which would let it just work without additional changes. My main concern with supporting multiple shell integration protocols is them conflicting with each other, but that's probably the right thing to do and we could have a switch which disables the other protocol. |
Haven't tested this much but this seems promising after some trivial changes: Not sure yet why we're not getting the cwd sequence, I'm forcing shell integration on via |
Another problem is there doesn't seem to be a nice way to extract right prompt or continuations so this ends up happening: We could make some guesses by examining the content of the cells but that's not ideal. It would be a shame if we lost the fairly reliable extraction of the command since a lot of the interesting future functionality will be built on that like extension APIs and autocomplete. |
In general in zsh it's impossible to extract the command from the data written to the terminal. The command isn't always visible. For example, try entering a command that's taller than the height of the terminal (use ESC Enter or Alt-Enter to insert a line break). Or try running |
I'm willing to implement a VS Code-specific solution but I would need you to provide a spec of VS Code terminal extensions and promise backward compatibility. |
The feature that exposes the commands is not particularly discoverable but it works pretty great for the general case in all shells at the moment, I know there are edge cases when it will fall apart though. For pwsh the column and line are not reliable because of conpty so we do pass through the command line there and it works well:
Great, I wouldn't want you to without us committing to it 👍. We're still not at the stage where reliability will become more important so we're just passively thinking about this problem atm. I'll let you know if we'd like you to do that. For now we can just disable the parts that need the command which will still give us the markers/command navigation. I have a couple of questions that would save me a bunch of time if you know:
|
Sounds good.
Powerlevel10k doesn't set terminal title and doesn't report the current directory. These things aren't related to prompt and can be done separately. Powerlevel10k provides only prompt.
The best way is to set |
I put a PR out which should make the upcoming release #152995. With it, shell integration should work with powerlevel10k if it emits the more common standard OSC 133 A, B, C, D sequences. This won't give all the features but it will turn on command decorations with exit status, command navigation (ctrl/cmd+up/down) and the overview ruler. @romkatv if you could emit the OSC sequences for VS Code that would be great, checking $TERM_PROGRAM = vscode should be a reliable way of doing that. I'll let you know if we end up committing and documenting the sequences we use, in which case a command line sequence could light up more features. |
Awesome! Have you tried it? Powerlevel10k emits OSC 133 if you set
Powerlevel10k emits OSC 133 if users explicitly request it with |
@romkatv I installed the stable build of powerlevel10k and
That's perfect 👍. We have started using that variable to prevent recursing or calling the scripts multiple times, ie. so it works when it's injected by VS Code and installed manually: vscode/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh Lines 7 to 10 in 15ba463
|
Does this issue occur when all extensions are disabled?: Yes
Shell integration doesn't work with oh-my-zsh and powerlevel10k. The indicator is only shown for the first line and the disappear. Another problem is the warning from powerlevel10k about instant prompt (see attached screenshot)
Steps to Reproduce:
Screenshot:
The text was updated successfully, but these errors were encountered: