Open gerardroche opened 10 years ago
It's probably better to limit the goto definitions to the current scope. When you press Goto definition... in a php scope do you really want definitions other than php? I can't imagine why you would.
this has also been discussed a little bit here recently: https://forum.sublimetext.com/t/goto-symbol-in-same-language/23049
Very similar to this other, actually solving that should fix this:
I use IronLangs which point from one language (say Ruby or Python) to another (like C#). I am totally cool with preferring the same language first, but I absolutely do not want other languages to be excluded.
Backlinking https://github.com/sublimehq/Packages/issues/647.
This 3 year old issue seems more relevant now that linked definitions have a new accessible pop-over UI.
Thanks for the backlink @michaelblyons. This further confirms the need for having this configurable in settings.
Settings option could be a boolean named "scope_definitions_by_language". When true
, it only shows definitions from the same language being viewed, and when false
, it could prefer the same language as others have suggested.
Should the default be true
or false
? Maybe false
to not throw off any current users?
I would suggest more customizability than a boolean toggle -> maybe a mapping of what base scopes to link to other base scopes?
I would suggest more customizability than a boolean toggle -> maybe a mapping of what base scopes to link to other base scopes?
I proposed a more flexible way on: https://forum.sublimetext.com/t/goto-symbol-in-same-language/23049/2
I like it. If I have a symbol on a Pawn language file, I want it to point to the C++ file. So, a setting option to enable this behavior or not, is welcome. But of course, on an PHP/CSS project I would like this feature enabled.
Then instead of just enabled or disable crossed language symbol linking globally, add a setting to select what languages may not have crossed symbols. Example:
"not_crossed_symbols_languages":
[
{ ["source.CSS", "source.PHP" ] },
{ ["source.Java", "source.C++" ] },
]
On the above example, only the symbols from CSS and PHP, will not be crossed, the same for the second line. But all other things as symbols not mentioned within the same line as from CSS, Java, C++, etc, are allowed to be crossed.
I assume this isn't happening, but just in case... bump?
Example
You have 2 files of different languages
rb
andphp
.and
and your current working file is a
php
fileWith the cursor anywhere on
Exporter
, run the commandGoto definition...
.Actual
The overlay lists two possible definition locations:
Expected
Goto definition...
to only use the current scope. In the case above,Goto definition...
would just directly to thephp
definition because that was the scope whenGoto definition...
was triggered.At the very least the
php
definition should be listed first.I prefer for
Goto definition...
to use the current scope, because I can't even think of a valid use case where I would expect, in use cases like this, to goto therb
definition.Vim
Vim for example, by default, jumps to the first definition. However, it also allows modifiers to the jump e.g.
N
where n is a index of the list so4C-]
would jump to the 4th possible definition, it also allows to jump or show list if more than one possibility.re: http://vimdoc.sourceforge.net/htmldoc/tagsrch.html