useful 'Issues' and 'Folding' tricks

Share your advanced PureBasic knowledge/code with the community.
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

useful 'Issues' and 'Folding' tricks

Post by Blue »

:idea: *** A quickly modifiable coloured label *** :idea:
*** IMPORTANT : i forgot to mention that i'm using PB 5.31 x86 on Windows x64.
                          Not yet tested in PB 6.40
correction 1 : :oops: ... i meant 5.31 and 5.40, of course (Vade retro, Alzheimer...)
correction 2 : Guided by laziness, i simply copied/pasted my explanation lines below;
which made me forget to specify that you HAVE
to UNCHECK the "Show in Issue Tool" option for the second entry, to avoid duplicate labels in the issue browser.

Here is a small trick easily achieved via the fabulous "Issues" tool provided with the PureBasic IDE.
The "Issues" tool, as we all know, allows to quickly navigate through the 39 modules and 65 files of your BIG project...
and it works for small 1-file projects too :wink:

We can make full use of its built-in flexibility with a very simple trick.
Here's how:

step 1 : -----------------------------------------------------------
In the Issues editor of the Preferences file, add a [ New ] issue :

issue name : here
reg. expr. : ::.* <-- hard to read ? it is: colon + colon + period + asterisk
priority : normal
color : yellow <-- my friend RASHAD's favourite ! :lol:

- Select 'Change issue background' to produce a coloured label
- Check 'Show in issue tool' <--- Quick jump to the label. Great feature !
- Click on [Update] to save your choices <-- don't forget !
--------------------------------------------------------------------------
step 2 : ----------------------------------------------------------------
Reproduce the above "issue" by selecting it and then clicking on [ New ] issue again:

issue name : here: <-- same name, with some character appended. I use a colon.
reg. expr. : :: .* <-- hard to read ? it is: colon + colon + SPACE + period + asterisk :idea:
priority : normal <-- no need to change this
color : yellow <-- none needed : whatever you choose, it will be the same as the previous one !

- Select 'Change issue background' to produce a coloured label
- UNCheck 'Show in issue tool'    <-- to avoid duplicate labels
- Check 'Show in procedure browser' <-- this implements the trick :idea:
Click on [Update] to save your choices
--------------------------------------------------------------------------

You get the usual when you write
; a comment ::module X does this and that <-- displayed and colored by 'Issues' browser
; another comment ::54 : important ! <-- displayed and colored by 'Issues' browser

but now it can quickly be made to ALSO appear in the 'Procedure' browser by simply adding a space after the double colons :
; a comment :: module X does this and that <-- displayed and colored by 'Issues' browser
; another comment :: 54 : important ! <-- displayed and colored by 'Issues' browser
Same comments, but now both visible in the 'Procedure' browser

So very little effort required to add/remove a label, at will, in the Procedure browser.

And it will prove soooooooo useful when debugging.

Of course, for all those who write bug-free code :shock:, this will prove pointless.
But for the rest of us, it is priceless. :oops:


[Addendum]
And while you're finessing in your 'Preferences' file, why not get the 'Issues' and 'Folding' features working together to make your coding life easier? After implementing the 'Issues' patterns suggested above, jump to the [Editor/Folding] section and add
Start Keyword : ;: <-- Unreadable ? That's semi-colon + colon
  End Keyword : ;. <-- Unreadable ? That's semi-colon + period

With this, you end up with a colourful folding 'label' that you can, at will, display/hide in the Procedure browser.

Combining these 2 IDE useful Editor features adds powerful navigating features to the Editor and greatly help to find at a glance where's what in your 12-files and 6000-lines project source files. Unfortunately, the 'Issues' highlighting does not work on lines that start with the built-in folding symbol (;-) (minus sign).

[Change]
I changed my early suggestion of    : label :   to   :: label   because using the space bar as a modifier is much faster than inserting another colon. (for me, anyway)
But, of course, it's only the idea that matters here.
Use whatever symbol is within easy reach for you, on your national keyboard.

 
Last edited by Blue on Thu Oct 08, 2015 4:10 pm, edited 8 times in total.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Simple & useful "issues" trick

Post by Keya »

It is a SUPER USEFUL feature ive used ever since i accidentally discovered it after typing 'TODO' in-comment, where I thought i'd stumbled upon an undocumented feature lolll :oops: :) :)
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Simple & useful "issues" trick

Post by davido »

@Blue,
Very clever.
I'll find this most useful as I tend to write code-free bugs.
DE AA EB
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Simple & useful "issues" trick

Post by Blue »

davido wrote:I'll find this most useful as I tend to write code-free bugs.
:lol: :lol: :lol:
Welcome to the Club. 8)
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: useful 'Issues' and 'Folding' tricks

Post by HanPBF »

Nice trick! Thanks!

Two problems:
- issue is shown twice at my site
- many commented code blocks

Code: Select all

; X=1:Y=0:Z=1
are now also in the issue browser (o.k., commented code shall be deleted...)

But at least really great hint to the regular expression function of the issue tool!
Thanks!
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: useful 'Issues' and 'Folding' tricks

Post by IdeasVacuum »

*** IMPORTANT : i forgot to mention that i'm using PB 6.31 x86 on Windows x64.
Not yet tested in PB 6.40
Wow, I haven't spent much time on PB5.40 yet .... you are ahead of time :)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: useful 'Issues' and 'Folding' tricks

Post by Fangbeast »

IdeasVacuum wrote:
*** IMPORTANT : i forgot to mention that i'm using PB 6.31 x86 on Windows x64.
Not yet tested in PB 6.40
Wow, I haven't spent much time on PB5.40 yet .... you are ahead of time :)
He came from the future!!! I fell out of my chair reading his version numbers:):)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
ostapas
Enthusiast
Enthusiast
Posts: 192
Joined: Thu Feb 18, 2010 11:10 pm

Re: useful 'Issues' and 'Folding' tricks

Post by ostapas »

IMPORTANT : i forgot to mention that i'm using PB 6.31 x86 on Windows x64.
Not yet tested in PB 6.40
I think, the mistake was made intentionally :) Anyway, many thanks for the trick, it is also incredibly useful when using massive amount of folds inside folds(e.g., to indicate parent fold)
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: useful 'Issues' and 'Folding' tricks

Post by Blue »

ostapas wrote:[...]it is also incredibly useful when using massive amount of folds inside folds(e.g., to indicate parent fold)
Yes, you're absolutely right.
That's exactly the problem that led me to this solution.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Post Reply