1

I followed the instructions on http://www.omnipascal.com/:

Install Visual Studio Code and open it.
Open View Command Palette... and type ext install
Search for OmniPascal and install it.
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!
Perform a right click on the root folder of a Delphi project and select Open with Code

Extension Settings are:

Omnipascal: Create Build Scripts -> checked
Omnipascal: Default Development Environment -> Delphi
Omnipascal: Delphi Installation Path -> C:\\Program Files (x86)\\Embarcadero\\Studio\\18.0

Right click on the root folder of a Delphi project will open the project-files in vscode.

Run without debugging will promt me to :
select environment with the only option node.js. Extension OmniPascal ist enabled, but does nothing.

What am I missing?

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • As a matter of curiousity, do you have a particular reason for wanting to use OmniPascal rather than FreePascal+Lazarus? – MartynA Feb 21 '20 at 11:52
  • @MartynA With FreePascal + Lazarus you cannot use Delphi code... (not 100% anyway) Since Delphi IDE chokes on every language feature introduced since 2010, VSCode + OmniPascal can serve as temporary IDE replacement. – Dalija Prasnikar Feb 21 '20 at 12:09
  • @MartynA Good question. My boss asked for this. He wants some external javascript-programmers, who use vscode, start with freepascal / delphi without changing their environment. He wants to spare them the need to make aquaintance of a new IDE, and by this achieving greater acceptance learning a new language. I too really don't know what the benefits of coding in vscode are vs coding in Lazarus or Delphi. But the boss asked for this. – Stefan Nolte Feb 21 '20 at 12:18
  • @Dalija Prasnikar In vscode you switch between delphi and fpc compiler. Most code will compile not on both. It is possible to open code in both Lazarus and Delphi and check whether it compiles. I still do not see much benefit from using vscode. – Stefan Nolte Feb 21 '20 at 12:39
  • @DalijaPrasnikar: Actually, I've had no trouble converting a Delphi VCL db application (with minimal changes) to run on a Raspberry Pi Although I've always been a Delphi fan, if I were starting a major project now, I would do it in FP on Lazarus, just from concerns about it being more future-proof. – MartynA Feb 21 '20 at 12:40
  • @MartynA Like I said, it is not about converting... I don't have anything against FreePascal + Lazarus, but as long as Delphi is here it will suit my needs better. As for future proof, nothing is future proof... – Dalija Prasnikar Feb 21 '20 at 12:47
  • @DalijaPrasnikar: There are degrees of future-proof. Imo, basing a project on an IDE that can't even be moved to a new machine without the IDE provider still being in business to activate it is an avoidable risk when there is an open-source alternative. Ymmv. – MartynA Feb 21 '20 at 12:57
  • @MartynA I have no problem there, still being on Delphi7 – penarthur66 Feb 21 '20 at 12:59
  • @penarthur66 Indeed. I could certainly get by if I had to with D7, except for the lack of built-in Unicode support. Not many of the later additions, like extended RTTI and especially generics, seem to me to be worth the trouble – MartynA Feb 21 '20 at 17:15

1 Answers1

0

In Extension Settings

Omnipascal: Msbuild Path set to for eg C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild and check if this setting is found in the CompileOmniPascalServerProject.bat of your project .vscode folder. Then open your project-file, right-click in the editor -> choose Command Palette and then Tasks: run Test Task
This worked.

  • Just a note - this did not work for me at first. Then I found out that I needed to make sure I selected the 32-bit version of MSBuild instead of the 64-bit version. Then it worked. – dallin Oct 26 '22 at 23:47