0

I am using VS Code as my primary text editor, which I can launch from a terminal with code.

With bash, I can use code <tab> in order to generate a list of directories & files for opening a new VS Code session in. However, when I am trying on my fresh install of Ubuntu, I am getting an error as if zsh is trying to run some other command:

(eval):1: command not found: _code.dpkg-new

Example case, from the desktop, where there exists a directory named Projects:

IN:

<usr>-<machine>% code Pro<tab>

OUT:

<usr>-<machine>% code Pro<tab>(eval):1: command not found: _code.dpkg-new

Using other commands results in the expected behavior: the Projects directory is auto-completed. e.g.,:

IN:

<usr>-<machine>% cd Pro<tab>

OUT:

<usr>-<machine>% cd Projects/

My .zshrc is completely commented out but it seems to make no difference even after starting a new terminal session.

A commentor suggested this was a duplicate of another post, but the suggested solution in that post did not help, rather yielding a different error when I tried (as commented in that post and below).

I am not using Oh-my-zsh.

I am new to Ubuntu. I have a fresh install from yesterday.

IN:

lsb_release -a 

OUT:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.04
Release:    23.04
Codename:   lunar

I have looked at these sites, but the advice does not help:

I will accept an answer that helps me use zsh with the code command to auto-complete paths using tab as I can already do in bash on this Ubuntu machine (and I'm fairly certain I can already do with zsh on a Macbook, but I have not verified tonight).

Resolution:

I originally installed VS code using apt following this tutorial. Uninstalling then reinstalling with snap using the same tutorial resolved the issue. Not sure what is wrong with the apt installation, but I'm glad the issue is resolved now. Thanks for your posts at this question, @starball.

Jayden.Cameron
  • 499
  • 4
  • 17
  • 1
    dup of [How can I get Bash and Zsh completions for VS Code on the commandline?](https://stackoverflow.com/questions/75882300/how-can-i-get-bash-and-zsh-completions-for-vs-code-on-the-commandline) ? – starball Aug 24 '23 at 23:12
  • @starball: thanks for the call out! I missed that post, but unfortunately it does not solve my problem. In Ubuntu 23.04, adding `source /usr/share/code/resources/completions/zsh/_code` to the top of my `.zshrc` file does not fix auto-complete with `code` from the command line. From zsh, when I try to run `code ` I get the error: `_arguments:comparearguments:327: can only be called from completion function`. – Jayden.Cameron Aug 25 '23 at 07:32

0 Answers0