6

People get the error when opening a file in Visual Studio Code when using OmniPascal:

enter image description here

Ordner nicht angegeben

which translates to:

Folder not specified

The first thought to ensure the paths in user settings.json are set:

  • objectpascal.delphiInstallationPath
  • objectpascal.objectpascal.searchPath

Would of course be a wrong tree to bark up:

settings.json:

// Place your settings in this file to overwrite the default settings
{
    "objectpascal.delphiInstallationPath": "D:\\Programs\\Embarcadero\\Studio\\14.0",
    "objectpascal.searchPath": "D:\\Delphi Components"
}

The error is definitely coming from OmniPascal, as it is a string inside

bin\win\OmniPascalServer.exe

enter image description here

I'm not the only person to get this

Anonymous has the same issue:

When I open a .pas file by right clicking on the file in windows explorer, the file opens correctly, but then a messagedialog appears with "Ordner nicht angegeben"' and an OK button.

Is there a way to debug Code?

I can see inside VSCode there is a variable to the workspace root path:

objectPascalServiceClient.js

var config = vscode.workspace.getConfiguration('objectpascal');  
var delphiSDK = config.get('delphiInstallationPath', '');
var searchPath = config.get('searchPath', '');                                                                
var workspacePath = vscode.workspace.rootPath;
if (typeof delphiSDK == 'undefined')
   delphiSDK = "";
if (typeof searchPath == 'undefined')
   searchPath = "";                            

if (isWin) {
    childProcess = cp.spawn(path.join(__dirname, 'bin/win/OmniPascalServer.exe'), [workspacePath, delphiSDK, searchPath]);
                    }

Is there source code?

It looks like OmniPascal is abandonware. Is there source code out there where someone can try to decipher exactly?

The real question is how to get rid of the modal dialog that blocks using the window.

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
  • 1
    I'm aware there wasn't much publicly visible activity about OmniPascal in the last time but I can promise a new version is about to be released soon. The bug will be fixed in that version. I expect the new version to come within the next week. – Wosi Oct 05 '16 at 08:28

1 Answers1

4

It looks like OmniPascal is abandonware

No it's definetely not abandonware even though there was no new public release within the last months. OmniPascal is still in active development.

The real question is how to get rid of the modal dialog that blocks using the window.

This error message is coming from OmniPascalServer.exe shipped with the OmniPascal plugin for VSCode in (the current) version 0.10.0 released on 2016-04-14.

Workaround for version < 0.11.0

As far as I know this error message only appears when a file is opened in Visual Studio Code instead of a folder. So the simplest workaround is to open the folder which contains the file(s) you want to work with:

  • By command line: Type code C:\Projects\MyProjectRootFolder
  • With the Windows Explorer: Perform a right click on the folder (or a white area inside the folder) and select Open with Code. Do not select a .pas file to open VSCode!
  • From within VSCode: Go to File -> Open Folder...

Or apply the hotfix

  • Open the file C:\Users\USERNAME\.vscode\extensions\Wosi.omnipascal-0.10.0\objectPascalServiceClient.js
  • Replace this line

    var workspacePath = vscode.workspace.rootPath;
    

    with these lines

    var workspacePath = vscode.workspace.rootPath;
    if (typeof workspacePath == 'undefined') {
        var filePath = vscode.workspace.textDocuments[0].fileName;
        workspacePath = path.dirname(filePath);
    } 
    

Now the error should no longer appear.

Wosi
  • 41,986
  • 17
  • 75
  • 82
  • Please let me know if the described workaround doesn't work. – Wosi Oct 05 '16 at 08:57
  • 1
    That does it; thanks! I was using VSCode as my editor to view a file out of source control (it copies the file to a temp location and then launches Code.exe). There does seem to be a separate issue, that OmniPascal doesn't handle a file being viewed (the second Code.exe window opens, but nothing ever appears). I assume its related to the language server not being able to handle being communicated to from separate processes. But, as you said, OP doesn't support being used as a .pas viewer. – Ian Boyd Oct 05 '16 at 15:26
  • Great that it works! *"the second Code.exe window opens, but nothing ever appears"* -> When a second Code.exe is opened then there should spawn a second OmniPascalServer.exe process as soon as a PAS file is opened. When Code.exe doesn't show a file then there is something wrong with VSCode or the way you start it. *"the language server not being able to handle being communicated to from separate processes"* -> Each Code instance has its own OP instance *"OP doesn't support being used as a .pas viewer"* -> Yes it is. At least it should be. Please tell me when you still have issues. – Wosi Oct 05 '16 at 15:35