Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Class Completion    [ Add a report in this area ]  
Report #:  98711   Status: Open
$IFDEF breaks class navigation / code completion
Project:  Delphi Build #:  16.0.4256.43595
Version:    16.0 Submitted By:   Sebastian Zierer
Report Type:  Basic functionality failure Date Reported:  9/9/2011 1:09:06 AM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   287544
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Class navigation / code completion can be confused by $IFDEF. It should not be a problem to navigate between the implementation and interface part of the TTest class using Ctrl+Shift+Up/Down or invoke class completion using Ctrl+Shift+C.

Ctrl+Shift+Up/Down is ignored

Ctrl+Shift+C raises the error "Could not find source location to add method xy. "END." or INITIALIZATION not found in unit source."

The FMX canvas uses Single where the VCL Canvas uses Integer. This makes this problem a bit more relevant and annoying.


Note: QC #34274 might be related, but code navigation in the current example should work regardless of the currently defined $IFDEFs.
Steps to Reproduce:
1. Add the following unit to a Delphi project
2. Try to navigate between the interface Test and the implemtation Test using Ctrl+Shift+Up/Down

Expect: Navigation works
Act: Nothing happens

unit Unit1;

interface

type
  TTest = class
  public
    procedure Test;
  end;

implementation

{ TTest }

procedure TTest.Test;
var
  I: Integer;
begin
  I := 1 {$IFDEF MSWINDOWS}div{$ELSE}/{$ENDIF} 2;
end;

end.

--------------------------------------
Test case 2:
--------------------------------------
1. Add the following unit to a Delphi project
2. Move Cursor to "procedure xy"
3. Press Ctrl+Shift+C for class completion

---------------------------
Error
---------------------------
Could not find source location to add method xy. "END." or INITIALIZATION not found in unit source.
---------------------------
OK  
---------------------------


unit Unit2;

interface

type
  TTest = class
  public
    procedure Test;
    procedure xy;
  end;

implementation

{ TTest }

procedure TTest.Test;
var
  I: Integer;
begin
  I := 1 {$IFDEF MSWINDOWS}div{$ELSE}/{$ENDIF} 2;
end;

end.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01