warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.44k stars 374 forks source link

Completion of environment variables doesn't work correctly #3928

Open dcervenkov opened 11 months ago

dcervenkov commented 11 months ago

Discord username (optional)

No response

Describe the bug

Some environment variable names are missing from completion suggestions.

To reproduce

  1. Execute export TEST_VAR=1
  2. Type echo $TES
  3. Press Tab

Expected behavior

I expect to see TEST_VAR among the suggestions.

Screenshots

Screenshot 2023-12-04 at 14 55 18

Operating system

MacOS

Operating system and version

14.0

Shell Version

zsh 5.9 (arm-apple-darwin23.0.0)

Current Warp version

v0.2023.11.14.08.02.stable_02

Regression

No, this bug or issue has existed throughout my experience using Warp

Recent working Warp date

No response

Additional context

No response

Does this block you from using Warp daily?

No

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b8107fdf-ba31-488d-b103-d271c89cac3e

None

dannyneira commented 11 months ago

Hi @dcervenkov The completions for new variables/commands bootstraps on new Warp sessions. So as a workaround to this issue, you can manually type in the known variable echo $TEST_VAR and it should produce the result. As a possible workaround, you can also echo "export TEST_VAR=1" >> ~/.zshrc to add the variable to your rc files and it should bootstrap new Warp sessions with that var assigned and should auto-complete.

Please let me know if this helps with your issue.

dcervenkov commented 11 months ago

Hey @dannyneira, not sure what you mean by "The completions for new variables/commands bootstraps on new Warp sessions."

Yes, I can indeed type the variable name out or save it to ~/.zshrc, but that still means the completion is broken in Warp (while it works in other shells).

dannyneira commented 11 months ago

What I mean by this is that Warp loads the variables in the ~/.zshrc file on starting a new session (open a new window/tab or pane), this is what enables completions for those variables. I'll let the team know and we'll post any updates on this thread.

dannyneira commented 11 months ago

Hey Folks, just wanted to chime in here and set the expectation that this bug fix may require significant engineering lift and may not be prioritized in the near term.

That being said, to anyone else facing this issue, please add a 👍 to the original post at the top or comment with your details, and subscribe if you'd like to be notified. The more 👍 an issue has, the higher the chance of it getting prioritized for future cycles.

phat-do-tpv-clv commented 10 months ago

Hi @dcervenkov The completions for new variables/commands bootstraps on new Warp sessions. So as a workaround to this issue, you can manually type in the known variable echo $TEST_VAR and it should produce the result. As a possible workaround, you can also echo "export TEST_VAR=1" >> ~/.zshrc to add the variable to your rc files and it should bootstrap new Warp sessions with that var assigned and should auto-complete.

Please let me know if this helps with your issue.

Also, don't forget run source ~/.zshrc to executes the file

ofekedri commented 7 months ago

When exporting vars with commands, adding them to ~/.zshrc wasn't sufficient. I found a workaround that may help others, although it's not perfect. When I enter a subshell by typing 'zsh', the autocomplete function works successfully.

Example Warp terminal: export TEST="SomeString" #Var exported before entering sub shell zsh export VAR="SomeString" #Var exported after entering sub shell echo $MY (tab for completion)

soxofaan commented 6 months ago

Same problem here with (non-export) variables in bash:

Screenshot from 2024-05-15 11-32-24

Warp on the left and a classic terminal on the right. In both cases I entered echo $fo<TAB> in the last prompt. Warp gives unhelpful suggestion. Classic terminal automatically completes to $foo

ofekedri commented 6 months ago

Are you referring to my last comment? If you, notice - I used export var=values. Then I created a new shell (zsh), and auto-complete worked for me. I know it is not ideal, but it is better than nothing. I hope it is useful, and I hope the Wrap team will fix it. I love warp, my 2 big issues are auto-complete (like this case) and it does not work inside of IDE (vscode in my case).

soxofaan commented 6 months ago

Are you referring to my last comment?

No I'm referring to the original issue here: completion of variables and env/exported vars doesn't work if they are created after the shell started.

Also applies to (bash) aliases by the way: aliases that have been set up in e.g. .bashrc are suggested/autocompleted. But aliases created after shell start are unknown to warp's suggestion/completion functionality

david-zamora-minderest commented 2 months ago

To me, it doesn't show some variables like $GID or $UID. I am not sure if that's also related to this bug, but it's something I can easily check with the ubuntu terminal with ZSH, It does autocomplete the sentence, but not in warp.