Code bookmarks (usability)

Hi Jay,
I’m testing the open beta now. There are a few things regarding usability that I hoped would be fixed in v3, but they are still there.

When using code bookmarks and collapse any function before that bookmark, the “jump to” doesn’t work right. It seems like it’s jumping to the position where the bookmark would be if the functions were NOT collapsed. uh… understand what I mean?

Sometimes, when copy/pasting bits of code, everything gets higgledy-piggledy: lines of code are shown on top of another. When I use the mousewheel a bit then, everything looks right again…
these are no bugs but usability issues. It would be much more fun to work with CPM without them. :wink:

Nonetheless, CPM is a great tool!

-finefin [import]uid: 70635 topic_id: 25717 reply_id: 325717[/import]

Bookmarks are a weird thing since they’re based on a specific line. Which means you can bookmark the start of a function and the add/remove some code above and you no longer have a bookmark that leads to what you thought it should.

Which is why there are now labels you can put in your code, like this:

[lua]–#cpm label Timer Cancel All
helpArr.cancelAll = ‘timer.cancelAll()’
timer.cancelAll = function()
while #timerArray > 0 do
timer.cancel(table.remove(timerArray,1))
end
end[/lua]

Anything after “label” will be shown in the CPM Tags list, like this:

One thing to watch out for is that when you type in a CPM tag it won’t “pick it up” until after you hit return at the end of the line. To try and keep the editor as fast as possible I only check for those things at a carriage return.

The nice thing about the label tag is that it “floats” withe the code, so adding/removing won’t affect it – clicking it in the Tags list will take you back there (the line number shown in the picture is dynamic, it changes as the actual line number changes).

That CPM Tags list will show labels as well as “to do” items as well as a couple other things that aren’t public at this point.

[lua]–#cpm TODO Make a list of new stuff in CPM[/lua]

That will show up in the list, too. And all labels will be grouped together, all To Do items, etc.

As far as the glitchy editor, I still haven’t been able to track that down. As you know, it’s an aesthetic thing only, it doesn’t actually affect the code – but I know it’s still an annoyance.

Jay

PS - There’s a small shortcut for CPM tags, hit – and then the Tab key.
[import]uid: 9440 topic_id: 25717 reply_id: 103964[/import]

thanks, jay
the label feature sounds great. I’ll try that to organize my spaghetti code, hahaha :slight_smile:

keep up the great work!

-finefin [import]uid: 70635 topic_id: 25717 reply_id: 103976[/import]

The tags in CPM v3 changed a little bit – the “cpm” part is no longer needed (and will stop working in a future version).

Now you can put labels in like this:

--#label Whatever You Want Here  

All the other tags I’ve mentioned here and there are the same – strip out the “cpm” part and you’re good to go.

Jay
[import]uid: 9440 topic_id: 25717 reply_id: 108381[/import]