JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.01k stars 2.37k forks source link

tooltips mess my prompt in vscode zsh terminal #3145

Closed noam-codefresh closed 1 year ago

noam-codefresh commented 1 year ago

Code of Conduct

What happened?

this happens in my vscode zsh terminal (and not in zsh in iterm) when i start typing commands that cause my tooltips to appear, it seems that they cause my caret to "jump" left and when i continue to type i overwrite my prompt. when i delete the "tooltips" section of the theme, things seem to behave fine in vscode terminal.

it might also be related to vscode. i am in the insiders build

Version: 1.74.0-insider (Universal)
Commit: 9908b3d5ae12691da5adc2f18e21a100ee8eeb58
Date: 2022-11-30T05:45:37.154Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 22.1.0
Sandboxed: Yes

image

Theme

{ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "version": 2, "console_title_template": "{{if .Root}}\uf0e7 {{end}}{{.User}}@{{.Host}} {{.Folder}}", "final_space": true, "palette": { "black": "#111111", "white": "#FFFFFF", "blue-grey": "#193549", "iterm-foreground": "#80FFEA", "os": "#546E7A", "os-foreground": "#26C6DA", "shell": "#0077C2", "root": "#FFFF66", "path": "#61AFEF", "battery": "#F36943", "battery-foreground": "#193549", "battery-charging": "#40C4FF", "battery-discharging": "#FF5722", "battery-charged": "#4CAF50", "connection": "#8822ee", "connection-foreground": "#222222", "time": "#8800DD", "time-foreground": "#FEFEFE", "exit": "#00897B", "exit-error": "#E91E63", "aws": "#FFA400", "gcp": "#47888d", "git": "#FFFB38", "git-modified": "#FF9248", "git-diverged": "#FF4500", "git-ahead": "#B388FF", "git-behind": "#B388FF", "go": "#8ED1F7", "ipify": "#C386F1", "kubectl": "#EBCC34", "node": "#6CA35E", "npm": "#FFEB3B" }, "blocks": [ { "alignment": "left", "type": "prompt", "segments": [ { "type": "iterm", "interactive": true, "style": "plain", "foreground": "#80ffea", "template": "{{ .PromptMark }}" }, { "type": "os", "background": "p:os", "foreground": "p:os-foreground", "powerline_symbol": "\ue0b0", "style": "powerline", "template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} " }, { "type": "connection", "powerline_symbol": "\uE0B0", "background": "p:connection", "foreground": "p:connection-foreground", "style": "powerline" }, { "type": "shell", "background": "p:shell", "foreground": "p:white", "powerline_symbol": "\ue0b0", "style": "powerline", "template": " {{ .Name }} " }, { "type": "root", "background": "p:root", "foreground": "p:black", "powerline_symbol": "\ue0b0", "style": "powerline", "template": " \uf0e7 " }, { "type": "path", "background": "p:path", "foreground": "p:white", "powerline_symbol": "\ue0b0", "properties": { "folder_icon": " \uf115 ", "folder_separator_icon": "\ue0b1", "style": "agnoster" }, "style": "powerline", "template": " {{ .Path }} " }, { "type": "battery", "background": "p:battery", "background_templates": [ "{{if eq \"Charging\" .State.String}}p:battery-charging{{end}}", "{{if eq \"Discharging\" .State.String}}p:battery-discharging{{end}}", "{{if eq \"Full\" .State.String}}p:battery-charged{{end}}" ], "foreground": "p:white", "powerline_symbol": "\ue0b0", "properties": { "charged_icon": "\ue22f ", "charging_icon": "\ue234 ", "discharging_icon": "\ue231 " }, "style": "powerline", "template": " {{ if not .Error }}{{.Icon}}{{.Percentage}}{{ end }}\uf295 " }, { "type": "executiontime", "style": "powerline", "powerline_symbol": "\uE0B0", "background": "p:time", "foreground": "p:white", "properties": { "threshold": 500, "style": "austin" }, "template": " \ufbab{{ .FormattedMs }} " }, { "type": "exit", "background": "p:exit", "background_templates": ["{{ if gt .Code 0 }}p:exit-error{{ end }}"], "foreground": "p:exit-foreground", "powerline_symbol": "\ue0b0", "properties": { "always_enabled": false }, "style": "powerline", "template": " {{ if gt .Code 0 }}\uf00d {{ .Meaning }}{{ else }}\uf42e{{ end }} " } ] } ], "tooltips": [ { "background": "p:aws", "foreground": "p:white", "leading_diamond": "\ue0b6", "style": "diamond", "template": " \ue7ad {{.Profile}}{{if .Region}}@{{.Region}}{{end}} ", "tips": ["aws"], "trailing_diamond": "\ue0b4", "type": "aws" }, { "background": "p:git", "background_templates": [ "{{ if or (.Working.Changed) (.Staging.Changed) }}p:git-modified{{ end }}", "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:git-diverged{{ end }}", "{{ if gt .Ahead 0 }}p:git-ahead{{ end }}", "{{ if gt .Behind 0 }}p:git-behind{{ end }}" ], "foreground": "p:blue-grey", "leading_diamond": "\ue0b6", "properties": { "fetch_stash_count": true, "fetch_status": true, "fetch_upstream_icon": true, "fetch_worktree_count": true }, "style": "diamond", "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }} ", "tips": ["git"], "trailing_diamond": "\ue0b4", "type": "git" }, { "background": "p:gcp", "foreground": "p:white", "leading_diamond": "\ue0b6", "style": "diamond", "tips": ["gcloud"], "trailing_diamond": "\ue0b4", "type": "gcp" }, { "background": "p:go", "foreground": "p:white", "leading_diamond": "\ue0b6", "style": "diamond", "template": " \ufcd1 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ", "tips": ["go"], "trailing_diamond": "\ue0b4", "type": "go" }, { "background": "p:ipify", "foreground": "p:white", "leading_diamond": "\ue0b6", "properties": { "cache_timeout": 5, "http_timeout": 1000 }, "style": "diamond", "template": " {{ .IP }} ", "tips": ["ip"], "trailing_diamond": "\ue0b4", "type": "ipify" }, { "background": "p:kubectl", "foreground": "p:black", "leading_diamond": "\ue0b6", "style": "diamond", "template": " \ufd31 {{.Context}}{{if .Namespace}} :: {{.Namespace}}{{end}} ", "tips": ["kubectl", "k"], "trailing_diamond": "\ue0b4", "type": "kubectl" }, { "background": "p:node", "foreground": "p:white", "leading_diamond": "\ue0b6", "powerline_symbol": "\ue0b0", "properties": { "fetch_package_manager": true }, "style": "diamond", "template": " \uf898 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ", "tips": ["node", "nvm", "yarn"], "trailing_diamond": "\ue0b4", "type": "node" }, { "background": "p:npm", "foreground": "p:blue-grey", "leading_diamond": "\ue0b6", "style": "diamond", "template": "\ue71e {{ .Full }} ", "tips": ["npm"], "trailing_diamond": "\ue0b4", "type": "npm" }, { "background": "p:npm", "foreground": "p:blue-grey", "leading_diamond": "\ue0b6", "style": "diamond", "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }}\uf487 {{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }} ", "tips": ["pr"], "trailing_diamond": "\ue0b4", "type": "project" } ] }

What OS are you seeing the problem on?

macOS

Which shell are you using?

zsh

Log output

Version: 12.22.0

Segments:

ConsoleTitle(true)   -   0 ms - 
iterm(false)         -   0 ms - 
os(true)             -   0 ms -   
connection(false)    -   0 ms - 
shell(true)          -   0 ms -  zsh 
root(false)          -   0 ms - 
path(true)           -   0 ms -  ~  rollouts-demo 
battery(true)        -  15 ms -   100 
executiontime(false) -   0 ms - 
exit(false)          -   0 ms - 

Run duration: 18.642709ms

Cache path: /Users/noamgal/.cache/oh-my-posh

Config path: /Users/noamgal/Sync/oh-my-posh/mytheme.omp.json

Logs:

2022/11/30 10:26:01 Getenv

2022/11/30 10:26:01 Getenv: 13.7µs, args: XDG_CACHE_HOME
2022/11/30 10:26:01 CachePath: 61.304µs
2022/11/30 10:26:01 Getenv
/Users/noamgal/Sync/oh-my-posh/mytheme.omp.json
2022/11/30 10:26:01 Getenv: 3.716µs, args: POSH_THEME
2022/11/30 10:26:01 resolveConfigPath: 6.309µs
2022/11/30 10:26:01 Init: 794.861µs
2022/11/30 10:26:01 Flags: 80ns
2022/11/30 10:26:01 config.loadConfig: 945.274µs
2022/11/30 10:26:01 Flags: 85ns
2022/11/30 10:26:01 Getenv

2022/11/30 10:26:01 Getenv: 1.062µs, args: OMP_CACHE_DISABLED
2022/11/30 10:26:01 Root: 1.396µs
2022/11/30 10:26:01 Shell
process name: zsh
2022/11/30 10:26:01 Shell: 243.404µs
2022/11/30 10:26:01 ErrorCode: 72ns
2022/11/30 10:26:01 Getenv

2022/11/30 10:26:01 Getenv: 1.275µs, args: WSL_DISTRO_NAME
2022/11/30 10:26:01 IsWsl: 2.506µs
2022/11/30 10:26:01 GOOS: 94ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 24.335µs
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 55ns
2022/11/30 10:26:01 GOOS: 38ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 38ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 38ns
2022/11/30 10:26:01 GOOS: 40ns
2022/11/30 10:26:01 GOOS: 38ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 User
noamgal
2022/11/30 10:26:01 User: 952ns
2022/11/30 10:26:01 Host
Noams-MacBook-Pro
2022/11/30 10:26:01 Host: 8.006µs
2022/11/30 10:26:01 GOOS: 57ns
2022/11/30 10:26:01 TemplateCache: 338.707µs
2022/11/30 10:26:01 Render
template: {{if .Root}} {{end}}{{.Data.User}}@{{.Data.Host}} {{.Folder}}:1:30: executing "{{if .Root}}\uf0e7 {{end}}{{.Data.User}}@{{.Data.Host}} {{.Folder}}" at <.Data.User>: nil pointer evaluating template.Data.User
2022/11/30 10:26:01 Flags: 93ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 1.026µs
2022/11/30 10:26:01 GOOS: 37ns
2022/11/30 10:26:01 Getenv
vscode
2022/11/30 10:26:01 Getenv: 966ns, args: TERM_PROGRAM
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 783ns
2022/11/30 10:26:01 GOOS: 37ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 TemplateCache: 91ns
2022/11/30 10:26:01 TemplateCache: 144ns
2022/11/30 10:26:01 Shell: 141ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 1.443µs
2022/11/30 10:26:01 GOOS: 74ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 2.483µs
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 Shell: 80ns
2022/11/30 10:26:01 Flags: 56ns
2022/11/30 10:26:01 TemplateCache: 54ns
2022/11/30 10:26:01 TemplateCache: 73ns
2022/11/30 10:26:01 Shell: 83ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 951ns
2022/11/30 10:26:01 GOOS: 58ns
2022/11/30 10:26:01 Root: 878ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 737ns
2022/11/30 10:26:01 GOOS: 58ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 626ns
2022/11/30 10:26:01 Shell: 64ns
2022/11/30 10:26:01 Shell: 39ns
2022/11/30 10:26:01 GOOS: 48ns
2022/11/30 10:26:01 PathSeparator: 86ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 38ns
2022/11/30 10:26:01 GOOS: 58ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 PathSeparator: 58ns
2022/11/30 10:26:01 PathSeparator: 38ns
2022/11/30 10:26:01 GOOS: 38ns
2022/11/30 10:26:01 GOOS: 38ns
2022/11/30 10:26:01 PathSeparator: 39ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 PathSeparator: 40ns
2022/11/30 10:26:01 GOOS: 40ns
2022/11/30 10:26:01 GOOS: 39ns
2022/11/30 10:26:01 PathSeparator: 39ns
2022/11/30 10:26:01 PathSeparator: 56ns
2022/11/30 10:26:01 PathSeparator: 62ns
2022/11/30 10:26:01 PathSeparator: 38ns
2022/11/30 10:26:01 PathSeparator: 40ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 666ns
2022/11/30 10:26:01 Getenv

2022/11/30 10:26:01 Getenv: 922ns, args: WSL_DISTRO_NAME
2022/11/30 10:26:01 IsWsl: 1.971µs
2022/11/30 10:26:01 StackCount: 79ns
2022/11/30 10:26:01 DirIsWritable: 28.452µs, args: /Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 TemplateCache: 74ns
2022/11/30 10:26:01 TemplateCache: 73ns
2022/11/30 10:26:01 Shell: 77ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 984ns
2022/11/30 10:26:01 GOOS: 58ns
2022/11/30 10:26:01 Getenv

2022/11/30 10:26:01 Getenv: 903ns, args: WSL_DISTRO_NAME
2022/11/30 10:26:01 IsWsl: 1.924µs
2022/11/30 10:26:01 RunCommand
Now drawing from 'AC Power'
 -InternalBattery-0 (id=7274595)        100%; charged; 0:00 remaining present: true
2022/11/30 10:26:01 RunCommand: 12.956871ms, args: pmset -g batt
2022/11/30 10:26:01 BatteryState: 13.037773ms
2022/11/30 10:26:01 TemplateCache: 292ns
2022/11/30 10:26:01 TemplateCache: 199ns
2022/11/30 10:26:01 Shell: 329ns
2022/11/30 10:26:01 TemplateCache: 96ns
2022/11/30 10:26:01 TemplateCache: 98ns
2022/11/30 10:26:01 TemplateCache: 97ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 5.871µs
2022/11/30 10:26:01 GOOS: 72ns
2022/11/30 10:26:01 ExecutionTime: 85ns
2022/11/30 10:26:01 Pwd
/Users/noamgal/poc/rollouts-demo
2022/11/30 10:26:01 Pwd: 903ns
2022/11/30 10:26:01 GOOS: 42ns
2022/11/30 10:26:01 ErrorCode: 60ns
2022/11/30 10:26:01 ErrorCode: 59ns
2022/11/30 10:26:01 Getenv

2022/11/30 10:26:01 Getenv: 1.097µs, args: XDG_CACHE_HOME
2022/11/30 10:26:01 CachePath: 37.658µs
2022/11/30 10:26:01 Flags: 82ns
JanDeDobbeleer commented 1 year ago

@noam-codefresh I would disable shell integrations if they're enabled and report to the code team if it persists as there's no logic on our end that can cause this as for zsh tooltips are even a native implementation (thus no dark magic).