Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

symbols-view:go-to-declaration doesn't work #9

Open
probablycorey opened this issue Dec 4, 2013 · 37 comments
Open

symbols-view:go-to-declaration doesn't work #9

probablycorey opened this issue Dec 4, 2013 · 37 comments
Labels

Comments

@probablycorey
Copy link

I only tried this in a .coffee file, but it doesn't work. I think there needs to be some feedback (like beep) to know if it didn't work.

@kevinsawicki
Copy link
Contributor

Do you have a ctags file generated for the project you are trying to use it in?

@zenhob
Copy link

zenhob commented Feb 27, 2014

Apart from lack of error feedback, this is also just an issue with ctags and CoffeeScript. I needed to add this to my ~/.ctags to get CoffeeScript and symbols-view:go-to-declaration working together (via https://gist.github.com/mads379/907245):

--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( extends ([A-Za-z][A-Za-z0-9_.]*)+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?(([A-Za-z][A-Za-z0-9_.]*)+):.*[-=]>.*$/\3/m,method/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/f,field/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,static field/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?/\3/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){0}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){1}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){2}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){3}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){4}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){5}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){6}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){7}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){8}/\8/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?(,[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?){9}/\8/f,field/

@bigdawggi
Copy link

In PHP file, this also does not work. I'm unfamiliar with ctags. Is that a required step to get these definitions to work?

I initially posted here, but was directed to the symbols view and found this similar issue.

@zenhob
Copy link

zenhob commented Mar 4, 2014

@bigdawggi You can see the languages supported by your ctags command with ctags --list-languages, it looks like PHP is included by default. Make sure you're generating a tags file in your project directory.

@bigdawggi
Copy link

Thanks @zenhob, I didn't know about needing to generate a ctags file for projects. So for each project, do the following

cd {your project directory}
ctags -R .

After that, the Go to Declaration worked like a charm for me.

For posterity: I had to install ctags using homebrew...just brew install ctags and then alias the full path (mine was /usr/local/Cellar/ctags/5.8/bin/ctags) to use the -R option.

Thanks again!

@zenhob
Copy link

zenhob commented Mar 4, 2014

It looks like someone released a plugin for generating tags file: https://atom.io/packages/symbol-gen

@bigdawggi
Copy link

That works great too, thanks!

@adis-me
Copy link

adis-me commented Apr 10, 2014

Is there some shortcut for Go to declaration? Or do I have to rightclick each time and select menuitem Go to declaration?

@noseglid
Copy link
Contributor

@adis-me cmd-alt-down

https://github.com/atom/symbols-view/blob/master/keymaps/symbols-view.cson#L3

@adis-me
Copy link

adis-me commented Apr 10, 2014

@noseglid 👍 Works perfectly!

@crucialfelix
Copy link

Also not working for me most of the time. I have Key Binding Resolver open, I can see the command being called. Nothing happens, nothing is posted in the console.

I have a tags file and I can easily find the item using shift-cmd-R.

Perhaps its because there are multiple results. eg. "FAFeed" matches FAFeed RSSFAFeed DelimedFAFeed etc. ? Exact match should be automatically selected IMO.

@glennhoward
Copy link

@bigdawggi, thanks for the comments, worked like a charm for me using them.

@crucialfelix
Copy link

Still does not work 90% of the time for me in python. I have no idea why. There is definitely an up to date tags file and command-shift-R finds the item quite easily. But go to declaration does not work.

@rjbergerud
Copy link

Also not working with javascript - using right click menu and 'go to declaration' does nothing.

@basarat
Copy link

basarat commented Feb 18, 2015

The only help I need for TypeScript is "What's under the cursor on right click"

@rjbergerud
Copy link

screen shot 2015-02-18 at 3 15 28 pm

@basarat
Copy link

basarat commented Feb 18, 2015

I can see that you are using getLastCursor

find: (editor, callback) ->
if editor.getLastCursor().getScopeDescriptor().getScopesArray().indexOf('source.ruby') isnt -1
# Include ! and ? in word regular expression for ruby files
range = editor.getLastCursor().getCurrentWordBufferRange(wordRegex: /[\w!?]*/g)
else
range = editor.getLastCursor().getCurrentWordBufferRange()
symbol = editor.getTextInRange(range)

The last cursor is not necessarily the place the user right clicked :
image

As you can see getLastCursor thinks its row 52 while I actually clicked on row 61. This is the behaviour for all lanugages.

@thomasmodeneis
Copy link

Hi I also cannot make the go to declaration work for methods and variables when they are exported in a another package.

example:

import (    "test/auth" )
auth.AuthenticateUser()
auth.Host

Atom version

Version 0.196.0 (0.196.0)

Also I'm not clear why such a command (go to declaration) need to be cmd+alt+down ??. All my life with Eclipse, Jetbrains, Webstorm is cmd or ctrl(windows). Would be possible for us not to re-invent the weel and just use the default ?
Thanks

@mnquintana
Copy link
Contributor

@thomasmodeneis You're using a pretty old version of Atom – can you update to the latest version (0.205.0) and see if you can still reproduce this?

@wy193777
Copy link

wy193777 commented Jun 6, 2015

Using Ubuntu 12.04 + 0.207.0. Opened an rails project. It doesn't work even for same file.

@wy193777
Copy link

wy193777 commented Jun 6, 2015

After install atom-ctag, it worked. So I know now!

@edugmes
Copy link

edugmes commented Jul 2, 2015

@noseglid ctrl-alt-down does not work for me. I already installed symbol-gen as @zenhob suggested and got the 'go to declaration' working under the context menu, but the shortcut for it (ctrl-alt-down) enables multiple line edition instead. Any workaround?

@s2t2
Copy link

s2t2 commented Jul 8, 2015

sorry if i missed it, but what is the fix for making "go to declaration" work? in my experience it has never worked...

@oliverbarnes
Copy link

+1. symbol-gen installed, neither contextual menu nor alt-cmd-down work. Tried custom configuring the shortcut, no luck either. With Ruby

@crucialfelix
Copy link

Its not that the key command is not assigned correctly.
You can turn on key resolver and watch it go-to-declaration get triggered
and after that its a silent failure of some sort.
Other times it mysteriously works (same codebase, same project).

It needs to have some multi-provider solution like autocomplete does. If
you are editing python then python jedi should be able to respond with an
answer. If it doesn't know then fall back to parsed symbols (with a
multiple choice pop up if needed).

If you edit javascript then atom-ternjs could give a good answer.

For this current issue/bug we would love to see some debug posted to
console indicating that something tried and failed.
Because right now we have some people saying it works, and yet for many of
us it clearly doesn't and there's nothing we can do.

On Fri, Jul 10, 2015 at 6:43 PM Oliver Azevedo Barnes <
[email protected]> wrote:

+1. symbol-gen installed, neither contextual menu nor alt-cmd-down work.
Tried custom configuring the shortcut, no luck either


Reply to this email directly or view it on GitHub
#9 (comment).

@oliverbarnes
Copy link

started working for me after I selected Packages > Symbols > Generate for Project (previously I had tried the shortcut for this, alt-cmd-g).

@crucialfelix
Copy link

I have symbols generated, that does not solve the issue for me.

@bijoythomas
Copy link

I have the same issue here. Generated the ctags file using the ctags command. I see that symbols-view:go-to-declaration is being triggered on cmd-alt-down, but nothing happens. The project-symbols works by showing everything but the go-to-declaration doesn't.

@johnnyfreeman
Copy link

This comment fixed it for me. Thanks @bigdawggi.

@Tatsujinichi
Copy link

Does not work for me with javascript. cmd-r works fine.

@renylin
Copy link

renylin commented May 24, 2016

Does not work "fine" for me with python. I have tags file with the project, cmd+shift+r works fine so the tags file is working.
If I select the function without some letters, for example select find_functio of the find_function(), it can work. Or I add a blank between the fund_function and (), it can work too.

ATOM Version 1.7.4
OSX 10.11.5

@frank0718
Copy link

with ctags : alt + cmd + down
without ctags : cmd + R
worked for me

@AndrewKiri
Copy link

AndrewKiri commented Jul 23, 2016

Doesn't work for CSS. Also, Ctags don't support it.
Atom version 1.8.0

@kylegmaxwell
Copy link

atom-ctags worked for me (after restarting twice)
https://atom.io/packages/atom-ctags

@pabloab
Copy link

pabloab commented Jul 29, 2017

With atom-ctags I get Warning from atom-ctags: atom-ctags replaces and enhances the symbols-view package. Therefore, symbols-view has been disabled.. Remember to apm enable symbols-view if you disable/uninstall atom-ctags.

By default on Linux you will get Emacs ctag. As said here to run the real ctags install exuberant-ctags package (considering this and this seems the one Atom currently use). Maybe better is to use Atom symbol-gen

Sorry to hear the use of Ctrl+Alt+Down by default, some Linux distros use Ctrl+Alt+Arrows to move across desktops/workspaces.

@jduhls
Copy link

jduhls commented Mar 27, 2018

CTRL + click on windows and CMD + click on macOS (did not test!) works fine. The context menu item does nothing. Latest atom on win10 with typescript IDE.

@damianobarbati
Copy link

Totally broken with Javascript / ES modules

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests