"Selected Word" Doesn't Include Module Name
"Selected Word" Doesn't Include Module Name
How can I get the IDE's full "word currently under the cursor" for procedures/constants/variables of modules?
Unfortunately in this case the environment variable PB_TOOL_Word or the %WORD argument is unusable... Because when hovering e.g. over MyProc() of MyModule::MyProc() it should return MyModule::MyProc instead of just MyProc, right? Do you have any suggestion how I can get the currently selected fully qualified name in a cross-platform way?
Unfortunately in this case the environment variable PB_TOOL_Word or the %WORD argument is unusable... Because when hovering e.g. over MyProc() of MyModule::MyProc() it should return MyModule::MyProc instead of just MyProc, right? Do you have any suggestion how I can get the currently selected fully qualified name in a cross-platform way?
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: "Selected Word" Doesn't Include Module Name
Don't you agree that it's unusable like this for modules? I'd say this is even a bug. I clarifying reply from a team member would be highly appreciated...
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: "Selected Word" Doesn't Include Module Name
Well, it returns the word at the cursor as the description says. It doesn't perform any deeper analysis of what that word means or the context in which it appears. Its not a bug.
If you need context information you will have to parse that yourself.
If you need context information you will have to parse that yourself.
quidquid Latine dictum sit altum videtur
Re: "Selected Word" Doesn't Include Module Name
Thanks for your reply, freak.
I know what you mean but define "word" in the context of a programming language IDE. It would simply make more sense in that case and since you're in control I thought you'd agree.freak wrote:Well, it returns the word at the cursor as the description says. It doesn't perform any deeper analysis of what that word means or the context in which it appears. Its not a bug.
Too bad. How?freak wrote:If you need context information you will have to parse that yourself.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: "Selected Word" Doesn't Include Module Name
PB_TOOL_Cursor gives you the location of the cursor in the source code. From there you can determine the context.
quidquid Latine dictum sit altum videtur
- Zebuddi123
- Enthusiast
- Posts: 794
- Joined: Wed Feb 01, 2012 3:30 pm
- Location: Nottinghamshire UK
- Contact:
Re: "Selected Word" Doesn't Include Module Name
Hi c4s Get`s all the selection
Zebuddi.
Zebuddi.
Code: Select all
Procedure.s sScintillaGetSelection()
Protected iScintilla.i = Val( GetEnvironmentVariable("PB_TOOL_Scintilla")), iStart.i, iEnd.i, iIndex.i, sString.s, iResult.i
If iScintilla
SendMessageTimeout_(iScintilla, #SCI_GETSELECTIONSTART , 0, 0, #SMTO_ABORTIFHUNG, #SCI_START, @iStart)
SendMessageTimeout_(iScintilla, #SCI_GETSELECTIONNEND , 0, 0, #SMTO_ABORTIFHUNG, #SCI_START, @iEnd)
For iIndex = iStart To iEnd-1
SendMessageTimeout_(iScintilla, #SCI_GETCHARAT, iIndex , 0, #SMTO_ABORTIFHUNG, #SCI_START, @iResult)
sString + Chr(iResult)
Next
ProcedureReturn sString
EndIf
EndProcedure
OpenConsole()
Print(sScintillaGetSelection())
Input()
CloseConsole()
Last edited by Zebuddi123 on Sun Mar 12, 2017 1:23 am, edited 2 times in total.
malleo, caput, bang. Ego, comprehendunt in tempore
Re: "Selected Word" Doesn't Include Module Name
I have never read it as being described as anything but an individual collection of allowable characters terminated on both ends by allowable termination characters. In PB's case, those termination characters would be spaces, but may also include symbols. So, it sounds like you just don't like the commonly accepted definition...c4s wrote:...define "word" in the context of a programming language IDE.
Last edited by Tenaja on Sun Mar 12, 2017 6:12 pm, edited 1 time in total.
Re: "Selected Word" Doesn't Include Module Name
Search for Tool code that returns the entire line your cursor is on. Then use StringField(Line$, indx, "::") in a loop to build what you want. I don't think line continuation allows breaks within 'module names::procedures', so 1 line should suffice.c4s wrote:Too bad. How?freak wrote:If you need context information you will have to parse that yourself.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: "Selected Word" Doesn't Include Module Name
the code of a tool by danilo might be also helpful:
http://www.purebasic.fr/english/viewtop ... 60#p381060
http://www.purebasic.fr/english/viewtop ... 60#p381060
Re: "Selected Word" Doesn't Include Module Name
Thanks for the code, Zebuddi123! Too bad that there doesn't seem to be an easy (built-in) cross-platform way, or is it?Zebuddi123 wrote:Hi c4s Get`s all the selection [...]
So? It seems that you actually agree with me! (Emphasis by me.)Tenaja wrote:I have never read it as being described as anything but an individual collection of allowable characters terminated on both ends by allowable termination characters. In PB's case, those termination characters would be spaces.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: "Selected Word" Doesn't Include Module Name
it's not as simple as you might think.
'arr' is simply the correct word at cursor position.
..and just think about UseModule / With,EndWith etc.
Code: Select all
m::var(0)\arr[0]\s
^
cursor here, what would you like to get in that case?
arr[0] ?
arr[0]\s ?
m::var(0)\arr ?
m::var(0)\arr[0]\s ?
..and just think about UseModule / With,EndWith etc.
Re: "Selected Word" Doesn't Include Module Name
For me it's obvious: The whole thing of course ("m::var(0)\arr[0]\s")! That way I'm able to get the part that I want/need, else I don't even have the option...#NULL wrote:it's not as simple as you might think.'arr' is simply the correct word at cursor position.Code: Select all
m::var(0)\arr[0]\s ^ cursor here, what would you like to get in that case? arr[0] ? arr[0]\s ? m::var(0)\arr ? m::var(0)\arr[0]\s ?
..and just think about UseModule / With,EndWith etc.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!