UPDATE
You can still use this extension if you wish but there's much much much newer avaible now at
vscode marketplace: search Maniascript-Support by reaby.
The updated one has all the features here + some cool new ones. Checkit out!
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
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,
}
Code: Select all
{
"maniascript.apidocPath": "D:\\trackmania\\doc.h",
"maniascript.useManiaplanetApi": false,
}
I finally figured out the most easiest possible way to get autocomplete and validation working for manialink xml.
I recently have opened as well a github repository for holding and updating the manialink xsd.
You can find it here https://github.com/reaby/manialink-xsd
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="https://raw.githubusercontent.com/reaby/manialink-xsd/main/manialink_v3.xsd" ?>
<manialink version="3">
<-- your manialink content here -->
</manialink>
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
You can set autocomplete namespace root 2 ways:
1. Either having requirecontext at 1st line:
Code: Select all
#RequireContext CMlScriptIngame
Code: Select all
/** @context CMlScriptIngame */
as well as require context with normal comment
// #RequireContext CMlScriptIngame
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>