Friday, April 27, 2007

Why F1 Can Fail in the Delphi 2007 Editor

A bug has been reported that is best described on Fernando Madruga's blog here.

It turns out it is a simple logic problem with a new feature of help this version that uses the Delphi compiler to get more information about your code to provide better help. Something I overlooked and wasn't found until after we shipped. It goes something like this (obviously a bit more complex in real life):


begin
if CanKibitzCompile then
DoKibitzHelp
else
DoTokenHelp;
end;


Where DoKibitzHelp uses the compiler to get the type information and DoTokenHelp is a simple hand tokenizer that just returns the token under the cursor (even in comments). The idea was to use the kibitz compiler when we can. So the code should read:


var
Success: Boolean;
begin
Success := False;

if CanKibitzCompile then
Success := DoKibitzHelp;

if not Success then
DoTokenHelp;
end;


So to get help on a symbol in code that doesn't compile you can put the symbol in code where the kibitz compiler will never venture, such as comments.

1 comment:

Fernando Madruga said...

Nice to know the source of the problem is found: I hope this means it's one of the fixes in the first patch! ;)
BTW: don't be afraid of releasing "interim" patches: it's better to have a few small patches every month or so than a "monster" SP1 that shows up only in 6 months that fixes all the major issues. Of course, I understand that testing many patches takes more time/resources than testing one huge patch set, but still, feel free to put them out! If nothing else, let existing customers that are willing to (such as myself!), beta-test those patches! That will save you guys some resources and still allow you to release frequent patches and, hopefully, get rid of the few rough edges that Delphi 2007 still has...
Above all, *please* don't consider BDS 2007 as a way of fixing things that are now broken in Delphi 2007: not only I don't need a full studio, I won't be able to afford it also...

Post a Comment