1

I'm trying out OmniPascal but I can't get it to find units in the Delphi installation directory like System.SysUtils. It just tells me that it cannot find the unit. See the attached image. Any ideas what I could be doing wrong?

It also doesn't find units in the local workspace for a very large Delphi project folder (thousands of files and hundreds of folders).

enter image description here

Wosi
  • 41,986
  • 17
  • 75
  • 82
Jed Veatch
  • 2,326
  • 3
  • 12
  • 13
  • 1
    Do you open a folder in VSCode or just a file? It's important to open a folder in order to have the plugin initialized properly. Your settings look good as long as you don't use Delphi Starter. The starter doesn't include `.pas` files. – Wosi Sep 19 '16 at 12:25
  • Yeah, I opened a folder. I tested it first with a very large Delphi project and second by creating a new folder with only two pas files. With the small folder, it doesn't have a problem finding other units in the folder. However, it still does not find the Delphi pas files like SysUtils. With the large project, it's not able to find any units, including the units in the folder. Could it be that the parser is just taking a very long time to parse the folders? If I add the folder that System.SysUtils.pas is in to the objectpascal.searchPath, it does find it. – Jed Veatch Sep 19 '16 at 13:32
  • VSCode takes some time to open a huge folder and OmniPascal needs also some time to get ready in a huge one. I'm using OmniPascal in a project with 7k units and several thousands more in the search path. It takes around a minute to get ready but then it works as it should. Does the `OmniPascalSever.exe` process spawn in background when you open a huge folder? Do you see any activity in the taskmanager when you try to resolve a unit name in the uses clause? – Wosi Sep 19 '16 at 13:54
  • I've let it sit for several minutes after opening a folder and it still doesn't find the units. I do see OmniPascalServer.exe running in the Task Manager and the CPU usage does slightly increase as I'm typing a unit into the uses clause. Is there a log file for OmniPascalServer.exe that might give us some more information on what it's doing? – Jed Veatch Sep 19 '16 at 14:09
  • Not in the release version. Does OmniPascal work on symbols declared inside the same unit? For example, what's popping up when you hovering the `Result` symbol within a funtion? What's popping up when you hover a name of a unit declared in the same folder as the current unit? – Wosi Sep 19 '16 at 14:18
  • Hovering over Result shows a popup with "Result: string". Hovering over a unit in the same folder (in the uses clause) shows "Cannot find unit ". Everything seems to work for symbols declared in the current unit. It's finding things outside of the current unit that aren't working. – Jed Veatch Sep 19 '16 at 14:29
  • OK, so OminPascal is generally working but there is something strange going on with the search path. How does the command line for `OmniPascalServer.exe` look like? Please copy it from the task manager or the output of `WMIC PROCESS get Caption,Commandline,Processid` – Wosi Sep 19 '16 at 14:42
  • C:\Users\jveatch\.vscode\extensions\Wosi.omnipascal-0.10.0\bin\win\OmniPascalServer.exe "c:\WO Network\WideOrbit\Source" "C:\Program Files(x86)\Embarcadero\Studio\15.0" "" – Jed Veatch Sep 19 '16 at 15:00
  • That looks good. I don't see any problems here. Are there any unicode characters in some of the paths OmniPascal is supposed to work with? How many files and `.pas` files are inside the folder you open in VSCode? – Wosi Sep 19 '16 at 15:29
  • I don't think there are any unicode characters in the paths. The folder I opened has 9953 total files and 663 folders. 4392 .pas files. – Jed Veatch Sep 19 '16 at 17:25
  • I just noticed that in my large folder, a unit will be resolvable in a uses clause after I open that unit in VS Code. Is it true that a unit must have been opened in VS Code before it will be able to resolve? – Jed Veatch Sep 19 '16 at 18:34
  • The size of the folder is OK. It's working here with a comparable project. No, you don't need to open a file in order to see its symbols. When the OmniPascalServer starts it creates an index of all the files within the opened folder and the entire search path in order to find units quickly. In addition to that all files opened in VSCode are added to that index. Maybe the indexing process takes a lot of time or it never finishes. So OmniPascal only finds those files which have been already opened in VSCode. We should now investigate why OmniPascal has problems to work with your project folder. – Wosi Sep 20 '16 at 09:00
  • I'd appreciate your help in order to bring OmniPascal to a stable version. As described above I think there is something unexpected inside your project folder. I would move all the subfolders to a temporary location and see whether OmniPascal is able to work with it or not. When it's working move one of the subfolders from the tempory location back to its place and try OmniPascal again. Repeat these steps until it's not working again. Hopefully we can find out what's causing the problem. – Wosi Sep 20 '16 at 09:06
  • 1
    Ok, I'll give that a shot. However, there are two issues going on. 1) it cannot resolve units in the Delphi installation path. This happens even with a folder with only 3 .pas files and nothing else. 2) it cannot resolve units that are inside my large project folder unless they have been opened in VS. It is able to resolve local units in my small folder with no trouble. So maybe the approach you suggested will help with this issue. I'll let you know how it goes. – Jed Veatch Sep 21 '16 at 13:47
  • I've discovered something interesting in playing with this. My test folder has 4 .pas files and 1 subfolder with 2 more .pas files. When this folder is on my Desktop, I can open in VS Code and all 6 units are resolvable. If I copy that folder to the root of C:\ and reopen VS Code, only the units at the parent folder will be resolvable. The 2 in the subfolder will not be. I've tried copy it to a few other folders and it only seems to work when the folder are in folders under my users folder. I tried running VS Code as administrator but that didn't make a difference. – Jed Veatch Sep 21 '16 at 15:22
  • I thought that maybe if I copied my large project folder to the desktop that it would work. Unfortunately, it didn't seem to make any difference. It still only resolves units that are contained in the parent folder, no subfolders. – Jed Veatch Sep 21 '16 at 15:24
  • That sounds pretty strange. What is your Windows version? Are there any right restrictions on the subfolders or something similar? I'm running out of ideas. – Wosi Sep 21 '16 at 15:33
  • I'm using Windows 7. The folders don't have right restrictions. I did try copying my large project folder to the Desktop again, and this time is it resolving all units in the project (still not in the Delphi installation directory). So it appears to be something related to the location of the folder. – Jed Veatch Sep 21 '16 at 17:22
  • I noticed when I open the folder on the Desktop, it takes several seconds for the red, squiggly lines to show up under the units in the Delphi Installation Directory (like it's working on the indexing). However, when I open the folder from the original location, it shows the red lines almost immediately. Would it be possible to try running a dev build of the OminPascalServer that might be able to log some information to help us? – Jed Veatch Sep 21 '16 at 17:24
  • Yes, I think it'd be the best to have logging version of OmniPascalServer in order to get this fixed. I need some time to prepare a logging version of it. I will tell you as soon as it is done. I think your Delphi installation path makes the same problems as your original project path. We will figure it out. – Wosi Sep 21 '16 at 17:32
  • Please replace the OmniPascalServer.exe with this version: www.omnipascal.com/dbg/jedveatch.rar It will create a log file. I hope this will bring us forward. Warning: The log file can become really huge! – Wosi Sep 22 '16 at 11:34
  • Thanks! Using that new version I've been able to confirm that not all the subfolders are getting indexed. First, the Delphi installation directory. It is consistently only indexing two of the child folders (InterBaseXE3 and lib). I can't figure out why it's skipping all of the other folders including source. I can't find any permission differences between the folders. Second, the workspace directory. It only shows the top level directory as being indexed. However, if I copy that folder to my desktop and try again, it will correctly index all subfolders recursively. – Jed Veatch Sep 23 '16 at 14:15
  • Thirdly, I have a folder in the searchPath. The log only shows the top level folder being indexed. I'm not sure how helpful this was because it just confirmed what we already knew. I don't see any errors related to indexing in the logs that I generated. Maybe you could take another look at the logs. How can I get them to you? – Jed Veatch Sep 23 '16 at 14:16
  • Please file a bug here and add the log file: https://bitbucket.org/Wosi/omnipascalissues/issues – Wosi Sep 24 '16 at 00:03
  • 1
    I have created the issue: https://bitbucket.org/Wosi/omnipascalissues/issues/25/child-folders-in-delphi-installation-path – Jed Veatch Sep 24 '16 at 20:57
  • I have an idea about what's wrong. Please try this version: www.omnipascal.com/dbg/jedveatch2.rar Does it work now? – Wosi Sep 26 '16 at 10:36
  • Yay! It is correctly indexing the folders now. What was the issue? The only issue that still remains is that the IDE still shows the units as unresolved until I make a change to the uses clause. However, when I hover over a unit name it shows the location to the file. So it's like it thinks it can't find it, marks it with the squiggly line, and then the indexer finishes but the IDE isn't updated until a change is made to the uses clause. – Jed Veatch Sep 26 '16 at 13:29
  • That's great! Thanks for your patience. See the answer for more information. Version 0.11.0 will be released soon. It will fix your issues. You can use the current debug version until then. – Wosi Sep 26 '16 at 14:05

1 Answers1

0

There's a bug in the OmniPascalServer.exe in version 0.10.0 and below. The bug prevents the server from finding folders having the system, hidden or archive flag set. This leads to unresolvable unit names when a unit is placed in a folder with at least one of said attributes set.

Version 0.11.0 will fix that bug.

Workaround for version 0.10.0 and below:

Ensure there are no folders in your search path having above listed attributes set.

Wosi
  • 41,986
  • 17
  • 75
  • 82
  • No folders in my search path include system, hidden, or archive flags, and I'm using the latest OmniPascal. Same symptoms: All of my system/FMX includes are red squiggly underlined. I'm on Delphi 18.0 and have set my path correctly. Sigh. – SomeCallMeTim Mar 08 '17 at 18:04
  • @SomeCallMeTim Please create an issue here: https://bitbucket.org/Wosi/omnipascalissues/issues Don't forget to add your configuration. – Wosi Mar 09 '17 at 10:08