-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...src/main/kotlin/com/jetbrains/rider/plugins/godot/textMate/GdScriptTemplateContextType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.jetbrains.rider.plugins.godot.textMate | ||
|
||
import com.intellij.codeInsight.template.TemplateActionContext | ||
import com.intellij.codeInsight.template.TemplateContextType | ||
|
||
class GdScriptTemplateContextType : TemplateContextType("GdScript") { | ||
|
||
override fun isInContext(context: TemplateActionContext): Boolean = | ||
context.editor?.virtualFile?.extension.equals("gd", true); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<templateSet group="GDScript"> | ||
|
||
<template name="for" value="for $VAR$ in $ITERABLE$: 	$END$" description="for loop" toReformat="false"> | ||
<variable name="ITERABLE" expression="" alwaysStopAt="true" /> | ||
<variable name="VAR" expression="" alwaysStopAt="true" /> | ||
<context> | ||
<option name="GDSCRIPT" value="true" /> | ||
</context> | ||
</template> | ||
<template name="forrange" value="for $VAR$ in range($RANGE_START$, $RANGE_END$): 	$END$" | ||
description="for range loop" toReformat="false"> | ||
<variable name="RANGE_START" alwaysStopAt="true" /> | ||
<variable name="RANGE_END" alwaysStopAt="true" /> | ||
<variable name="VAR" alwaysStopAt="true" /> | ||
<context> | ||
<option name="GDSCRIPT" value="true" /> | ||
</context> | ||
</template> | ||
<template name="while" value="while $CONDITION$: 	$END$" description="while"> | ||
<variable name="CONDITION" expression="condition()" defaultValue="expr" alwaysStopAt="true" /> | ||
<context> | ||
<option name="GDSCRIPT" value="true" /> | ||
</context> | ||
</template> | ||
<template name="if" value="if $CONDITION$: 	$END$" description="if" toReformat="false"> | ||
<variable name="CONDITION" expression="" defaultValue="expr" alwaysStopAt="true" /> | ||
<context> | ||
<option name="GDSCRIPT" value="true"/> | ||
</context> | ||
</template> | ||
<template name="print" value="print($END$)" description="Print messages to console" toReformat="false"> | ||
<context> | ||
<option name="GDSCRIPT" value="true"/> | ||
</context> | ||
</template> | ||
<template name="func" value="func $NAME$($ARGS$): 	$END$" description="define function" toReformat="false"> | ||
<variable name="NAME" defaultValue="name" alwaysStopAt="true" /> | ||
<variable name="ARGS" defaultValue="args" alwaysStopAt="true" /> | ||
<context> | ||
<option name="GDSCRIPT" value="true"/> | ||
</context> | ||
</template> | ||
<template name="signal" value="signal $NAME$($ARGS$)" description="signal declaration"> | ||
<variable name="NAME" expression="" alwaysStopAt="true" /> | ||
<variable name="ARGS" expression="" alwaysStopAt="true" /> | ||
<context> | ||
<option name="GDSCRIPT" value="true"/> | ||
</context> | ||
</template> | ||
|
||
|
||
<!-- <template name="Inner class" value="class $1 extends ${2:Reference} 	$3" description="Inner class"/>--> | ||
<!-- <template name="if elif else"--> | ||
<!-- value="if ${1:condition}: 	${3:pass} elif ${2:condition}: 	${4:pass} else: 	${5:pass}"--> | ||
<!-- description="if elif else"/>--> | ||
<!-- <template name="if else" value="if ${1:condition}: 	${2:pass} else: 	${3:pass}"--> | ||
<!-- description="if else"/>--> | ||
<!-- <template name="match"--> | ||
<!-- value="match ${1:expression}: 	${2:pattern}: 		${3} \t_:\n\t\t${0:default}"--> | ||
<!-- description="match"/>--> | ||
<!-- <template name="var" value="var ${1:name}${2: = default}${3: setget }" description="define variables"/>--> | ||
<!-- <template name="export"--> | ||
<!-- value="export(${1:type}${2:,other_configs}) var ${3:name}${4: = default}${5: setget }"--> | ||
<!-- description="export variables"/>--> | ||
<!-- <template name="var" value="var ${1:name}${2: = default}${3: setget }" description="define variables"/>--> | ||
<!-- <template name="onready" value="onready var ${1:name} = get_node($2)"--> | ||
<!-- description="define onready variables"/>--> | ||
<!-- <template name="Is instance of a class or script" value="${1:instance} is ${2:class}"--> | ||
<!-- description="Is instance of a class or script"/>--> | ||
<!-- <template name="element in array" value="${1:element} in ${$2:array}" description="element in array"/>--> | ||
<!-- <template name="GDScript template"--> | ||
<!-- value="extends ${1:BaseClass} # class member variables go here, for example: # var a = 2 # var b = "textvar" func _ready(): 	# Called every time the node is added to the scene. 	# Initialization here 	pass "--> | ||
<!-- description="GDScript template"/>--> | ||
</templateSet> |