AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   [RELEASE | EDITOR] SourcePawn for Visual Studio Code (https://forums.alliedmods.net/showthread.php?t=331017)

Sarrus 03-02-2021 14:28

[RELEASE | EDITOR] SourcePawn for Visual Studio Code
 


Features


Syntax highlighting for .sp and .inc files

Highlight different elements of the SourcePawn syntax.

https://raw.githubusercontent.com/Sa...-example-1.png

Syntax highlighting for .cfg and .txt files

Highlight different elements of the .cfg and .txt file format (for translations files for instance).

https://raw.githubusercontent.com/Sa...-example-2.png

Code auto-completion

Provide suggestions of code completion based on included files and previously declared functions, variables, enums, etc.

https://raw.githubusercontent.com/Sa...-example-1.png

Events auto-completion

Provide suggestions of events name when calling HookEvent and HookEventEx.

https://raw.githubusercontent.com/Sa...-example-2.png

Include's path auto-completion

Provide suggestions of includes path when adding the #include statement.

https://raw.githubusercontent.com/Sa...-example-3.png

Signature help

Provide signature help when calling functions and entering their parameters.

https://raw.githubusercontent.com/Sa...-example-1.png

Hover help

Provide JSDoc like informations when hovering a function, enum, etc.

https://raw.githubusercontent.com/Sa...-example-1.png

Go to definition

Go to the definition of the function, enum, etc, when doing ctrl+click on them. This now supports scopped variables within a function.

https://raw.githubusercontent.com/Sa...-example-1.png

Linter

Provide live debugging informations while coding, based on the compiler's errors. Tips on how to solve the errors are also provided accordingly.

https://raw.githubusercontent.com/Sa...-example-1.png[/u]

Additional features
  • Compile from VSCode with a simple button.
  • Automatically install Sourcemod includes and compiler
  • Custom icons for .sp, .inc and .smx files.
  • Useful snippets.
  • Automatically generate JSDoc like comments by typing /* above a function.
  • Generate a new project automatically.
  • Upload to an FTP/SFTP server on successful compile.
  • Automatically run sm plugins refresh on a successful upload.

To do
  • Incrementally Format Code as the User Types
  • Automatic callback generation.
  • Automatic convert to new syntax (partially).


Credits
  • Dreae's extension which is not supported anymore, and on which this extension is based on.
  • Deathreus' extension which helped me to implement the linting feature.

MarketPlace Download
| Source | Beta builds

Sarrus 03-03-2021 16:08

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 0.1.5

New beta release for testing and suggestions

This version is meant for testing purposes only, I'm planning on making more changes in the coming days.

What was fixed/improved from the last version:
  • Sourcemod parsing on boot is back. You can now use your sourcemod include directory for autocompletion.
  • Added new icons.
  • Added the `#define` snippet.
  • Improved performances and cleaned up the code.

Latest release

Sarrus 03-04-2021 16:13

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 0.1.6

MarketPlace release

This version is meant for testing purposes only, I'm planning on making more changes in the coming days.

What was fixed/improved from the last version:
  • Added support for variables autocompletion.
  • Fixed parsing error for some functions.
  • Added new icons.
  • Improved performances and cleaned up the code.

MarketPlace Download Link

notMe2 03-08-2021 11:41

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Thanks!

Stefanx 03-10-2021 09:04

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Good work!

Sarrus 03-11-2021 16:37

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 0.1.7

Parsing improvements

What was fixed/improved from the last version:
  • Added multiline function parsing.
  • Improved snippets and added new ones.
  • Added support for simple // descriptions above functions.
  • Fixed internal sourcemod functions being parsed.
  • Added beginner friendly include parsing.
  • Fixed descriptions not showing.

MarketPlace Download Link

Sarrus 03-17-2021 16:59

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 1.7.1

HotFix

What was fixed/improved from the last version:
  • Fixed a potential missing dependencies crash.
  • Improved the icons.

MarketPlace Download Link

Sarrus 03-20-2021 18:39

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 0.8.3

New features

What was fixed/improved from the last version:
  • Added multiline function parsing.
  • Added support for for loops variable completion.
  • Added support for enums parsing.
  • Added a command for tasks.json generation from a template.
  • Added a command for .sp file generation from a template.
  • Added a command for README.md file generation from a template.
  • Added a command for github Actions file generation from a template.
  • Added a command to generate a Project from a template.
  • Added a linter based on spcomp.
  • Added a command and a button to compile the current .sp file.
  • Added more settings to support the above features.

https://github.com/Sarrus1/sourcepaw...e.gif?raw=true

MarketPlace Download Link

Sarrus 03-25-2021 10:39

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 1.8.4

Performance improvements and new features

CHANGELOG:
  • Switched to a client-based extension, removing support for LSP.
  • Switched to an iterative parser, instead of a recursive one, thus fixing Call Stack Overflow errors when parsing large files.
  • Added an option to hide the compile button (Suggested by NullifidianSF).
  • Added an option to add additional include folders location (Suggested by Bara).
  • Fixed an error where the compiler would not resolve the path correctly (Fixed by Natanel-Shitrit).

MarketPlace Download Link

Sarrus 03-25-2021 17:29

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 1.9.0

Performance improvements and Go To Definition

CHANGELOG:
  • Added Go-To-Definition for functions and for global variables (in the same file).
  • Added forward parsing.
  • Added better description support.
  • Added better iterative parsing, it is no longer required to save the document for completions to take effect.
  • Improved the overall quality and readability of the code.

MarketPlace Download Link

Sarrus 03-25-2021 19:48

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 1.9.1

HotFix

CHANGELOG:
  • Hotfix for relative includes not working if they are .sp files(Pointed out by Bara).

MarketPlace Download Link

Sarrus 04-01-2021 18:26

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 1.10.0

More features

CHANGELOG:
  • Added Hover description and help for functions.
  • Added a formatter based on clang-format, which the user can (almost) fully customize.
  • Added a setting for specifying the main.sp file in a project with multiple .sp files. Please note that all files have to be saved in order for the linter to work if that setting is configured.
  • Added a way to disable the linter per documents : add //linter=false at the top of the document you want to block (Suggested by Kyle).
  • Fixed nested includes not parsing.
  • Fixed a bug where files would not get parsed properly sometimes.


MarketPlace Download Link

Desktop 04-08-2021 03:17

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
This is REALLY nice for people like me that are not a SR programmer and still didn't find the best IDE to code sourcemod.

Tried to use other extensions but those didn't show a compile button, which is very needed for me as i never scripted anything for VS Code.

Thanks!!

PS: Is in any way possible to open the compiler output folder by clicking somewhere? Since is more practical to me to open the directory from the IDE

Sarrus 04-08-2021 04:35

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Quote:

Originally Posted by Desktop (Post 2743393)
This is REALLY nice for people like me that are not a SR programmer and still didn't find the best IDE to code sourcemod.

Tried to use other extensions but those didn't show a compile button, which is very needed for me as i never scripted anything for VS Code.

Thanks!!

Glad you like it!


Quote:

PS: Is in any way possible to open the compiler output folder by clicking somewhere? Since is more practical to me to open the directory from the IDE
You can right click on the output file and click on "Reveal in explorer" I believe.

Sarrus 04-21-2021 15:14

Re: [VSCODE EXTENSION] Improved version of Dreae's vscode extension
 
Version 1.11.0

Performance improvements and new features

CHANGELOG:
  • Added automatic documentation generation for functions.
  • Added a command to refresh plugins on a Source server.
  • Added a command to upload plugins to an FTP/SFTP server.
  • Added a setting to automatically deploy the plugin to an FTP/SFTP server after a successful compile.
  • Added a setting to automatically refresh the Source server's plugins list after a successful upload.
  • Added basic support for properties autocompletion.
  • Added support for functions without a public/stock/static/native prefix.
  • Added support for enum's member documentation on hover.
  • Fixed wrong name parsing or old syntax functions.
  • Methods will now show their parent Methodmap as detail in the autocompletion prompt.
  • Improved the parsing of already parsed includes.
  • Changed the name of the settings prefix for better consistency.
  • The sourcepawn.MainPath setting can now be relative or absolute.
  • Fixed the linter on Windows.
  • Sub .sp files now inherit from MainPath's completions.

MarketPlace Download Link

Sarrus 06-14-2021 19:02

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Version 1.12.4

This version provides many changes on top of the previous versions. The full changelog can be found here. There will no longer be updates on this blog post.

ebna 06-16-2021 01:48

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
After installing this plugin I created a .sp file and the plugin asked me if I wanted to install SourcMod. I let the plugin install SourceMod but now when I right click on the .sp file and choose "SM Compile File" I get an error saying "SourceMod compiler not found in the project. You need to set the SpcompPath for the Linter to work.". Where is the compiler installed?

Sarrus 06-16-2021 04:34

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Quote:

Originally Posted by ebna (Post 2749902)
After installing this plugin I created a .sp file and the plugin asked me if I wanted to install SourcMod. I let the plugin install SourceMod but now when I right click on the .sp file and choose "SM Compile File" I get an error saying "SourceMod compiler not found in the project. You need to set the SpcompPath for the Linter to work.". Where is the compiler installed?

This was a bug, sorry about that. It has now been fixed. Next time you open VSCode, a new version of the extension should download and you'll be able to install Sourcemod as intended.

P.S: The new version will be live in approx 10mins

ebna 06-17-2021 13:02

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Quote:

Originally Posted by Sarrus (Post 2749921)
This was a bug, sorry about that. It has now been fixed. Next time you open VSCode, a new version of the extension should download and you'll be able to install Sourcemod as intended.

P.S: The new version will be live in approx 10mins

It's working now. Thanks!

xtance 08-16-2021 12:45

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Hello, please help with
"Not a .sp file, aborting"
When trying to compile .sp file

Code:

    "sourcepawn.MainPath": "D:\\Server\\scripting\\",
    "sourcepawn.outputDirectoryPath": "D:\\Server\\scripting\\compiled\\",
    "sourcepawn.SourcemodHome": "D:\\Server\\scripting\\include\\",
    "sourcepawn.SpcompPath": "D:\\Server\\scripting\\spcomp.exe",

UPD:
Turns out I needed to right-click in editor and choose "SM Set current file as main", then it works
But I have a question
Can I compile a file without setting as main?
I have tons of .sp in my /scripting folder, and I used to that setup, since most plugins are one-file anyway

Sarrus 08-21-2021 08:22

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Quote:

Can I compile a file without setting as main?
Yes, there is a setting called MainPathCompilation which turns that one or off.
If set to false, the current .sp file will be compiled, ignoring the MainPath file.

dustinandband 08-23-2021 00:22

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Love this extension; use it exclusively for large multi-file plugins. However...

Some documentation into the options / configuration settings would be helpful. Some examples..

1)
What does "encoding" affect? Why would there be an option for that in the FTP settings?

Code:

Sourcepawn: Source Server Options
Options for the Source server to refresh the plugins on.

"sourcepawn.SourceServerOptions": {
   
        "host": "",
        "port": 27015,
        "encoding": "ascii",
        "timeout": 1000,
        "password": ""
    }

2)

a) If I have my plugins compiled to the desktop, I assume it only syncs the compiled plugin file and not all my desktop files?
b) What are the deleteRemote and forcePasv used for?
c) Why is there a "host", "port", and "password" option in these settings, when the "SourceServerOptions" options had those two settings as well? (I assume it's duplicate info for refreshing plugins / uploading plugins).

Code:

Sourcepawn: Upload Options
Upload options for the FTP/SFTP client.


"sourcepawn.UploadOptions": {
   
        "user": "",
        "password": "",
        "host": "",
        "port": 21,
        "localRoot": "",
        "remoteRoot": "/public_html/remote-folder/",
        "include": [
            "**"
        ],
        "exclude": [
            "scripting/**/",
            ".vscode/**/",
            ".github/**/",
            ".gitignore",
            "*.md",
            ".git"
        ],
        "deleteRemote": false,
        "forcePasv": true,
        "sftp": false
    }

There's some more examples. For instance I had to DM you to figure out that you needed to include "spcomp.exe" in the path extension for this setting:
Code:

Sourcepawn: Spcomp Path
The location of the SourceMod compiler

I'd be willing to help out and clarify anything that seems ambiguous. I love using your extension so I think spending time to properly document all the settings is the way to go.

Sarrus 08-24-2021 12:00

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Thanks you for your interest :D

1) I will be honest, I don't know what the encoding is for in the rcon options. It's used in the node.js package I use, not sure why. Link to the docs.

2)
Here is the doc to the FTP uploader: ftp deploy
a)
It will upload everything in the Desktop yes, except for scripting, .vscode, etc You can change that in the include settings
b)Details in the docs above
c)RCON passwords/hosts and SFTP passwords/hosts are usually not the same, so it's useful to be able to separate the two. This can be redundant if you use the same credentials.


I have started writing some proper documentation, it is available here.

Pawel_SM 12-05-2021 08:02

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Is it possible to add this option which is in SP Code?
https://i.imgur.com/LpAq0lr.png

Sarrus 12-08-2021 15:50

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
Quote:

Originally Posted by Pawel_SM (Post 2765108)
Is it possible to add this option which is in SP Code?
https://i.imgur.com/LpAq0lr.png

Hmm there is already a formatter bundled with the extension, what does this feature do exactly?

xtance 01-14-2022 04:13

Re: [RELEASE | EDITOR] SourcePawn for Visual Studio Code
 
For some reason highlighting works but no autocompletion
It worked in past but not now (IDK why)
Paths set up correctly I guess (plugins are compiling)
Also this on extension page https://i.imgur.com/3Ad0QFn.png
IDK why

UPD: reinstalling windows fixed it
(I did that because of other problems aswell but yes it does fix that, now using ltsc 1809)


All times are GMT -4. The time now is 02:06.

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