Sublime Forum

Build 3007

#21

Should be fixed now in 3008.

0 Likes

#22

[quote=“xeno.by”]

+1
I’d second this suggestion. It’s possible to emulate this feature (at least, it worked in ST2), but the implementation is really cumbersome.[/quote]

-1

I’m retracting my +1 here. This functionality is exactly what “Goto Definition…” is. Didn’t even realize this. Works perfectly as-is with keyboard shortcuts. Thanks jps.

0 Likes

#23

I’m well aware of F12.

But sometimes I navigate the project with the mouse (usually when I forget a filename and navigate the Folders view), and Alt+Click instead of F12 is thus niceness (ctrl+click is already taken for multiple cursors, but that’s fine)

0 Likes

#24

alt+click should be already taken as well for removing multiple cursers (that is, dragging them). However, you should be able to create a mouse mapping that runs the goto definition command, e.g. when ctrl-alt-clicking or alt-doubleclicking. See existing “.sublime-mousemap” files for reference.

0 Likes

#25

The problem is not in mousemap. It’s in getting the coordinates of the text that’s been clicked.

0 Likes

#26

SublimeXiki has some example code to do something like this in ST2

0 Likes

#27

[quote=“lunixbochs”]

SublimeXiki has some example code to do something like this in ST2[/quote]

view.sel()[0] isn’t going to work with multiple selections. By “not going work” I mean that I don’t know how to have a mouseclick command that leaves multiple selections untouched and is able to do custom logic based on the clicked location. Here’s what I have to do in sublime-ensime: github.com/sublimescala/sublime … me.py#L190, and still that’s not good enough. If you know a better way, please, tell me.

0 Likes

#28

Two options.

  1. Make the command only work with a single selection. I can’t imagine a case where you’d want to run “goto definition” with multiple cursors - by mouse.

  2. In ST2 you could hook into the “run_” method which just removed the “event” argument from the arguments table. This “event” argument contained details on mouseclicks. Not sure if you can do this in ST3 too.

0 Likes

#29

[quote=“FichteFoll”]Two options.

  1. Make the command only work with a single selection. I can’t imagine a case where you’d want to run “goto definition” with multiple cursors - by mouse.

  2. In ST2 you could hook into the “run_” method which just removed the “event” argument from the arguments table. This “event” argument contained details on mouseclicks. Not sure if you can do this in ST3 too.[/quote]

  3. A valid argument, but why not do better if we can do better?

  4. That’s exactly what I do in the code linked above. Unfortunately, I haven’t found a way to translate screen coords into text coords.

0 Likes

#30

+1
More specifically, could you also include the ability to insert previous elements from the parent scope? For instance, it would be useful if we could prepend the parent class’s name to a method, when transforming its symbol. It should be easy to do if supported, by prepending something like “${meta.class-struct-block.c++ entity.name.type.c++}::” to the method name.

0 Likes