Raised This Month: $12 Target: $400
 3% 

[Editor] AMXXPawn for Visual Studio Code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-25-2017 , 00:04   [Editor] AMXXPawn for Visual Studio Code
Reply With Quote #1

AMXXPawn Language Service for VSCode


An extension for Visual Studio Code that adds support for the AMXXPawn language.


Features

Right now this is pretty much an early preview/beta version with features lacking, and some features even not working properly. Even though it's unfinished, I've posted this solely to get feedback. I encourage you to post in this topic and help me improve this extension.

However, here is a basic preview of currently implemented features:
  • Syntax highlight.

  • Checks if included files are valid, provides links to the AMXX Web API reference:


  • Allows you to 'Go to Definition' and open the included file in a new editor tab, or to 'Peek Definition', which opens an 'inline' view (called Code Lens) of the included file:


  • Provides function signature help as a pop-up when you start typing a function call:


  • Symbol suggestions as you type:


  • Document symbol lookup (Ctrl+Shift+O) - easy way to navigate to any symbol that's been defined in the currently open file:


  • Has compiler support - you can compile your plugin by running the 'AMXXPawn: Compile Plugin' command from the command palette (Ctrl+Shift+P by default) or by going to Keyboard Shortcuts page (which is really intuitive in VSCode by the way) and binding it to a key combination:




    However, to use the compiler you have to configure you environment first through the Settings page in VSCode:

    An example:


Visual Studio Code

In case you haven't heart of Visual Studio Code (VSCode) yet - it's an open-source multiplatform text/code editor developed and maintained by Microsoft. It's entirely written in TypeScript using Electron framework. It has many great built-in features like Git integration and Debugging support, but also has support for extensions (just like this one), of which there are many.
VSCode has been my go-to editor for many other languages (especially for Node.js development) for a while now, but it never had proper Pawn support. This extension aims at improving Pawn language support in VSCode.

Official site & Downloads


Installation Instructions

Installation is pretty straightforward, thanks to VSCode's great support for extensions.
All you have to do is to open the Extensions View (by using the bar on the left hand side or pressing Ctrl+Shift+X), search for "amxxpawn" and click the "Install" button, then reload VSCode.
Make sure to install the one with my name as there are two registered amxxpawn extensions.




Source Code
Change Log

Contributions are welcome.
Also, if you have any ideas/suggestions/critiques, please post in this topic.

TODO:
Code:
- Properly parse and resolve #include directives.
    - Right now only #include <filename> format is supported
    - #include "filename" and #include filename should look in the current directory and the list of include directories.
    - #include <filename> should only look in the list of include directories.

- Handle #tryinclude

- Properly handle block comments and scopes (brackets) when parsing files, some edge cases may break the parser

- In addition to functions, parse:
    - Global variables/constants (not completely done)
    - Enumerations
    - #define directives

- Add Go to Definition/Peek Definition for symbols

- Parse doc-comments and display them together with completions and signature help

- Handle dependency timestamps - if a dependency has changed, reparse it

- (maybe) Add basic IntelliSense implementation (requires a new parser):
    - Detect tag mismatches
    - Detect unreachable code
    - Wrong syntax

- (maybe) Make function parameters tag-aware and suggest only (or prioritize) symbols that have the same tag
- (maybe) Make array element access enum-aware and sugest only (or prioritize) members of the same enum

- (maybe) Make the parser scope aware and parse symbols in scopes too so completions can suggest local variables and parameters

Last edited by klippy; 08-29-2017 at 17:31.
klippy is offline
 


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

Forum Jump


All times are GMT -4. The time now is 15:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode