AMXXPawn Language Service for VSCode
An extension for Visual Studio Code that adds support for the AMXXPawn language.
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:
Visual Studio Code
- 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:
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 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.
Contributions are welcome.
Also, if you have any ideas/suggestions/critiques, please post in this topic.
- 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)
- #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