VS Code User Snippets for mSL


#1

This is my personal snippets I use in VSCode for coding in any mrc file:

{
	// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and 
	// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope 
	// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is 
	// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: 
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. 
	// Placeholders with the same ids are connected.
	// Example:
	// "Print to console": {
	// 	"scope": "javascript,typescript",
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"mSL Event Documentation": {
		"scope": "mrc",
		"prefix": "mslevent",
		"body": [
			"/**",
			"*",
			"* ${2:Description...}",
			"*",
			"* @event ${1:event}",
			"*",
			"*/",
			"on *:${1:event}:$0 {",
			"  ",
			"}"
		],
		"description": "Simple mSL event documentation comment."
	},
	"mSL Command Documentation": {
		"scope": "mrc",
		"prefix": "mslcmd",
		"body": [
			"/**",
			"*",
			"* ${2:Description...}",
			"*",
			"* @command /${1:myCommand}",
			"*",
			"* @switch ${3:a} ${4:description...}",
			"*",
			"* @param <${5:somParam}> ${6:description...}",
			"*",
			"* ${7:@global}",
			"*",
			"*/",
			"alias ${8:-l} ${1:myCommand} {",
			"  if (!\\$isid) {",
			"    $0",
			"  }",
			"  else {",
			"    echo \\$color(info) -es * ${1:myCommand}: is not an identifier",
			"    halt",
			"  }",
			"}"
		],
		"description": "Simple mSL command documentation comment."
	},
	"mSL Identifier Documentation": {
		"scope": "mrc",
		"prefix": "mslid",
		"body": [
			"/**",
			"*",
			"* ${2:Description...}",
			"*",
			"* @identifier \\$${1:myIdentifier}",
			"*",
			"* @param <${3:somParam}> ${4:description...}",
			"*",
			"* @prop ${5:name} ${6:description...}",
			"*",
			"* ${7:@global}",
			"*",
			"*/",
			"alias ${8:-l} ${1:myIdentifier} {",
			"  if (\\$isid) {",
			"    return $0",
			"  }",
			"  else {",
			"    echo \\$color(info) -es * ${1:myIdentifier}: is not a command",
			"    halt",
			"  }",
			"}"
		],
		"description": "Simple mSL identifier documentation comment."
	},
	"mSL Alias Documentation": {
		"scope": "mrc",
		"prefix": "mslalias",
		"body": [
			"/**",
			"*",
			"* ${2:Command description...}",
			"*",
			"* @command /${1:myCommand}",
			"*",
			"* @switch ${3:a} ${4:description...}",
			"*",
			"* @param <${5:somParam}> ${6:description...}",
			"*",
			"* ${12:@global}",
			"*/",
			"/**",
			"*",
			"* ${7:Identifier description...}",
			"*",
			"* @identifier \\$${1:myIdentifier}",
			"*",
			"* @param <${8:somParam}> ${9:description...}",
			"*",
			"* @prop ${10:name} ${11:description...}",
			"*",
			"* ${12:@global}",
			"*",
			"*/",
			"alias ${13:-l} ${1:myAlias} {",
			"  if (!\\$isid) {",
			"    ; command",
			"    $0",
			"  }",
			"  else {",
			"    ; identifier",
			"    ",
			"  }",
			"}"
		],
		"description": "Simple mSL alias documentation comment."
	}
}

To add it you may go to File>Preferences>User Snippets>New Global Snippets File
Create your file copy and paste.

This follows the Simple Documentation format (as of writting this, will update if the project changes). To use it you simply type mslevent, mslcmd, mslid, or mslalias. and it will generate a skeleton for an event, command, identifier, or a general alias with a multi-line comment following the Simple Documentation format.

Hope someone finds this useful.