Home

Awesome

<p align="center"> <br /> <a title="Learn more about Pascal" href="http://github.com/alefragnani/vscode-language-pascal"><img src="https://raw.githubusercontent.com/alefragnani/vscode-language-pascal/master/images/vscode-pascal-logo-readme.png" alt="Pascal Logo" width="70%" /></a> </p>

What's new in Pascal 9.8

Support

Pascal is an open source extension created for Visual Studio Code. While being free and open source, if you find it useful, please consider supporting it

<table align="center" width="60%" border="0"> <tr> <td> <a title="Paypal" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EP57F3B6FXKTU&lc=US&item_name=Alessandro%20Fragnani&item_number=vscode%20extensions&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif"/></a> </td> <td> <a title="GitHub Sponsors" href="https://github.com/sponsors/alefragnani"><img src="https://raw.githubusercontent.com/alefragnani/oss-resources/master/images/button-become-a-sponsor-rounded-small.png"/></a> </td> <td> <a title="Patreon" href="https://www.patreon.com/alefragnani"><img src="https://raw.githubusercontent.com/alefragnani/oss-resources/master/images/button-become-a-patron-rounded-small.png"/></a> </td> </tr> </table>

Pascal

It adds support for the Pascal language and its dialects like Delphi and FreePascal.

Here are some of the features that Pascal provides:

Features

Coding with style

Syntax Highlighting

Pascal supports full syntax highlighting for Delphi and FreePascal

syntax

Snippets

Almost 40 snippets are available

snippets

Format Code

Check out Pascal Formatter documentation.

Code Navigation

Navigate to any language element (methods, attributes, classes, interfaces, and so on) inside Pascal files. It supports native VS Code commands like:

It uses GNU Global, a source code tagging system, which means that it has some limitations if you compare with an AST parsing.

Installing and Configuring GNU Global

  1. You have to install 4 tools:
  1. Update your %PATH% Environment Variable (System)

Let's say you extract GNU Global and CTags in C:\gnu folder. The two new entries in %PATH% should be:

Also make sure Python is in %PATH%

  1. Create 2 new Environment Variables (System)

GNU Global uses CTags + Python Pygments as plugin in order to recognizes Pascal source code, so you have to configure them.

py-envvar

NOTE: For now, it was tested only on Windows, but since these tools are multiplatform (in fact, it comes from Unix), it should work on Linux and Mac.

Available commands

Code Navigation

To enable Code Navigation, the extension depends on GNU Global and Exuberant Tags and for that, you must run gtags on the Root folder, so the tags are created. In order to make life easier, two commands where added:

Available Settings

Controls how the code navigation should work. Specially useful if you work with huge projects

    "pascal.codeNavigation": "workspace"
    "pascal.tags.autoGenerate": true

For huge projects, its recommended to use:

    "pascal.codeNavigation": "file",
    "pascal.tags.autoGenerate": false

Task Build

Use this Task Examples, so you can:

compile

Building Tasks

If you want to build tasks (Task: Run Task Build) you can use the snippets below.

Delphi

Update two tags:

   "version": "2.0.0",
   "tasks": [
      {
         "label": "Pascal",
         "type": "shell",
         "windows": {
            "command": "DCC32.EXE_PATH"
         },
         "linux": {
            "command": "FPC_BIN_PATH"
         },
         "presentation": {
            "reveal": "always",
            "panel": "new"
         },
         "args": [
            {
               "value": ""YOUR_DELPHI_PROJECT.DPR"",
               "quoting": "escape"
            }
         ],
         "problemMatcher": {
            "owner": "external",
            "pattern": {
               "regexp": "^(.*.(pas|dpr|dpk))\\((\\d+)\\)\\s(Fatal|Error|Warning|Hint):(.*)",
               "file": 1,
               "location": 3,
               "message": 5
            }
         },
         "group": {
            "kind": "build",
            "isDefault": true
         }
      }
   ]

FreePascal

Update two tags:


{
   "version": "2.0.0",
   "tasks": [
      {
         "label": "Pascal",
         "type": "shell",
         "windows": {
            "command": "FPC_BIN_PATH"
         },
         "linux": {
            "command": "FPC_BIN_PATH"
         },
         "presentation": {
            "reveal": "always",
            "panel": "new"
         },
         "args": [
            {
               "value": "YOUR_FREEPASCAL_PROJECT_OR_FILE",
               "quoting": "escape"
            }
         ],
         "problemMatcher": {
            "owner": "external",
            "pattern": {
               "regexp": "^([\\w]+\\.(p|pp|pas))\\((\\d+)\\,(\\d+)\\)\\s(Fatal|Error|Warning|Note):(.*)",
               "file": 1,
               "line": 3,
               "column": 4,
               "message": 6
            }
         },
         "group": {
            "kind": "build",
            "isDefault": true
         }
      }
   ]
}

Contributors

Special thanks to the people that have contributed to the project:

Also thanks to everyone who helped opening issues with ideas and bug reports.

License

MIT © Alessandro Fragnani