After quite a long time there’s a new version available. There are two new features helping you to stay focused:
1. Symbol creation suggestions
Type the name of a new variable, field or method and use it would have already been declared. When you’re done place the cursor inside the name. OmniPascal will try to find possible declarations for the new symbol. You only need to pick one from the lightbulb.
2. Automatic uses suggestions
Type the name of the class or function you want to use. If the name can’t be resolved in the current scope a lightbulb pops up offering you to add the corresponding unit automatically. No need to add it manually or perform a global search just to find out where it is declared.
How does it work?
On startup the workspace will be indexed. OmniPascal (partially) will parse all pascal files and create an in-memory-index of all symbols in the global scope. With this index OmniPascal can provide uses suggestions almost instantly. The first run may take longer as it creates a file cache so that future starts are faster. You can choose whether you want to have indexed – the workspace – or the entire search path including system units.
As a side effect of the new symbol index the “Go to Symbol in Workspace”-feature has also been implemented with this release. You can jump to any indexed symbol by just typing its name.
– Automatic declaration of variables, fields and methods – The new setting “omnipascal.symbolIndex” defines the locations to be indexed – Implemented workspace symbol provider (working on the new symbol index) – Automatic uses suggestion – The new setting “omnipascal.usesListStyle” defines how new uses entries are being added to the uses sections (one item per line or multiple items per line) – The new setting “omnipascal.namingConventionString” defines whether the String type is being offered as “String” or “string” in code completion and hints – Code completion on type names offers static accessible symbols only – Improved parser speed – tasks.json generated when loading a project is now version 2.0.0 – Bugfix: Method calls with negative constant literals sometimes resolved to unsigned integer types instead of signed types – Bugfix: Failed to load projects where a property was declared multiple times within the same property group – Bugfix: Generated Lazarus build scripts contain workaround to nothing-to-do-bug
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!
– 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.
– 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
– 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.