Sublime Forum

The "Goto Definition" panel is frustrating me endlessly

#1

Most of the time Sublime Text is very good at finding the definition and
taking me there. Great. If it finds some alternatives it then pops up a panel on top, with suggestions where else I could go to.

So I see the panel, and I want to get rid of it and I press ESC. The panel is gone, but now I am back at where I started. This just happens countless times, since “press ESC” to get rid of panels is conditioned into me. And this is an immense source of frustration.

What would be better for me:

  • as soon as I click on any of the text that has been found, the modal panel goes away. This would seem to me to be the most user friendly action.
  • Or ESC just closes the panel. After all there is CTRL-TAB to get back to the previous place.
0 Likes

#3

Thanks for the tip. I’d say, I don’t need it 90% of the time, but there are the other 10%…

0 Likes

#5

I think that’s a misunderstanding. I use “Goto Definition” all the time. But this panel here is the problem:

. This pops up, when there are multiple choices. The problem is then as explained. Sublime Text already moved to the first line, but now the panel gets in the way and closing with ESC undoes the “Goto Definition”.

0 Likes

#6

you can make the following change using https://packagecontrol.io/packages/PackageResourceViewer to get the Esc and click away behavior which you want:

--- Shipped Packages/Default/symbol.py  2017-10-19 20:01:04
+++ Packages/Default/symbol.py  2018-08-30 14:01:44
@@ -145,16 +152,16 @@
 
 def navigate_to_symbol(view, symbol, locations):
     def select_entry(window, locations, idx, orig_view, orig_sel):
         if idx >= 0:
             open_location(window, locations[idx])
-        else:
-            if orig_view:
-                orig_view.sel().clear()
-                orig_view.sel().add_all(orig_sel)
-                window.focus_view(orig_view)
-                orig_view.show(orig_sel[0])
+        # else:
+        #     if orig_view:
+        #         orig_view.sel().clear()
+        #         orig_view.sel().add_all(orig_sel)
+        #         window.focus_view(orig_view)
+        #         orig_view.show(orig_sel[0])

@@ -174,12 +181,11 @@
     else:
         window = view.window()
         window.show_quick_panel(
             items=[format_location(l) for l in locations],
             on_select=lambda x: select_entry(window, locations, x, view, orig_sel),
-            on_highlight=lambda x: highlight_entry(window, locations, x),
-            flags=sublime.KEEP_OPEN_ON_FOCUS_LOST)
+            on_highlight=lambda x: highlight_entry(window, locations, x))

don’t forget to install https://packagecontrol.io/packages/OverrideAudit to know when these files are updated by SublimeHQ

3 Likes

#7

This works great! My life inside Sublime Text just got significantly better. Thanks.

0 Likes