Jump to content
Incus J

Code Insight can't find certain units (app compiles OK)

Recommended Posts

I think I'm encountering an issue with Delphi 11 Code Insight.  In the Structure pane I'm seeing a lot of F2063 errors, like this:

 

F2063 Could not compile used unit 'some unit' at line x (x:y)

 

The app compiles and runs fine.  If I examine the source code, the declaration of the offending units in the uses statement are underlined in red, and Find Declaration fails.  It's as though the IDE (Code Insight/Error Insight) simply can't locate the files in question to compile them, hence the errors, but the compiler itself has no problem.

 

This seems to be happening to units that are stored on a path that contains a '+' (plus) character in folder name.  The path is a valid Windows path, and these units have been in a folder named like this for years, and used in many Delphi projects.  So I suspect a recent bug in the way Code Insight/Error Insight parses the paths of used units (?)

 

If I simply rename folders to remove the (potentially) offending character, other existing projects that use these units will break, so I'd like to avoid that.

 

Since I'm unsure, I thought I'd ask:  Does anyone know whether the Delphi 11 IDE has an issue with certain characters in folder names?

 

Share this post


Link to post

I might just have confirmed it.  For a unit path like this:

C:\Path\+Library\+Folder\unit.pas

The IDE Find Declaration command reports: 

Cannot open file "C:\Path\ Library\ Folder\unit.pas"

Notice that the IDE has mistakenly converted all the + characters in the path to spaces.  As though it has accidentally fed the path through a URL decoding routine, which has mangled it.  (In URLs, spaces are often encoded as + characters, but not in Windows file paths).

Edited by Incus J
  • Thanks 1

Share this post


Link to post

It is worth reporting in QP.

 

As a work around you could create a link and then add that linked folder to the end of your search path.

Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    Specifies the new symbolic link name.
        Target  Specifies the path (relative or absolute) that the new link
                refers to.

 

  • Thanks 1

Share this post


Link to post

Thanks SwiftExpat - I'll have a go at your work around.  I've never created a symbolic link before.

 

I'm struggling to report the issue.  I've logged in OK and got the report all typed up in the form, with steps to reproduce, but when I click Create, the form will not submit:

You do not have permission to create issues in this project.

 

The project defaulted to RAD Studio (RSP) which sounds correct, but the only options available to me in the dropdown menu are:

Community Site (CMP)

Interbase (IBP)

xxxxxxxxxxxxxxxx

 

Hmm...  I could try selecting xxxxxxx?

Share this post


Link to post

Symbolic links using the /J option to create junctions (hard folder links) has solved it temporarily.  IDE Error Insight is now able to find the units.  Thank you for the work around.

Edited by Incus J

Share this post


Link to post

I've successfully reported the issue here:

 

RSP-38478 : IDE mangles unit paths causing Code Insight, Error Insight and Find Declaration to fail

 

A little tricky to report as the quality website also mangles my example paths - but differently (the paths looks OK in the editor prior to submission, but once submitted the report is displayed with some backslash characters removed from the paths).

Edited by Incus J

Share this post


Link to post

You can upload a zip file with a project and or a txt file with the description that will be not altered by the site.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×