Page 1 of 1
edit script of object at line,column
Posted: Fri Sep 13, 2013 9:57 pm
by monte
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
Re: edit script of object at line,column
Posted: Wed Sep 25, 2013 11:03 pm
by dunbarx
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
Re: edit script of object at line,column
Posted: Thu Sep 26, 2013 1:36 am
by monte
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.
Re: edit script of object at line,column
Posted: Tue Oct 01, 2013 12:17 pm
by LCMark
@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"').
Re: edit script of object at line,column
Posted: Tue Oct 01, 2013 1:07 pm
by monte
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
Re: edit script of object at line,column
Posted: Tue Oct 01, 2013 7:21 pm
by mwieder
@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
Re: edit script of object at line,column
Posted: Tue Oct 01, 2013 9:44 pm
by monte
@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.