SourceHoverProvider class
Adds text to the box that the code editor shows when the mouse rests on twinBASIC code. Made by Integration.AddSourceHoverProvider.
Private WithEvents LineInfo As SourceHoverProvider
Private Sub Host_OnProjectLoaded()
Set LineInfo = Host.Integration.AddSourceHoverProvider("lineInfo")
End Sub
Private Sub LineInfo_Hover(ByVal Uri As String, ByVal LineNumber As Long, ByVal CharOffset As Long, _
ByVal IsDebugging As Boolean, ByVal ResultResolver As AsyncResultResolver)
If IsDebugging Then
ResultResolver.Resolve ""
Else
ResultResolver.Resolve "**Line " & LineNumber & "**, column " & CharOffset
End If
End Sub
Properties
Enabled
Whether the provider is asked. Boolean, read/write. True when it is added. While it is False, Hover does not fire, and the box shows what it would without the provider.
Name
The name given to AddSourceHoverProvider. String, read-only.
Events
Hover
Fires when the mouse rests on code in a twinBASIC file, before the box shows. The box waits for the answer of every provider.
Syntax: provider_Hover( Uri As String, LineNumber As Long, CharOffset As Long, IsDebugging As Boolean, ResultResolver As AsyncResultResolver )
- Uri
- The file’s path in the project, with
twinbasic:in front of it:twinbasic:/MyProject/Sources/Module1.twin. - LineNumber
- The line the mouse is on, counted from 1.
- CharOffset
- The column the mouse is at, counted from 1.
- IsDebugging
- True while the program is stopped in the debugger.
- ResultResolver
- Takes the answer. Call its Resolve with the text to add, in markdown, or with an empty string to add nothing. The call may come later, from a timer or another thread, but every hover waits for it.
The answer is markdown: **bold**, `code` and links. A link to command: and a SourceCommand’s CommandID runs that command when clicked; see CommandID for its arguments. An HTML tag in the answer is dropped, and the text inside it kept.
The box shows the IDE’s own text first, then the providers’ answers in the order of their priority, the lowest first. A provider gives its priority with SetPriority before it calls Resolve; the priority is 0 when it does not.
See Also
- Integration.AddSourceHoverProvider method
- AsyncResultResolver class
- SourceCommand class