AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   [Editor] AMXXPawn for Visual Studio Code (https://forums.alliedmods.net/showthread.php?t=300661)

klippy 08-25-2017 00:04

[Editor] AMXXPawn for Visual Studio Code
 
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:

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.
https://image.prntscr.com/image/unHa...8QmNbx3oCA.png



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


JusTGo 08-25-2017 07:45

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
nice, i have a suggestion can you add an option like "Compile plugin" called "Compile plugin local" so it search amxxpc.exe where the .sma folder.

klippy 08-25-2017 08:11

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
Quote:

Originally Posted by JusTGo (Post 2544247)
nice, i have a suggestion can you add an option like "Compile plugin" called "Compile plugin local" so it search amxxpc.exe where the .sma folder.

Strange thing to request. Would you like it to be a setting, so that when it's set to true it first looks for amxxpc in the input path, or just make it a command?

JusTGo 08-25-2017 08:16

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
a command, its not strange its usefull just one press this command it looks for amxxpc.exe or compile.exe in the opened file folder.

klippy 08-25-2017 09:07

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
I've pushed an update for your request. You can update your extension by going to the Extensions View and clicking the "Update" button on the extension entry.

JusTGo 08-25-2017 09:21

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
if possible also check for include folder ect..., like when you open a sma in amxmodx/scripting/ you get evry thing in that folder.

klippy 08-25-2017 16:00

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
Version 0.2.0 has been published, you can install/update it from the Extensions View, as usual.

Code:

[Version 0.2.0] - 2017-08-25

Added
    - Document symbol lookup (Ctrl+Shift+O) - Easy way to search and navigate to any symbol in the currently opened document
    - Symbol completion - displays suggestions as you type

Fixed
    - Included dependencies are now properly managed, no more data leaks

Completions:
https://image.prntscr.com/image/aG7O...P5Z1YWWuMw.png


Document symbol lookup:
https://image.prntscr.com/image/uN79...MyCUybXbfQ.png

Hedgehog Fog 08-25-2017 17:23

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
Good job. Can you make project directory variable for compiler paths?

klippy 08-25-2017 17:38

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
Quote:

Originally Posted by Hedgehog95 (Post 2544365)
Good job. Can you make project directory variable for compiler paths?

Thanks. I don't think I understand what you mean by that. Could you elaborate please?

Hedgehog Fog 08-26-2017 03:23

Re: [Editor?] AMXXPawn Language Service for Visual Studio Code
 
KliPPy,
I mean support of relative paths or special variable for project directory.

For example:

PHP Code:

amxxpawn.compiler.includePaths: [
    
"${project_dir}/compiler/include"
    "
${project_dir}/src/include"


or

PHP Code:

amxxpawn.compiler.includePaths: [
    
"compiler/include"
    "src/include"


So, if compiler/include directory exists in current project then load include from this directory.


All times are GMT -4. The time now is 05:01.

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