Language Definition - joelday/papyrus-lang GitHub Wiki
The Papyrus language definition includes syntax highlighting, bracket matching, and snippet insertions.
Syntax highlighting will colorize source code symbols such as types, operators, literals, functions, events, comments, and other Papyrus language constructs.
The Papyrus syntax highlighting supports VS Code Color Themes. A color theme lets you modify the colors in Visual Studio Code's user interface to suit your preferences and work environment.
With bracket matching, bracket pairs will be highlighted as soon as the cursor is near one of them. The bracket completion will automatically insert closing symbols for appropriate language constructs.
Tip: You can jump to the matching bracket with
Ctrl+Shift+\
The extension will suggest a variety of snippets for common boiler-plate and Papyrus language keywords. This greatly increases a developers speed and productivity. To get started with snippets simply start typing its name.
The following snippets are provided.
Inserts a script header line.
-
scriptname: The file name of this script. -
ScriptObject: The extending script.
Scriptname <scriptname> extends <ScriptObject>
{The documentation string.}
; codeInserts a script header line with Namespace. Only supported by Fallout 4.
-
namespace: The Namespace to use. -
scriptname: The file name of this script. -
ScriptObject: The extending script.
Scriptname <namespace>:<scriptname> extends <ScriptObject>
{The documentation string.}
; codeInserts an import statement.
-
scriptname: The script or namespace to import.
import <scriptname>Inserts a comment region into the script. This might be used to separate regions of code.
-
Region: The region label to use.
; <Region>
;---------------------------------------------Inserts a function into the script.
Function Foo()
; code
EndFunctionInserts a getter function into the script.
var Function GetFoo()
var value = "type"
; code
return value
EndFunctionInserts a setter function into the script.
Function SetFoo(var argument)
; code
EndFunctionInserts a full function into the script.
var Function Foobar(var argument)
; code
return none
EndFunctionInserts an if statement into the script.
If ()
EndIfInserts a while statement into the script.
While ()
EndWhileInserts a "for loop" into the script.
int index = 0
While (index < size)
; code
index += 1
EndWhileInserts a "for each in loop" into the script.
int index = 0
While (index < array.Length)
type item = array[index]
type
index += 1
EndWhileInserts a state into the script.
State state
EndStateInserts an auto state into the script.
Auto State state
EndStateInserts a structure into the script. Structures are only supported in Fallout 4.
Struct StructureName
type Value
EndStructInserts an auto property into the script.
The Mandatory is only supported in Fallout 4.
type Property PropertyName Auto Const MandatoryInserts a full property into the script.
type PropertyName_var
type Property PropertyName Hidden
type Function Get()
return PropertyName_var
EndFunction
Function Set(type value)
PropertyName_var = aValue
EndFunction
EndPropertyInserts a group into the script. Groups are only supported in Fallout 4.
Group GroupName
EndGroupInserts a collapsed group into the script. Groups are only supported in Fallout 4.
Group GroupName Collapsed
EndGroup