withfig / fig

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

fig doctor doesn't recognise existing pre/post integration hooks #1447

Open Integralist opened 2 years ago

Integralist commented 2 years ago

Sanity checks

Issue Details

Description:

My ~/.zshrc has the pre/post integration scripts sourced, and they are indeed the first/last things to be executed but not in the way that fig doctor presumes they would be.

For example, I prefer to not straight up source a script in my shell configuration because the file being sourced might not exist. Just sourcing files can cause problems when I move my shell configuration between machines.

To avoid this issue I prefer to wrap any source operations in an if statement like so:

if test -f "$HOME/.fig/shell/zshrc.pre.zsh"; then
  . "$HOME/.fig/shell/zshrc.pre.zsh"
fi

But fig doctor doesn't recognise this, and because I also like to have some comments at the top of my shell configuration that explains the file structure this may also be confusing fig doctor into thinking the sourcing isn't the first thing to happen (even though in practice, it is the first thing to be sourced).

The following snippet demonstrates what fig doctor automatically does to my shell configuration (which is annoying because it does this automatically without asking to confirm with me: Attempting to fix automatically...). Notice it actually locates the source line and moves it up out of my if statement.

# Fig pre block. Keep at the top of this file.
. "$HOME/.fig/shell/zshrc.pre.zsh"
# NOTE:
# additional configuration of the shell is handled by ~/.inputrc which
# instructs the Readline utility as to what behaviours it should respect.
#
# DOCUMENTATION:
#   - https://twobithistory.org/2019/08/22/readline.html
#   - man zsh (+ /Readline Variables)
#
# STRUCTURE:
#   - SCRIPTS
#   - CONFIGURATION
#   - EXPORTS
#   - CUSTOM FUNCTIONS
#   - ALIAS
#   - BINDINGS
#   - SHELL
#   - SOFTWARE
#

# ⚠️  SCRIPTS ⚠️

# fig.io autocomplete helpers
#
if test -f "$HOME/.fig/shell/zshrc.pre.zsh"; then
  fi

...REST OF MY SHELL CONFIGURATION

# fig.io autocomplete helpers
#
if test -f "$HOME/.fig/shell/zshrc.post.zsh"; then
  fi

echo .zshrc loaded

# Fig post block. Keep at the bottom of this file.
. "$HOME/.fig/shell/zshrc.post.zsh"

Environment

# Fig Diagnostics
## Fig details:
  - Fig version: Version 1.0.57 (B446) [Beta] [British]
  - Bundle path: /Applications/Fig.app
  - Autocomplete: true
  - Settings.json: true
  - Accessibility: true
  - Number of specs: 0
  - Symlinked dotfiles: false
  - Only insert on tab: false
  - Keybindings path:
  - Installation Script: true
  - PseudoTerminal Path: /Users/integralist/Library/Caches/fnm_multishells/3995_1652344966480/bin:/Users/integralist/.cargo/bin:/Users/integralist/go/bin:/usr/local/go/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/integralist/Library/Caches/fnm_multishells/2121_1652342958887/bin:/Users/integralist/.fig/bin:/Users/integralist/.local/bin:/opt/homebrew/opt/fzf/bin
  - SecureKeyboardInput: false
  - SecureKeyboardProcess: <none>
## Hardware Info:
  - Model Name: MacBook Pro
  - Model Identifier: MacBookPro18,3
  - Chip: Apple M1 Pro
  - Cores: 8 (6 performance and 2 efficiency)
  - Memory: 16 GB
## OS Info:
  - macOS 12.3.1 (21E258)
## Environment:
  - User Shell: /opt/homebrew/bin/bash
  - Current Directory: /Users/integralist/Code/fastly/Developer-Portal
  - CLI Installed: true
  - Executable Location: /Users/integralist/.fig/bin/fig
  - Current Window ID: 86/% (io.alacritty)
  - Active Process: zsh (3897) - /dev/ttys008
  - Environment Variables:
    - FIG_INTEGRATION_VERSION=8
    - FIG_PID=3897
    - FIG_TERM=1
    - FIG_TERM_VERSION=4.4.0
    - PATH=/Users/integralist/Library/Caches/fnm_multishells/3995_1652344966480/bin:/Users/integralist/.cargo/bin:/Users/integralist/go/bin:/usr/local/go/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/integralist/Library/Caches/fnm_multishells/2121_1652342958887/bin:/Users/integralist/.fig/bin:/Users/integralist/.local/bin:/opt/homebrew/opt/fzf/bin
    - TERM=xterm-256color
    - TERM_SESSION_ID=B3424D99-EBFA-485E-A987-88143FC4FAB1
    - FIG_TERM_TMUX=1
## Integrations:
  - SSH: false
  - TMUX: false
  - iTerm: application is not present.
  - Hyper: application is not present.
  - Visual Studio Code: application is not present.
  - Docker: false
Integralist commented 2 years ago

Additionally, even though fig doctor now suggests everything is working fine (after letting it move the sourcing of files), I restart the fig app and double check fig doctor (yup, no errors apparently), and yet...

Screenshot 2022-05-12 at 09 57 26
Integralist commented 2 years ago

UPDATE: 5hrs after my above comment, and not doing anything other than my day-to-day work the Fig app has suddenly sprung back to life...

Screenshot 2022-05-12 at 14 43 33

.

rahulsarathy commented 2 years ago

Hi @Integralist, thanks for reporting this issue and being so detailed.

We actually have someone on the team looking into this issue and working on a fix. It should be out sometime next week!