f



Things that make you swear

Following on from a previous thread about things in Dolphin that don't
work quite as you would expect I thought I might as well document my
pet peeve.  It doesn't happen enough to make me want to see if I can
find some way of obviating the problem, but it does happen enough for
me to get annoyed about it when it happens.

I suppose it's really a refactoring browser issue, rather that Dolphin
though....

Say you have creating/editing a method and end up with red underlining
and the status bar showing "missing )".  My immediate reaction is to
do refactor/accept, so that the bracket mismatch becomes more obvious.
A simplified example, for the purposes of this post, might be

aa
	(self
		aa;
		aa.) self aa

During the editing the period has been, incorrectly, moved inside the
bracket.  A refactor/accept then gives you 

aa
	self
		aa;
		aa

The removed, possibly edited, code at the end of the method has just
gone; it's not in the change log and Ctrl-Z won't bring it back.

A few possible solutions come to mind; perhaps I shall investigate...

- Reformat/accept is disabled on methods with errors (not warnings)
- Reformat/accept is disabled if one of the hidden error messages is
"nonsense at end of method"
- Copy text to the clipboard (or change log) before refactoring
methods with errors

Glad to have got that off my chest.  Now back to waiting for the wind
(rather blowy here at the minute) to blow a tree over onto my car....


Ian
-- 
The From address is valid
0
contact23 (13)
11/14/2009 3:07:03 PM
comp.lang.smalltalk.dolphin 3769 articles. 0 followers. Post Follow

4 Replies
283 Views

Similar Articles

[PageSpeed] 1

>A few possible solutions come to mind; perhaps I shall investigate...
>
>- Reformat/accept is disabled on methods with errors (not warnings)

For the record, I went with that one ...

MethodWorkspace>>queryCommand:

remove the statement that provides a common check for #accept and
#reformatAccept.  Replace it with 

#accept == selector
	ifTrue:
		[aCommandQuery isEnabled: self canSaveMethod.
		^true].
#reformatAccept == selector
	ifTrue:
		[aCommandQuery
			isEnabled:
				self canSaveMethod &
(compilationErrors allSatisfy: [:each | each severityClass ~~ Error]).
		^true].

Seems to work as advertised ...

Ian
-- 
The From address is valid
0
IanB
11/14/2009 4:31:57 PM
> - Reformat/accept is disabled on methods with errors (not warnings)
> - Reformat/accept is disabled if one of the hidden error messages is
> "nonsense at end of method"
> - Copy text to the clipboard (or change log) before refactoring
> methods with errors

I encourage you to go for less infantilization & totalitarianism and
more error recovery & empowerment. Smalltalk is Freedom & Light after
all, not Bondage & Discipline.

Simultaneously, I strongly DIScourage you from messing with the
clipboard. EVER. The user OWNS that so you MAY NOT interfere.

So the change log is one possibility. Another is to preserve the last
few edit buffers and make them available from the Edit menubar,
possibly under >>Past Buffers or just >>Buffers. Presumably they would
insert the buffer at the cursor position.
0
Richard
11/14/2009 11:08:32 PM
>I encourage you to go for less infantilization & totalitarianism and
>more error recovery & empowerment. Smalltalk is Freedom & Light after
>all, not Bondage & Discipline.

Some umm, interesting, imagery there :-)

I'm quite happy now with the way I "fixed" it, by disabling the menu
option.  I wish I'd looked into it earlier.

My normal method of accepting source is right-click then
reformat/accept. I do it automatically, without really thinking, and I
suppose that was the underlying problem.

The only thing I lose by disabling the menu option, if the method
contains errors, is the possibility of losing source.  I can still
reformat the code, to make spotting mismatching braces easier for
example, but only by using an option that makes any deleted source
recoverable (via Ctrl-Z).

Ian
-- 
The From address is valid
0
IanB
11/15/2009 8:02:41 AM
Ian,

>> A few possible solutions come to mind; perhaps I shall investigate...
>>
>> - Reformat/accept is disabled on methods with errors (not warnings)
> 
> For the record, I went with that one ...
> 
> MethodWorkspace>>queryCommand:
> 
> remove the statement that provides a common check for #accept and
> #reformatAccept.  Replace it with 
> 
> #accept == selector
> 	ifTrue:
> 		[aCommandQuery isEnabled: self canSaveMethod.
> 		^true].
> #reformatAccept == selector
> 	ifTrue:
> 		[aCommandQuery
> 			isEnabled:
> 				self canSaveMethod &
> (compilationErrors allSatisfy: [:each | each severityClass ~~ Error]).
> 		^true].
> 
> Seems to work as advertised ...

Why not work with this for a bit and then, if you're happy with the 
outcome, I'll incorporate the fix in the base.

Best regards

Andy Bower
0
Andy
11/15/2009 5:41:55 PM
Reply: