OmniPascal 0.13.0 – Load project, compile and run

Load a project, compile and run

Introducing automatic build script generation

You are now able to load a project file in Visual Studio Code. You can either click the new OmniPascal project indicator in the status bar or execute the new command OmniPascal: Load project. Pick a .dpr, .dpk, .lpr or .lpk file to open it. When it’s done you will see the currently loaded project file in the status bar.

The search path will be adjusted automatically when you open a project file.
If the new setting omnipascal.createBuildScripts is set to true (it’s false by default) then a tasks.json file and a .bat file will be generated as soon as a project is loaded or the currently loaded project file changes. The generated tasks.json defines both a build task and a test task. The build task will simply compile the loaded project while the test task will start the compiled application with the run parameters defined in the .dproj or .lpi file. If there is no .dproj or .lpi file for the project then OmniPascal won’t create a build script. So there are no auto generated build scripts for old Delphi projects.

The generated build scripts rely on MSBuild for Delphi projects and LazBuild for Lazarus projects. OmniPascal needs to know the location of these applications in order to work properly.
The path to MSBuild is defined in the setting omnipascal.msbuildPath. If no path is defined OmniPascal will try to find the path by itself.
The path to LazBuild is be defined in omnipascal.lazbuildPath.

Changes in the OmniPascal settings are not reflected on the fly. You need to restart Visual Studio Code or execute the command Reload Window when you change settings!

IMPORTANT CHANGES
– The settings namespace used for OmniPascal is no longer objectpascal but it’s omnipascal. You need to change the settings in Visual Studio Code. For example: The setting objectpascal.delphiInstallationPath has to be changed to omnipascal.delphiInstallationPath.
– The path to the FreePascal source files is no longer stored in objectpascal.delphiInstallationPath. It’s now stored in omnipascal.freePascalSourcePath.
– FreePascal users need to set omnipascal.defaultDevelopmentEnvironment to FreePascal. The default value is Delphi.

Change log

Features
– Ability to load a project file
– Automatically adjust search path when opening a project file (loaded from .dproj and .lpi files)
– Automatic creation of tasks.json and a build script when loading a project that has a corresponding .dproj or .lpi file
– If DelphiInstallationPath is not defined in the settings then OmniPascal looks for the most recent Delphi installation path itself

Bugfixes
– Fixed visibility of symbols defined in System.pas
– Aliases of full qualified types are now handled properly
– Fixed possible stack overflow when working with a generic class defined in the implementation section
– Fixed random crashes
– Parameterless calls to WriteLn, Write, ReadLn and Read can now be resolved
– Outlining in files with syntax errors works better
– Hints for constants of empty strings are now correct
– Implementations of overloaded methods could not be found when an alias for a parameter type is used in the implementation while the declaration uses the original type name
– Fixed internal error when code completion was requested for objects of a type that could not be resolved
– Fixed broken syntax highlighting for Self, Result and some keywords.

10 Comments

  • Bascy

    February 28, 2017

    Sounds like a fanatastic extension of this extension …
    But when I try it, this is the result:

    Running the contributed command:’omnipascal.loadProject’ failed.

    Reply
    • Wosi

      Wosi

      February 28, 2017

      That’s not good. It works fine on multiple machines. Does it help when you uninstall and reinstall the extension? What kind of porject file do you open? Delphi XE or higher? Lazarus?

      Reply
    • Wosi

      Wosi

      February 28, 2017

      Does this error still occur when you have a .pas file open in the editor while attempting to load a project?

      Reply
      • Bascy

        February 28, 2017

        I tried uninstalling and installing, that didnt help.

        I get an error “Command ‘omnipascal.LoadProject’ not found when I start the command from an empty editor, running the command from the Ctrl-Shift-P line.

        I’ll do some more testing this evening

        Reply
        • Wosi

          Wosi

          February 28, 2017

          VScode extensions are not properly initialized when there is no file open. I guess everything will work fine when you open a DPR or PAS file before you try to open a project.

          Reply
  • Bascy

    February 28, 2017

    Another small problem ….
    The compile batch file is calling rsvars.bat without any path. This doesnt work good if Embarcadero is not on the path or you have multiple versions installed. I think the rsvars call should be preceeded by the delphi installation path setting

    Reply
  • Bascy

    February 28, 2017

    a third suggestion ….
    The default build configuration of Rad studio is “Release” and not “Make”

    Is there a way to alter the template from which the compile script is fabricated? That would allow anyone to tailor it ot there own configurations and needs

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *