https://github.com/southclaws/vscode-pawn
Pawn tools for vscode, powered by sampctl.
https://github.com/southclaws/vscode-pawn
pawn pawn-compiler vscode-extension vscode-language vscode-pawn vscode-plugin vscode-snippets
Last synced: 2 months ago
JSON representation
Pawn tools for vscode, powered by sampctl.
- Host: GitHub
- URL: https://github.com/southclaws/vscode-pawn
- Owner: Southclaws
- Created: 2017-12-29T15:52:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-15T18:01:14.000Z (over 2 years ago)
- Last Synced: 2025-03-29T16:51:13.552Z (3 months ago)
- Topics: pawn, pawn-compiler, vscode-extension, vscode-language, vscode-pawn, vscode-plugin, vscode-snippets
- Language: TypeScript
- Size: 244 KB
- Stars: 49
- Watchers: 6
- Forks: 16
- Open Issues: 11
-
Metadata Files:
- Readme: README.bbcode
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[COLOR="#FF4700"][SIZE="7"][B]vscode-pawn[/B][/SIZE][/COLOR]
Pawn tools for vscode.
Currently this is a port of the Sublime Text package which includes proper Pawn syntax highlighting, autocompletions for the standard library and some popular libraries.
If you like development tools that speed up your workflow and increase productivity, check out [b][URL="http://bit.ly/sampctl-thread"]sampctl[/URL][/b]!
Coming soon:
[LIST]
[*]Static Analysis
[*]Auto-complete
[*]Intellisense support
[/LIST][COLOR="RoyalBlue"][SIZE="6"][B]Installation[/B][/SIZE][/COLOR]
Just search for “Pawn Tools” in the vscode extensions and install it.
Alternatively, you can check out the source code or view the marketplace page:
[LIST]
[*][URL="https://github.com/Southclaws/vscode-pawn"]GitHub Page[/URL]
[*][URL="https://marketplace.visualstudio.com/items?itemName=southclaws.vscode-pawn"]Marketplace Page[/URL]
[/LIST][COLOR="RoyalBlue"][SIZE="6"][B]Compiling Pawn Code[/B][/SIZE][/COLOR]
To actually compile after you’ve set up the [FONT="courier new"]tasks.json[/FONT] below, press CTRL+Shift+B (Windows) or CMD+Shift+B (Mac), or alternatively open up the command palette with CTRL+Shift+P (Windows) or CMD+Shift+P (Mac) and type [FONT="courier new"]Run Task[/FONT], hit enter and select [FONT="courier new"]build-normal[/FONT].
If you use [URL="http://bit.ly/sampctl"]sampctl[/URL] it’s the same process except you’ll have four options in the [FONT="courier new"]Run Task[/FONT] list:
[LIST]
[*][FONT="courier new"]build only[/FONT] - build the package
[*][FONT="courier new"]build watcher[/FONT] - build the package on every file change
[*][FONT="courier new"]run tests[/FONT] - run the package
[*][FONT="courier new"]run tests watcher[/FONT] - run the package on every file change
[/LIST][COLOR="DeepSkyBlue"][SIZE="5"][B]With [FONT="courier new"]sampctl package init[/FONT][/B][/SIZE][/COLOR]
If you’re using sampctl, the [FONT="courier new"]sampctl package init[/FONT] command will automatically generate a vscode [FONT="courier new"]tasks.json[/FONT] if you selected [FONT="courier new"]vscode[/FONT] in the editor part of the setup menu.
If you’ve already got a package but you didn’t do this, you can simply download the [FONT="courier new"]tasks.json[/FONT] from the [URL="https://github.com/Southclaws/pawn-package-template/blob/master/.vscode/tasks.json"]Pawn Package template repo[/URL].
Once you’ve done that, there’s no more setup needed!
[COLOR="DeepSkyBlue"][SIZE="5"][B]Creating [FONT="courier new"]tasks.json[/FONT][/B][/SIZE][/COLOR]
Code uses a method called “Tasks” to run compilers and build tools. All you need to do is create a folder named [FONT="courier new"].vscode[/FONT] in your project’s directory and in there, create a file named [FONT="courier new"]tasks.json[/FONT].
[IMG]https://i.imgur.com/ywElfTy.gif[/IMG]
Then paste this into that file:
[PHP]
{
"version": "2.0.0",
"tasks": [
{
"label": "build-normal",
"type": "shell",
"command": "${workspaceRoot}/pawno/pawncc.exe",
"args": ["${file}", "-Dgamemodes", "-;+", "-(+", "-d3"],
"group": {
"kind": "build",
"isDefault": true
},
"isBackground": false,
"presentation": {
"reveal": "silent",
"panel": "dedicated"
},
"problemMatcher": "$pawncc"
}
]
}
[/PHP][COLOR="SlateGray"][SIZE="5"]Explanation[/SIZE][/COLOR]
[FONT="courier new"]"command": "${workspaceRoot}/pawno/pawncc.exe",[/FONT] is the important bit here, this is the path to your Pawn compiler and I’ve assumed most of you have a left-over [FONT="courier new"]pawno[/FONT] folder from that long dead text editor! This folder not only contains Pawno but also the Pawn code compiler ([FONT="courier new"]pawncc.exe[/FONT]). You can safely delete [FONT="courier new"]pawno.exe[/FONT] forever.
[FONT="courier new"]"args": [...],[/FONT] is also important, this is where you define the arguments passed to the compiler. Pawno also did this but you might not have known. The defaults have always been [FONT="courier new"]-;+[/FONT] to force semicolon usage and [FONT="courier new"]-(+[/FONT] to force brackets in statements.
If you store your Pawn compiler elsewhere, just replace the entire [FONT="courier new"]command[/FONT] setting with the full path to your compiler.
Also, if you want to disable debug symbols (you won’t be able to use crashdetect) just remove [FONT="courier new"]-d3[/FONT] from [FONT="courier new"]"args"[/FONT].
[FONT="courier new"]problemMatcher[/FONT] is the part that allows recognising the Pawn compiler output and presenting it in the [FONT="courier new"]problems[/FONT] panel of the editor. This doesn’t work well with external includes because the paths change from relative to absolute. [URL="http://bit.ly/sampctl-thread"]sampctl[/URL] fortunately fixes this (and a lot of other annoying things).
[COLOR="RoyalBlue"][SIZE="6"][B]Features[/B][/SIZE][/COLOR]
Currently just syntax highlighting and completions from the Sublime project.
Once the [URL="https://github.com/Southclaws/pawn-parser"]Pawn-Parser[/URL] project reaches a workable state, this extension will feature more language features such as intellisense support, go-to-definition, view-all-references, etc…
Here’s what the problems panel looks like when the tasks.json is set up properly:
[IMG]https://i.imgur.com/k8ST5pih.png[/IMG]