如何将 OmniPascal 安装到 vscode

How do install OmniPascal into vscode

来自OmniPascal page on Visual Studio Marketplace

How to install

  • Install Visual Studio Code and open it.
  • Open View -> Command Palette... and type ext install OmniPascal
  • Restart Visual Studio Code and open File -> Preferences -> User Settings
  • Add the key "objectpascal.delphiInstallationPath" to the right editor and set its value to the Delphi installation path. Don't forget to escape the backslashes! Example:

    "objectpascal.delphiInstallationPath" = "C:\Program Files (x86)\Embarcadero\Studio\16.0",
    

除了这似乎是错误的;它抱怨它不应该是 = (equals),而是 : (冒号):

我认为这是一个打字错误,它应该是一个冒号:

但是路径应该是什么?

页面给出示例路径为:

C:\Program Files (x86)\Embarcadero\Studio\16.0

但是动画安装粘贴在通往子文件夹 source:

的路径中

这是哪个?我之所以问,是因为这两条路径似乎都无法提供建议:

Except that seems to be wrong; it complains that it shouldn't be an = (equals), but a : (colon)

哦,显然文档中有错误。这将在下一个版本中修复。谢谢。 当然它应该是一个冒号,因为它是 JSON 文件中的一个条目。

But what should the path be?

条目objectpascal.delphiInstallationPath 应指向安装Delphi 的路径。是否定义 source 子目录并不重要。该路径在内部用于递归查找 Delphi 单元。由于所有 .pas 文件都位于 source 文件夹中,因此当条目如下所示时,查找会稍微快一些:

"objectpascal.delphiInstallationPath": "C:\Program Files (x86)\Embarcadero\Studio\16.0\Source"

Free Pascal用户应指向FPC目录

样本:

"objectpascal.delphiInstallationPath": "C:\lazarus\fpc"

I only ask because neither path seems to enable suggestions

您屏幕截图中突出显示的语法似乎来自另一个 Pascal plugin for Visual Studio Code。当 OmniPascal 插件在 .pas 文件中处于活动状态时,当前文件类型为 "ObjectPascal"。您会在微笑反馈按钮旁边的右下角看到它:

当当前文件类型为 "Pascal" 或其他任何类型时,错误的插件处于活动状态。单击文件类型并将其更改为 "ObjectPascal"。现在您应该获得代码完成、快速信息等。