SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Tools and Files

Reply
 
Thread Tools Display Modes
Old 30/12/2017, 01:38 PM   #1
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,987
Reputation: 1558
Default Visual Studio Code - Updated Pawn Tools for vscode

vscode-pawn

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 sampctl!

Coming soon:
  • Static Analysis
  • Auto-complete
  • Intellisense support

Installation

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:

Compiling Pawn Code

To actually compile after you’ve set up the tasks.json 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 Run Task, hit enter and select build-normal.

If you use sampctl it’s the same process except you’ll have four options in the Run Task list:
  • build only - build the package
  • build watcher - build the package on every file change
  • run tests - run the package
  • run tests watcher - run the package on every file change

With sampctl package init

If you’re using sampctl, the sampctl package init command will automatically generate a vscode tasks.json if you selected vscode 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 tasks.json from the Pawn Package template repo.

Once you’ve done that, there’s no more setup needed!

Creating tasks.json

Code uses a method called “Tasks” to run compilers and build tools. All you need to do is create a folder named .vscode in your project’s directory and in there, create a file named tasks.json.



Then paste this into that file:

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

Explanation

"command": "${workspaceRoot}/pawno/pawncc.exe", is the important bit here, this is the path to your Pawn compiler and I’ve assumed most of you have a left-over pawno folder from that long dead text editor! This folder not only contains Pawno but also the Pawn code compiler (pawncc.exe). You can safely delete pawno.exe forever.

"args": [...], 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 -;+ to force semicolon usage and -(+ to force brackets in statements.

If you store your Pawn compiler elsewhere, just replace the entire command 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 -d3 from "args".

problemMatcher is the part that allows recognising the Pawn compiler output and presenting it in the problems panel of the editor. This doesn’t work well with external includes because the paths change from relative to absolute. sampctl fortunately fixes this (and a lot of other annoying things).

Features

Currently just syntax highlighting and completions from the Sublime project.

Once the Pawn-Parser 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:

__________________
Tools:

Plugins:

Links:


Last edited by [HLF]Southclaw; 23/04/2018 at 08:20 AM.
[HLF]Southclaw is offline   Reply With Quote
Old 30/12/2017, 01:39 PM   #2
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Location: KS.
Posts: 828
Reputation: 148
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

Nice. I'll give it a try.

EDIT: Looks decent, I'd love to see static analysis, auto-complete, intellisense support added.

Last edited by cuber; 30/12/2017 at 02:12 PM.
cuber is offline   Reply With Quote
Old 30/12/2017, 02:23 PM   #3
Banditul18
Huge Clucker
 
Join Date: Nov 2014
Location: Brasov,Romania
Posts: 340
Reputation: 32
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

I have a problem with this https://imgur.com/706BEhO
The args for me its not working

But good work btw, i was expecting some more good for vscode because the old pawn for vscode was bad. And what theme you are using?
__________________
Banditul18 is offline   Reply With Quote
Old 30/12/2017, 02:34 PM   #4
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Location: KS.
Posts: 828
Reputation: 148
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

Quote:
Originally Posted by Banditul18 View Post
I have a problem with this https://imgur.com/706BEhO
The args for me its not working

But good work btw, i was expecting some more good for vscode because the old pawn for vscode was bad. And what theme you are using?
line 7, paste the folder location of pawno
cuber is offline   Reply With Quote
Old 30/12/2017, 02:44 PM   #5
Banditul18
Huge Clucker
 
Join Date: Nov 2014
Location: Brasov,Romania
Posts: 340
Reputation: 32
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

https://imgur.com/7TPVOSD
https://imgur.com/k751ZTU
Code:
F:\Stuff\gm\pawno
Its in the same folder as the project. I try to add a full path to it and same thing
__________________
Banditul18 is offline   Reply With Quote
Old 30/12/2017, 02:48 PM   #6
DavidGravelli
Huge Clucker
 
DavidGravelli's Avatar
 
Join Date: May 2014
Location: Belgium
Posts: 252
Reputation: 36
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

Error
pawn Code:
ase\0.3.8 RC4-4\pawno\pawncc.exe gamemodes/Houses.pwn -\;+ -\(+
+          
}
DavidGravelli is offline   Reply With Quote
Old 30/12/2017, 02:48 PM   #7
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Location: KS.
Posts: 828
Reputation: 148
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

Quote:
Originally Posted by Banditul18 View Post
https://imgur.com/7TPVOSD
https://imgur.com/k751ZTU
Code:
F:\Stuff\gm\pawno
Its in the same folder as the project. I try to add a full path to it and same thing
pawno\pawncc.exe
cuber is offline   Reply With Quote
Old 30/12/2017, 03:39 PM   #8
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,987
Reputation: 1558
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

Be careful of the fact that backslash \ is an escape character.

I don't have a Windows machine to test on at the moment. But for the time being, if you run into issues, check the vscode tasks.json documentation for windows-specific things.

It could be the args escape characters for ( and ; so try messing with that.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 30/12/2017, 05:03 PM   #9
Banditul18
Huge Clucker
 
Join Date: Nov 2014
Location: Brasov,Romania
Posts: 340
Reputation: 32
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

Well i try to make those args in al the ways i was able to think and the only way its work to compile its to delete them and put them in pawn.cfg file inside pawno folder
Code:
-;+  -v2 -d3 -Z+ -\\)+
Another way i don't figure out
__________________
Banditul18 is offline   Reply With Quote
Old 30/12/2017, 05:23 PM   #10
rfr
Banned
 
Join Date: Nov 2017
Posts: 278
Reputation: 43
Default Re: Visual Studio Code - Updated Pawn Tools for vscode

very cool
rfr is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] PAWN Syntax and Compiler for Visual Studio Code FreAkeD Tutorials 68 12/08/2018 07:21 AM
[Tutorial] Visual Studio Code Compiler Casttiel Lançamentos/Releases 7 17/08/2017 09:18 AM
Can someone make Pawn compiler for Visual Studio Code? DuyDang2412 Scripting Help 11 26/07/2017 12:21 PM
[Tutorial] Visual Studio like an compilator PAWN language Dystans Tutorials 9 17/02/2013 07:43 AM
Visual Studio as the development environment for PAWN Arca Scripting Help 7 28/07/2012 09:18 PM


All times are GMT. The time now is 02:07 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.