edit script of object at line,column

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

edit script of object at line,column

Post by monte » Fri Sep 13, 2013 9:57 pm

Howdy

@runrevmark contacted me off list about adding line and column info to the edit script command.
On an unrelated note, might I suggest extending the 'edit script of' syntax to be - 'edit script of <object> [ at <line>, <column> ]'? The edit script command sends a message 'editScript' which the IDE then handles to open the script-editor, it would be pretty trivial to add an extra parameter with "<line>,<column>" which could then open the appropriate S/E at the appropriate place.
I've implemented it but at the moment I'm not doing any checking of the expression after at. What I'm thinking is as this allows an IDE team to specify extra fields if they need to. But it does mean that the editScript handler would need to check each item to ensure they are integers. Any thoughts?

Cheers

Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: edit script of object at line,column

Post by dunbarx » Wed Sep 25, 2013 11:03 pm

Monte.

You mentioned "columns".

Is this related at all to a feature request I made a while back to show a horizontal character "ruler" in the script editor. So when you get an error "...near "XXX" char 78", you can see where the problem lies. I know that double clicking the error message itself hilites the problem area, thank goodness, but it could do more:

Code: Select all

on mouseUp
   put  aaa bbb ccc ddd
   end mouseUp
The error is indicated at char 17, but this is not obvious, at least to me, where and why it should be at that particular place. The hilited text is actually from char 15 to 21.

Just wondering.

Craig Newman

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: edit script of object at line,column

Post by monte » Thu Sep 26, 2013 1:36 am

Well it's only really related to being able to provide some extra data to the script that will open the editor. What that code does with the data is up to the individual implementation.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1206
Joined: Thu Apr 11, 2013 11:27 am

Re: edit script of object at line,column

Post by LCMark » Tue Oct 01, 2013 12:17 pm

@monte: I think I'm fine with no verification at the engine level of the 'at' clause - after all, it's not specifically saying 'at row <expr> and column <expr>' - indeed, without verification there's scope to do things like 'edit script of ... at "my bookmark"', should the S/E (or thirdparty editors) ever support named marks in scripts and such. (Or perhaps things like 'edit script of ... at "command foobar"').

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: edit script of object at line,column

Post by monte » Tue Oct 01, 2013 1:07 pm

that's what I was thinking... shoud it be possible to use an array there do you think... I'm just passing along a string
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: edit script of object at line,column

Post by mwieder » Tue Oct 01, 2013 7:21 pm

@Monte:
I haven't been looking at the web forum for some time now, so I'm just coming into this.
I assume you've already looked at the goLine command in the "Editor" group of the new script editor.
At any rate, if I were implementing this I'd allow the character position to be optional as well, i.e.,

Code: Select all

edit the script of tObject
edit the script of tObject at line 42
edit the script of tObject at char 20 to 40 of line 17

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: edit script of object at line,column

Post by monte » Tue Oct 01, 2013 9:44 pm

@mwieder yes, it's all optional. Whatever comes in the at expression is just passed on as a parameter to editScript. The original idea was row,column but it's unchecked so it's up to an IDE team to implement whatever ways they want to use it. Like @runrevmark mentioned it means you could use it for bookmarks or to go directly to a specific command. It does mean you would need to check the parameter to make sure it conforms to something you can handle though.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Locked

Return to “Engine Contributors”