maniascript vscode extension update v1.3.2

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

reaby
Posts: 1026
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

maniascript vscode extension update v1.3.2

Post by reaby » 10 Dec 2019, 15:47

Hi,

extension for vscode:
http://reaby.kapsi.fi/trackmania/vscode ... 1.3.2.vsix

Notice: maniaLSP 0.5.0 will work fine with the extension, versions below may have colorization problems.

Setup
The extension can run without setup, but you will have very very old api in that case.

To get use the latest, extract the api from game to somewhere at your harddrive
example:

Code: Select all

trackmania.exe /generatescriptdoc=D:\trackmania\doc.h
(works same with maniaplanet, note the folder needs to exist) and add following lines to your vscode setttings.json (can be accessed from File->Preferences->Settings->Extensions->ManiaScript)
Remember to include the filename as well for doc.h, this is to have more versatile support, incase you wish to name it differently :)

For maniaplanet you should use something like this:

Code: Select all

{
    "maniascript.apidocPath": "D:\\dev\\doc.h",
    "maniascript.useManiaplanetApi": true,
}
For new Trackmania:

Code: Select all

{
    "maniascript.apidocPath": "D:\\trackmania\\doc.h",
    "maniascript.useManiaplanetApi": false,
}
Manialink autocomplete and validation
I finally figured out the most easiest possible way to get autocomplete and validation working for manialink xml.
just install XML extension for vscode and use this template:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-model href="http://reaby.kapsi.fi/trackmania/manialink_v3.xsd" ?>
<manialink version="3">
	<-- your manialink content here -->
</manialink>
Parsing of external libraries
Just add folder to workspace to get libraries load relatively from those directories.
so if you have

Code: Select all

#Include "Mylib/external.Script.Txt" as MyLib

be sure that MyLib is folder inside workspace library.

as of 1.2.17 also external stucts are supported:

Code: Select all

#Struct externalLib::myStruct as structAlias
Auto complete from context
You can set autocomplete namespace root 2 ways:

1. Either having requirecontext at 1st line:

Code: Select all

#RequireContext CMlScriptIngame
2. or having custom context comment block:

Code: Select all

/** @context CMlScriptIngame */
as well as require context with normal comment
// #RequireContext CMlScriptIngame
Template Strings
I added background color change for template strings, so it's easier to spot where templates starts and ends.
As well as templatestrings are considered as xml for color tokenizer. There's as well rule to colorize <script><!-- blocks as well.

Code snipplets
here's a list of prefixes what you can expand with tab-key, most of them are quite obvious:


#Include
#Setting
#Const
#Command
#Struct

declare
for
foreach
switch
if
elif
generate if/else blocks
while

fast access macros:

main generate main function with documentation block
fnc generate function declaration with documentation block
decontrol to fast declare CMlcontrol with Page.GetFirstChild
new generate new instance of struct
PageGet generate (Page.GetFirstChild("controltext") as CMlControl) block
ve2 generate vec2 notation <float,float>
ve3 generate vec3 notation <float, float, float>
in3 generate int3 notation <int,int,int>
Last edited by reaby on 13 Jul 2020, 19:00, edited 27 times in total.

User avatar
magnetik
Nadeo
Nadeo
Posts: 1677
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

Re: maniascript vscode extension update v1.2.12

Post by magnetik » 10 Dec 2019, 16:31

Hey maybe you can create a new "place" on the extension marketplace ? People tends to download the most installed, so in a few time it will not matter that the old one is still there.

It seems awesome :thumbsup:
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!

reaby
Posts: 1026
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: maniascript vscode extension update v1.2.12

Post by reaby » 12 Dec 2019, 01:48

Hi,

@magnetik thinking about that, but for now keeping this simple.

Hi, here's new update!
http://reaby.kapsi.fi/maniaplanet/vscod ... .2.13.vsix

Changelog
Fixed comments to colorize correctly on structs.
Intellisense shows now variable types like this: myquad : CMlQuad
Intellisense now autocompletes hopefully better build-ins example:
CMlQuad::_ <-- will show only enums now (instead of methods and enums)
Added keywords: `metadata` and `in`.
External libraries are now refreshed on every active document change, no
more need to restart ide when working on libraries!

Mickael
Posts: 2
Joined: 31 Oct 2018, 10:38

Re: maniascript vscode extension update v1.2.13

Post by Mickael » 12 Dec 2019, 11:04

Hello,

Thank you for the plugin it is quite nice :thumbsup: , but I think I found a problem with it.
When you are typing curly brackets, visual completes an opening bracket with a closing bracket like usual but when you type 3 curly brackets, the extension spawns 2 extra closing curly brackets ontop of the ones visual made.
It is only the case if you type the curly brackets without a text inside though.

Example:
"{}" => "{{}}" => "{{{}}}}}" (problem)
"{hello}" => "{{hello}}" => "{{{hello}}}" (this works)

reaby
Posts: 1026
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: maniascript vscode extension update v1.2.13

Post by reaby » 12 Dec 2019, 18:28

Mickael wrote:
12 Dec 2019, 11:04
Hello,

Thank you for the plugin it is quite nice :thumbsup: , but I think I found a problem with it.
When you are typing curly brackets, visual completes an opening bracket with a closing bracket like usual but when you type 3 curly brackets, the extension spawns 2 extra closing curly brackets ontop of the ones visual made.
It is only the case if you type the curly brackets without a text inside though.

Example:
"{}" => "{{}}" => "{{{}}}}}" (problem)
"{hello}" => "{{hello}}" => "{{{hello}}}" (this works)
Hi Mikael,

Thanks for noticing this.... and I found the reason for this as well...
Looks like I don't need a rule to autoclose triple brackets. It looks like single bracket rule is enough to do this.
but I don't yet update the extension, let's see if there's other issues or wishes as well, so it's worth doing more fixes at same time.

reaby
Posts: 1026
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: maniascript vscode extension update v1.2.14

Post by reaby » 12 Dec 2019, 21:42

http://reaby.kapsi.fi/maniaplanet/vscod ... .2.14.vsix

1.2.14 Changelog
Fixed braces autoclose
added varible type resolving to foreach, hopefully i didn't break anything...

reaby
Posts: 1026
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: maniascript vscode extension update v1.2.14

Post by reaby » 13 Dec 2019, 01:30

i noticed afterwards it had some problems resolving structs... it's now fixed though. i didn't update version number, so if you already installed the extension just uninstall and reinstall the new version :)

Mickael
Posts: 2
Joined: 31 Oct 2018, 10:38

Re: maniascript vscode extension update v1.2.14

Post by Mickael » 13 Dec 2019, 10:13

No problem :D , I will post it here if I find anything

reaby
Posts: 1026
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: maniascript vscode extension update v1.2.15

Post by reaby » 13 Dec 2019, 10:46

http://reaby.kapsi.fi/maniaplanet/vscod ... .2.15.vsix

Code snipplets
I added alot of code snipplets helpers for version 1.2.15:
here's a list of prefixes what you can expand with tab-key, most of them are quite obvious:

#Include
#Setting
#Const
#Command
#Struct

declare
for
foreach
switch
if
elif
generate if and else blocks
while

fast access macros:

main generate main function with documentation block
fnc generate function declaration with documentation block
decontrol to fast declare CMlcontrol with Page.GetFirstChild
new generate new instance of struct
PageGet generate (Page.GetFirstChild("controltext") as CMlControl) block
ve2 generate vec2 notation <float,float>
ve3 generate vec3 notation <float, float, float>
in3 generate int3 notation <int,int,int>

User avatar
Nerpson
Translator
Translator
Posts: 1551
Joined: 27 Sep 2013, 18:02
Location: France
Contact:

Re: maniascript vscode extension update v1.2.15

Post by Nerpson » 13 Dec 2019, 17:15

Good work! :thumbsup:
Very useful plugin.
ImageImageImageImage

Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 2 guests