Skip to content

Commit 207f90f

Browse files
committed
Add GDScript submodule and syntax test file for GDScript support, see #XXX (@chetanjangir0)
1 parent 5c43ddb commit 207f90f

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,6 @@
266266
[submodule "assets/syntaxes/02_Extra/Idris2"]
267267
path = assets/syntaxes/02_Extra/Idris2
268268
url = https://github.com/buzden/sublime-syntax-idris2
269+
[submodule "assets/syntaxes/02_Extra/GDScript-sublime"]
270+
path = assets/syntaxes/02_Extra/GDScript-sublime
271+
url = https://github.com/beefsack/GDScript-sublime

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- Map `ndjson` extension to JSON syntax, see #3209 (@keith-hall)
2323
- Map files with `csproj`, `vbproj`, `props` and `targets` extensions to XML syntax, see #3213 (@keith-hall)
2424
- Add debsources syntax to highlight `/etc/apt/sources.list` files, see #3215 (@keith-hall)
25+
- Add syntax test file for GDScript highlighting, see #XYZ (@chetanjangir0)
2526

2627
## Themes
2728

Submodule GDScript-sublime added at 96f5dcf
+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
extends Node
2+
3+
signal custom_signal(param)
4+
5+
const PI = 3.14159
6+
7+
var untyped_var = "Hello, World!"
8+
var typed_int: int = 42
9+
var typed_float: float = 3.14
10+
var typed_string: String = "GDScript Test"
11+
var typed_array: Array = [1, 2, 3, 4]
12+
var typed_dict: Dictionary = {"key": "value", "number": 100}
13+
14+
onready var label = $Label
15+
16+
func say_hello() -> void:
17+
print("Hello from GDScript!")
18+
19+
func add_numbers(a: int, b: int = 10) -> int:
20+
return a + b
21+
22+
func process_value(value: int) -> String:
23+
if value < 0:
24+
return "Negative"
25+
elif value == 0:
26+
return "Zero"
27+
else:
28+
return "Positive"
29+
30+
func sum_array(arr: Array) -> int:
31+
var total: int = 0
32+
for num in arr:
33+
total += num
34+
return total
35+
36+
func describe_number(num: int) -> String:
37+
match num:
38+
0:
39+
return "Zero"
40+
1, 2, 3:
41+
return "Small number"
42+
_:
43+
return "Large number"
44+
45+
func long_description() -> String:
46+
return """This is a test file for GDScript.
47+
It covers variables, functions, control structures, loops, signals, inner classes,
48+
multiline strings, arrays, and dictionaries."""
49+
50+
class InnerExample:
51+
var inner_value: int = 99
52+
func show_value() -> void:
53+
print("Inner value is:", inner_value)
54+
55+
func test_inner_class() -> void:
56+
var inner = InnerExample.new()
57+
inner.show_value()
58+
59+
func trigger_signal() -> void:
60+
emit_signal("custom_signal", "TestParam")
61+
62+
func _ready() -> void:
63+
say_hello()
64+
var result_add = add_numbers(5)
65+
print("Add result:", result_add)
66+
print("Process value for -5:", process_value(-5))
67+
print("Sum of array [10, 20, 30]:", sum_array([10, 20, 30]))
68+
print("Description for 2:", describe_number(2))
69+
print("Long description:\n", long_description())
70+
test_inner_class()
71+
trigger_signal()

0 commit comments

Comments
 (0)