jmigpin/editor

can users override/program the right click action?

rythmkraze opened this issue · 2 comments

The "jump to definition" feature currntly implemented using guru does not work with CGO. It cannot find the definition for files that import "C". While the godef tool does work with CGO, but I have to go through extra clicks to land at the definition as it first prints the <filename>:#<offset> in a separate row.

Can the user program an action upon click events?

PS: Thank you for the project. Also thanks for your quick responses on earlier issues.

Currently, no.

I was considering taking a peek at plugins and allow a command line argument to specify the plugin location. Then all sort of behavior could be programmed externally, including the terminal filter added to improve #9.

Going to take a look at this.

PS: No problem. Thanks for the feedback to improve the editor.

This has been possible since the implementation of plugins, with one sample plugin showing how to program this behavior.

The relevant code references are:

func OnLoad(ed *core.Editor) {
// default contentcmds at: github.com/jmigpin/editor/core/contentcmds/init.go
core.ContentCmds.Remove("gotodefinition") // remove default
core.ContentCmds.Prepend("gotodefinition_godef", goToDefinition)
}

func init() {
// order matters
core.ContentCmds.Append("gotodefinition", GoToDefinition)
core.ContentCmds.Append("openfilename", OpenFilename)
core.ContentCmds.Append("opensession", OpenSession)
core.ContentCmds.Append("openurl", OpenURL)
}

Closing since the mechanism seems to work fine.