Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctags - Neither rebuildOnFileSave nor rebuildOnStart work #793

Closed
obambrough opened this issue Feb 15, 2018 · 17 comments
Closed

Ctags - Neither rebuildOnFileSave nor rebuildOnStart work #793

obambrough opened this issue Feb 15, 2018 · 17 comments
Assignees
Labels
area-editor-* User-facing catch-all bug Issue identified by VS Code Team member as probable bug good first issue

Comments

@obambrough
Copy link

Environment data

VS Code version: 1.20.1
Python Extension version: 2018.1.0
Python Version: 2.7.14
OS and version: MacOS 10.13.3

Actual behavior

${workspaceFolder}/.vscode/tags file is not updated when I save a python file nor if I restart VS Code.

Expected behavior

${workspaceFolder}/.vscode/tags file will be updated when I save a python file or restart VS Code.

Steps to reproduce:

  • Verify tags file doesn't exist
  • Open a project with python files in VS Code and open a Python source file
  • Verify the tags file still doesn't exist (rebuildOnStart hasn't activated)
  • Make a change to the Python file and save
  • Verify the tags file still doesn't exist (rebuildOnFileSave hasn't activated)
  • Perform a global symbol search
  • The tags file has been created (this is only created if it doesn't exist, if it already existed it isn't updated with new symbols)
  • Add a new function definition to a Python file and save (rebuildOnFileSave hasn't activated)
  • Perform a global symbol search for newly added symbol (this fails to find it)
  • Run 'Python: Build Workspace Symbols' (this updates tags file)
  • Perform a global symbol search for newly added symbol (this succeeds)

Logs

Output from Python output panel (only gets logged when I perform a global symbol search if the tags file doesn't exist, or if I run the 'Python: Build Workspace Symbols' command.)

ctags --options=/XXXXX/.vscode/extensions/ms-python.python-2018.1.0/resources/ctagOptions --languages=Python --exclude=**/site-packages/** --exclude=.history -o /YYYYY/.vscode/tags .

Output from Console window (Help->Developer Tools menu) (I see this on VS Code startup.)

[Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:253
@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug awaiting 2-PR labels Feb 15, 2018
@DonJayamanne DonJayamanne added this to the March 2018 milestone Feb 26, 2018
@DonJayamanne DonJayamanne modified the milestones: March 2018, April 2018 Mar 12, 2018
@DonJayamanne DonJayamanne modified the milestones: April 2018, May 2018 Apr 2, 2018
@gregflynn
Copy link

Yea been scratching my head as to why goto symbol was always a few lines off, I added the following keybinding as a workaround for me:

{
        "key": "ctrl+shift+r",
        "command": "python.buildWorkspaceSymbols"
    }

@brettcannon brettcannon modified the milestones: May 2018, June 2018 May 7, 2018
@brettcannon brettcannon modified the milestone: June 2018 Jun 4, 2018
@1st
Copy link

1st commented Jun 14, 2018

Updated to the very last version of VS Code and still have such issue. Goto Symbol command show nothing in Python files.

I'm using MacOS and just reinstalled ctags via Homebrew and then restarted VS Code. Deleted file ".vscode/tags" and it's not restored (not recreated). Previously when I remove such file it was restored after some period of time. Looks that ctags doesn't work anymore for some reason.

@1st
Copy link

1st commented Jun 14, 2018

In my case I found few issues those I solved to make my VS Code working again as expected.

Pylint didn't work

After upgrade the macOS my virtualenvs becomes to be broken. I tried to execute something like this:

$ /Users/username/.virtualenvs/projectname/bin/python --version
dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /Users/adanilchenko/.virtualenvs/kanban/bin/python2
  Reason: image not found
Abort trap: 6

And the same path have been used by VS Code to run my Python. I've deleted this virtual env and initiated new one. Then I've installed pylint in it.

Used old unsupported ctags implementation

I found that ctags has few versions. And one that is installed by default via Homebrew is very outdated.

$ brew info ctags
ctags: stable 5.8 (bottled), HEAD
Reimplementation of ctags(1)
https://ctags.sourceforge.io/

It's exist alternative version of it https://github.com/universal-ctags/homebrew-universal-ctags

$ brew remove ctags
$ brew install --HEAD universal-ctags/universal-ctags/universal-ctags

I see that it fixes some well known issues like this: universal-ctags/ctags#750

Anyway it didn't help me to restore Go To symbols. But it's few steps towards it at least.

@1st
Copy link

1st commented Jun 15, 2018

OK, finally it started work

Solution

After doing what I said above, I find next things.

Go To Symbol in File

It started to work, showing me the list of functions in the Python file. but ctags file was still not recreated.

Go To Symbol in Workspace

When I desired to try jump to a symbol inside a workspace - it started the process of creating the ctags file. It took some time. I've found next output in the Output tab of the console.

----------Generating Tags----------
ctags --options=/Users/me/.vscode/extensions/ms-python.python-2018.5.0/resources/ctagOptions --languages=Python --exclude=**/site-packages/** -o /Users/me/projects/projectname/.vscode/tags .
ctags: Warning: --extra option is obsolete; use --extras instead

As I can see - the --extra option is obsolete; use --extras instead warning can be fixed on the VSCode side. Can you please do it in the text release?

@brettcannon
Copy link
Member

@1st we're actually working on a new language server which should do away with the need of ctags, so it might not be fixed in the next release, but we are working on improving this.

@balta2ar
Copy link

I'd still like to have ctags as a simple fallback mechanism for navigation...

@brettcannon
Copy link
Member

@balta2ar no decision has been made, but I wouldn't count on us supporting two separate approaches due to the maintenance burden.

@1st
Copy link

1st commented May 1, 2019

@brettcannon I think that this problem can be avoided if you can make change to the file resources/ctagOptions that is pointed as config file for ctags. When I hit Cmd + T then warning message appears with information that "ctags: Warning: --extra option is obsolete; use --extras instead". And it contains next exec path:

ctags --options=/Users/<user>/.vscode/extensions/ms-python.python-<XYZ>/resources/ctagOptions --languages=Python --exclude=**/site-packages/** -o /Users/<user>/workspace/<project_name>/.vscode/tags .

If you can change the --extra=+f to --extras=+f in the ctagOptions file, then this problem willl disappear.

@mgsergio
Copy link

mgsergio commented Jul 4, 2019

Hello everyone!
Is there any progress on this one?

Could you please schedule it in a milestone?

@brettcannon
Copy link
Member

@1st do note that #3517 asked for the exact opposite of what you're after. 😄

@mgsergio no progress. Please 👍 the issue to help bump up its priority.

@mgsergio
Copy link

mgsergio commented Jul 6, 2019 via email

@karrtikr
Copy link

https://code.visualstudio.com/docs/python/settings-reference#_workspace-symbol-tags-settings

python.workspaceSymbols.rebuildOnStart and python.workspaceSymbols.rebuildOnFileSave settings are busted, look into the fix.

@karrtikr
Copy link

karrtikr commented Nov 18, 2019

This will be fixed in #8650.

@ghost ghost removed the needs PR label Nov 18, 2019
@karthiknadig karthiknadig reopened this Nov 20, 2019
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Nov 20, 2019
@karthiknadig karthiknadig changed the title Spike - Ctags - Neither rebuildOnFileSave nor rebuildOnStart work Ctags - Neither rebuildOnFileSave nor rebuildOnStart work Nov 20, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Nov 20, 2019
@karrtikr karrtikr removed their assignment Nov 25, 2019
@kimadeline kimadeline self-assigned this Nov 28, 2019
@karrtikr karrtikr self-assigned this Dec 10, 2019
@karrtikr
Copy link

This issue should be fixed in the latest release. Validated.

@ghost ghost removed the needs PR label Dec 10, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-editor-* User-facing catch-all bug Issue identified by VS Code Team member as probable bug good first issue
Projects
None yet
Development

No branches or pull requests