withfig / fig

Public issue tracker for Fig.
https://fig.io
MIT License
2.06k stars 62 forks source link

PowerLevel10K Compatibility Issue and SSH Installation Problem #1684

Open mikebronner opened 2 years ago

mikebronner commented 2 years ago

Sanity checks

Issue Details

Followed the instructions at https://fig.io/support/autocomplete/ssh with the following output:

source <(curl -Ls fig.io/install)                                                                                                                         ─╯
✔ Do you want fig to modify your shell config (you will have to manually do this otherwise)? · no

To install Fig manually you will have to add the following to your rc files

At the top of your .bashrc or .zshrc file:
bash:    . "$HOME/.fig/shell/bashrc.pre.bash"
zsh:     . "$HOME/.fig/shell/zshrc.pre.zsh"

At the bottom of your .bashrc or .zshrc file:
bash:    . "$HOME/.fig/shell/bashrc.post.bash"
zsh:     . "$HOME/.fig/shell/zshrc.post.zsh"

I answered no because when using the PowerLevel10K theme, FIG cannot be the first line, but instead the P10K instant prompt must be the first line:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && . "$HOME/.fig/shell/zshrc.pre.zsh"

I then ran fig launch:

fig launch                                                                                                                                                ─╯

→ Launching Fig...

error: Failed to launch fig.desktop

I then tried running fig restart:

fig restart                                                                                                                                               ─╯

→ Launching Fig...

error: Failed to launch fig.desktop

And then fig doctor:

fig doctor                                                                                                                                                ─╯
⠙ Running checks...
→ Launching Fig...

✘ ~/.zshrc contains valid fig hooks: /home/forge/.zshrc does not source pre integration first
  Run fig install --dotfiles to reinstall shell integrations for zsh
Attempting to fix automatically...
Re-running check...

✔ ~/.zshrc contains valid fig hooks
✘ Fig Integration: Figterm is not running
  FIG_INTEGRATION_VERSION=None

✘ Doctor found errors. Please fix them and try again.

If you are not sure how to fix it, please open an issue with fig issue to let us know!
Or, email us at hello@fig.io!

This latter output appears related to #1679

Environment

### Details:
| OS | Fig | Shell |
| - | - | - |
| Linux 5.4.0-122-generic | | /usr/bin/zsh |

fig diagnostic

# Fig Diagnostics
## NOTE: Fig is not running, run `fig launch` to get the full diagnostics
## Fig details:
## Hardware Info:
  - Model Name: cpu0
  - Model Identifier: GenuineIntel
  - Chip: Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz
  - Cores: 8
  - Memory: 16786022 KB
## OS Info:
  - Linux 5.4.0-122-generic
## Environment:
  - User Shell: Unknown UserShell
  - Current Directory: /home/forge/mike-b.totalitylms.com
  - CLI Installed: true
  - Executable Location: /home/forge/.local/bin/fig
  - Current Window ID: <unknown>
  - Active Process: <unknown>
  - Terminal: vscode
  - Environment Variables:
    - FIG_PID=3406857
    - PATH=/home/forge/.vscode-server-insiders/bin/eebdf8174b087979ae6af103f6f2e2f6f9062056/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/forge/.local/bin:/home/forge/.fig/bin:/home/forge/.config/composer/vendor/bin:/home/forge/.config/composer/vendor/bin
    - TERM=xterm-256color
## Integrations:
brendanfalk commented 2 years ago

Hi @mikebronner

My understanding is fig should be above powerlevel10k, even with instant prompt.

Could you try uninstalling (fig uninstall) and then re-installing and clicking yes to that question?

You may have to manually move fig's preinstall hooks to the top of ~/.zshrc and bashrc, zprofile etc if they exist.

@grant0417 @mschrage @sullivan-sean @SeparateRecords please correct me if i'm wrong

brendanfalk commented 2 years ago

Also, run fig rather than fig launch

mikebronner commented 2 years ago

Hi @mikebronner

My understanding is fig should be above powerlevel10k, even with instant prompt.

Could you try uninstalling (fig uninstall) and then re-installing and clicking yes to that question?

You may have to manually move fig's preinstall hooks to the top of ~/.zshrc and bashrc, zprofile etc if they exist.

@grant0417 @mschrage @sullivan-sean @SeparateRecords please correct me if i'm wrong

If the instant prompt script section is not the first entry in the file, we get the following warning:

[WARNING]: Console output during zsh initialization detected.

When using Powerlevel10k with instant prompt, console output during zsh
initialization may indicate issues.

You can:

  - Recommended: Change ~/.zshrc so that it does not perform console I/O
    after the instant prompt preamble. See the link below for details.

    * You will not see this error message again.
    * Zsh will start quickly and prompt will update smoothly.

  - Suppress this warning either by running p10k configure or by manually
    defining the following parameter:

      typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet

    * You will not see this error message again.
    * Zsh will start quickly but prompt will jump down after initialization.

  - Disable instant prompt either by running p10k configure or by manually
    defining the following parameter:

      typeset -g POWERLEVEL9K_INSTANT_PROMPT=off

    * You will not see this error message again.
    * Zsh will start slowly.

  - Do nothing.

    * You will see this error message every time you start zsh.
    * Zsh will start quickly but prompt will jump down after initialization.

For details, see:
https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt

-- console output produced during zsh initialization follows --

compinit: initialization aborted
/Users/mike/.local/share/fig/plugins/npm-run.plugin.zsh_akoenig/npm-run.plugin.zsh:17: command not found: compdef
compinit: initialization aborted
/Users/mike/.local/share/fig/plugins/zsh-artisan_jessarcher/artisan.plugin.zsh:58: command not found: compdef

It appears that some Fig plugins may cause terminal output, which causes this issue, so because of that it cannot be before the instant prompt.

mikebronner commented 2 years ago

Also, run fig rather than fig launch

this works, and shows the following prompt output:

╰─❯ fig                                                                                                                                                  ─╯

→ Launching Fig...

→ Opening https://app.fig.io...

Unfortunately it does not open the browser, though -- nothing happens.