-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathREADME.bbcode
102 lines (68 loc) · 5.3 KB
/
README.bbcode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
[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]