Ordner nicht angegeben with OmniPascal in VSCode

2019-04-08 03:41发布

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.

标签: omnipascal
1条回答
Anthone
2楼-- · 2019-04-08 03:57

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.

查看更多
登录 后发表回答