[Gambas-user] Code for the IDE
Benoît Minisini
g4mba5 at gmail.com
Tue Feb 23 16:46:14 CET 2021
Le 23/02/2021 à 04:24, Jussi Lahtinen a écrit :
> Hi,
> I made a quick hack to get back the old feature, that the debug outputs
> can be used to jump to the code.
>
> I added this to
> gambas/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class :
>
> Public Sub GotoDebug() As String
>
> Dim sText As String
>
> sText = $hScreen.GetSelectedText()
> If sText = "" Then
> sText = Me.Text
> Endif
>
> Return sText
>
> End
>
> And modified /gambas/app/src/gambas3/.src/Debug/FOutput.class and
> FOutput.form
> accordingly to jump to the code.
>
> Not as slick as the old way, but surely better, than nothing. And in my
> books good enough.
> IE. Double click the address of the debug output and press Ctrl + g.
>
> The modified files are attached. Any change to get them to the official IDE?
>
> Jussi
>
Hi,
I wanted that feature too, but I don't want a quick & dirty hack. :-)
So I modified the TerminalView so that he can recognize and highlight links.
The feature is based on two events, one method, and two properties.
1) The event "Link": it is raised while the mouse cursor is moving. It
gives you the contents of the current line, the position of the
character under the mouse cursor inside that line.
Note that it takes into account line wrapping.
2) The "Link" property: the event arguments are stored in that property,
which is just a class with public properties or variables.
3) The method "Select()" of the Link property: You must call it during
the Link event to tell which part of the current line is a link. You can
associate an arbitrary link type (a string) that will be passed to the
"Click" event.
4) The event "Click": it is raised when the user actually click on the
link highlighted by "SelectLink()".
5) The "ShowLink" property: it toggles link management. By default link
management is disabled.
By default the TerminalView will recognize "http" and "https" URLs, and
will open them if the 'gb.desktop' component has been loaded by your
project.
Note: if you don't want URLs to be recognized, you have to detect them
yourself during the Link event and cancel the event without calling
Link.Select().
Finally I modified the IDE so that class + method + line positions are
recognized.
Enjoy!
--
Benoît Minisini
More information about the User
mailing list