• Stars
    star
    189
  • Rank 204,649 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pascal language extension for Visual Studio Code


Pascal Logo

What's new in Pascal 9.6

  • Adds Web support
  • Adds Getting Started / Walkthrough
  • Adds Virtual Workspaces support
  • Adds Workspace Trust support

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

Pascal

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

Here are some of the features that Pascal provides:

  • Syntax highlighting for files, forms and projects
  • A huge set of Snippets
  • Source code navigation

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:

  • Go to Symbol
  • Go to Definition
  • Peek Definition
  • Find All References

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:

  • GNU Global: C:\gnu\glo653wb\bin
  • Excuberant Tags: C:\gnu\ctags58\ctags58

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.

  • GTAGSCONF: C:\gnu\glo653wb\share\gtags\gtags.conf
  • GTAGSLABEL: pygments

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:

  • Pascal: Generate Tags: Use this to create or reset the tags in the current project. You just have to do it once.
  • Pascal: Update Tags: Use this to update the tags for current project. You should use this command to update the references when any source code is updated.

Available Settings

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

  • workspace: Full featured code navigation
  • file: Limited to Go to Symbol in File command
    "pascal.codeNavigation": "workspace"
  • Controls if the extension should automatically generate tags in projects opened for the first time
    "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 Delphi and FreePascal projects:
  • Navigate to Errors/Warnings/Hints, using the native View / Errors and Warnings command

compile

Building Tasks

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

Delphi

Update two tags:

  • DCC32.EXE_PATH: The compiler location
  • YOUR_DELPHI_PROJECT.DPR: The project being built.
   "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:

  • FPC_BIN_PATH: The full compiler location. If its PATH is already in Environment Variables, simply use FPC_BIN filename
  • YOUR_FREEPASCAL_PROJECT_OR_FILE: The project/file being built.

{
   "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
         }
      }
   ]
}

License

MIT © Alessandro Fragnani

More Repositories

1

vscode-project-manager

Project Manager Extension for Visual Studio Code
TypeScript
1,718
star
2

vscode-bookmarks

Bookmarks Extension for Visual Studio Code
TypeScript
1,482
star
3

vscode-numbered-bookmarks

Numbered Bookmarks Extension for Visual Studio Code
TypeScript
132
star
4

delphi-james

James - The Delphi Project Manager
Pascal
48
star
5

vscode-separators

Separators Extension for Visual Studio Code
TypeScript
28
star
6

vscode-whats-new

VS Code submodule for a What's New page
TypeScript
27
star
7

vscode-jenkins-status

Jenkins Status Extension for Visual Studio Code
TypeScript
27
star
8

vscode-pascal-formatter

Pascal formatter extension for Visual Studio Code
TypeScript
26
star
9

atom-language-pascal

Pascal language support in Atom
26
star
10

vscode-read-only-indicator

Read-Only Indicator Extension for Visual Studio Code
TypeScript
25
star
11

vscode-delphi-pack

Delphi Extension Pack for Visual Studio Code
23
star
12

vscode-language-rtf

RTF Language Extension for Visual Studio Code
TypeScript
23
star
13

delphi-generator-delphi

Yeoman generator for Delphi projects
JavaScript
13
star
14

delphi-code-templates

Code Templates for Delphi
12
star
15

vscode-settings

My personal Visual Studio Code settings
11
star
16

vscode-copy-word

Copy Word Extension for Visual Studio Code
TypeScript
10
star
17

vscode-delphi-keybindings

Delphi Keybindings for Visual Studio Code
TypeScript
9
star
18

vscode-delphi-themes

Delphi Themes for Visual Studio Code
8
star
19

vscode-tagged-comment

Tagged Comment Extension for Visual Studio Code
TypeScript
7
star
20

atom-useful-context-menu

A set of useful context menu actions for Atom
CoffeeScript
7
star
21

delphi-samples

A collection of delphi samples
Pascal
5
star
22

Sublime-Ant-Buildfile

A Sublime Text build system for running ANT for the active XML file, even if it is not named build.xml
3
star
23

delphi-dite-vscode-theme

Visual Studio Code theme for DITE
3
star
24

atom-tagged-comment

An easy way to add personalized comments to your code
CoffeeScript
2
star
25

vscode-ext-help-and-feedback-view

NPM Package which provides a Help and Feedback View for VS Code extensions
TypeScript
2
star
26

atom-code-dark-syntax

A dark syntax theme based on Visual Studio Code, with some tweaks
Less
2
star
27

vscode-ext-codicons

NPM Package with helper functions to work with "codicons" while developing VS Code extensions
TypeScript
2
star
28

vscode-test-web-workspace

VS Code web-ready extension sample
TypeScript
1
star
29

toggle-delphi-file

Sublime plugin to toggle between Delphi files
Python
1
star
30

atom-read-only-indicator

Adds and indicator to the status bar showing if a file is read-only or writeable
CoffeeScript
1
star
31

vscode-try-extensions-on-codespaces

Try VS Code extensions on Codespaces
Pascal
1
star
32

delphi-squad-demo

Exemplo usado na apresentação do Delphi Squad Floripa
Pascal
1
star
33

delphi-dunit-agiledoxtestrunner

Agiledox output format
Pascal
1
star
34

atom-settings

My personal Atom settings
CSS
1
star