[Cuis-dev] Syntax Error notification undo bug
Eric Brandwein
brandweineric at gmail.com
Fri Jun 7 13:16:53 PDT 2019
In the end I didn't need to change the Parser, just the TextEditor. I'm not
sure if it's the prettiest way of going about it, but it seems to work
fine. To test it, try writing a method with a syntax error and quickly
saving it, and try to undo it afterwards. Without this ChangeSet, it should
erase not only the syntax error notification, but also some of the text
written before. With the ChangeSet applied, it should just erase the
notification.
El jue., 6 jun. 2019 a las 16:56, Hernan Wilkinson (<
hernan.wilkinson at 10pines.com>) escribió:
> If you do that, you will have to tell the class you are using to test your
> changes to use a different compiler (a subclass de compiler) with the
> message #compilerClass and to that compiler subclass witch parser to use
> with the message #parserClass
>
> Good luck!
> Hernan.
>
> On Thu, Jun 6, 2019 at 4:31 PM Eric Brandwein <brandweineric at gmail.com>
> wrote:
>
>> I didn't think about doing a subclass of the Parser, that's a good idea!
>> I'll try it and ask you if I have any issues. Thanks!
>>
>> El jue., 6 jun. 2019 16:09, Hernan Wilkinson <
>> hernan.wilkinson at 10pines.com> escribió:
>>
>>> Thank you Eric!
>>> You change is on github now.
>>>
>>> About making the "good" fix, sadly there are no tests for the parser,
>>> scanner or compiler... (at least that I'm aware of)
>>> The refactoring tests use the parser and compiler a lot but they do not
>>> cover all the paths.
>>> Making a change in the parser is difficult but not impossible, but be
>>> aware that you should do it using a subclass of the parser because if you
>>> make a mistake you wont be able to fix it because the parser does not work
>>> anymore :-)
>>> If you want to give it a try let me know and I'll show you how to do it.
>>>
>>> Cheers!
>>> Hernan.
>>>
>>> On Wed, Jun 5, 2019 at 3:22 PM Eric Brandwein via Cuis-dev <
>>> cuis-dev at lists.cuis.st> wrote:
>>>
>>>> Hi all,
>>>>
>>>> There's currently a bug when having an unrecognized selector in a
>>>> method and a syntax error at the same time. When the method is saved, and
>>>> the undo command is generated, the selector replacement and the syntax
>>>> error notification insertion of text are merged into one command, which in
>>>> turn makes the command not represent the actual user input.
>>>>
>>>> For example, if we don't have the m2 method defined, and we try to save
>>>> this method:
>>>>
>>>> m1
>>>> self m2.
>>>> [
>>>>
>>>> , an 'Unrecognized selector' popup will appear, prompting you to select
>>>> the correct selector. After selecting it, a syntax error text will appear
>>>> after the '[', and the source text will end up looking something like this:
>>>>
>>>> m1
>>>> self m1.
>>>> [End of block expected ->
>>>>
>>>> After undoing the last command, because the selector replacement was
>>>> merged with the syntax error replacement, the method will look something
>>>> like this:
>>>>
>>>> m1
>>>> self m2ed ->
>>>>
>>>> I made a ChangeSet that fixes it by checking that the stop position of
>>>> the last replacement corresponds with the start position of the new
>>>> replacement before merging the two. But I believe the problem comes from
>>>> the fact that syntax error replacements should not be merged at all with
>>>> previous replacement commands; after all, user text replacements and syntax
>>>> error text replacements seem to me pretty separate undoable commands.
>>>>
>>>> Changing this without having tests for the TextEditor seemed like a
>>>> pretty dangerous task, so I didn't. Plus, the way I thought about changing
>>>> it involved changing the Parser, which seemed even more dangerous. There
>>>> probably are tests for the Parser, but I couldn't find them in the
>>>> BaseSystemTests. Where are they?
>>>>
>>>> Cheers,
>>>> Eric
>>>> --
>>>> Cuis-dev mailing list
>>>> Cuis-dev at lists.cuis.st
>>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>>
>>>
>>>
>>> --
>>>
>>> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
>>> *Phone: +54-011*-4893-2057
>>> *Twitter: @HernanWilkinson*
>>> *site: http://www.10Pines.com <http://www.10pines.com/>*
>>> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>>>
>>
>
> --
>
> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
> *Phone: +54-011*-4893-2057
> *Twitter: @HernanWilkinson*
> *site: http://www.10Pines.com <http://www.10pines.com/>*
> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190607/e3ffb19c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3787-UndoSyntaxErrorsSeparately-EricBrandwein-2019Jun07-16h45m-EB.1.cs.st
Type: application/octet-stream
Size: 3973 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190607/e3ffb19c/attachment.obj>
More information about the Cuis-dev
mailing list