Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@
[submodule "assets/syntaxes/02_Extra/Idris2"]
path = assets/syntaxes/02_Extra/Idris2
url = https://github.com/buzden/sublime-syntax-idris2
[submodule "assets/syntaxes/02_Extra/GDScript-sublime"]
path = assets/syntaxes/02_Extra/GDScript-sublime
url = https://github.com/beefsack/GDScript-sublime
[submodule "assets/syntaxes/02_Extra/sublime-odin"]
path = assets/syntaxes/02_Extra/sublime-odin
url = https://github.com/odin-lang/sublime-odin
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- Map `ndjson` extension to JSON syntax, see #3209 (@keith-hall)
- Map files with `csproj`, `vbproj`, `props` and `targets` extensions to XML syntax, see #3213 (@keith-hall)
- Add debsources syntax to highlight `/etc/apt/sources.list` files, see #3215 (@keith-hall)
- Add syntax definition and test file for GDScript highlighting, see #3236 (@chetanjangir0)
- Add syntax test file for Odin highlighting, see #3241 (@chetanjangir0)

## Themes
Expand Down
1 change: 1 addition & 0 deletions assets/syntaxes/02_Extra/GDScript-sublime
Submodule GDScript-sublime added at 96f5dc
71 changes: 71 additions & 0 deletions tests/syntax-tests/highlighted/GDScript/test.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
extends Node

signal custom_signal(param)

const PI = 3.14159

var untyped_var = "Hello, World!"
var typed_int: int = 42
var typed_float: float = 3.14
var typed_string: String = "GDScript Test"
var typed_array: Array = [1, 2, 3, 4]
var typed_dict: Dictionary = {"key": "value", "number": 100}

onready var label = $Label

func say_hello() -> void:
 print("Hello from GDScript!")

func add_numbers(a: int, b: int = 10) -> int:
 return a + b

func process_value(value: int) -> String:
 if value < 0:
 return "Negative"
 elif value == 0:
 return "Zero"
 else:
 return "Positive"

func sum_array(arr: Array) -> int:
 var total: int = 0
 for num in arr:
 total += num
 return total

func describe_number(num: int) -> String:
 match num:
 0:
 return "Zero"
 1, 2, 3:
 return "Small number"
 _:
 return "Large number"

func long_description() -> String:
 return """This is a test file for GDScript.
It covers variables, functions, control structures, loops, signals, inner classes,
multiline strings, arrays, and dictionaries."""

class InnerExample:
 var inner_value: int = 99
 func show_value() -> void:
 print("Inner value is:", inner_value)

func test_inner_class() -> void:
 var inner = InnerExample.new()
 inner.show_value()

func trigger_signal() -> void:
 emit_signal("custom_signal", "TestParam")

func _ready() -> void:
 say_hello()
 var result_add = add_numbers(5)
 print("Add result:", result_add)
 print("Process value for -5:", process_value(-5))
 print("Sum of array [10, 20, 30]:", sum_array([10, 20, 30]))
 print("Description for 2:", describe_number(2))
 print("Long description:\n", long_description())
 test_inner_class()
 trigger_signal()
71 changes: 71 additions & 0 deletions tests/syntax-tests/source/GDScript/test.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
extends Node

signal custom_signal(param)

const PI = 3.14159

var untyped_var = "Hello, World!"
var typed_int: int = 42
var typed_float: float = 3.14
var typed_string: String = "GDScript Test"
var typed_array: Array = [1, 2, 3, 4]
var typed_dict: Dictionary = {"key": "value", "number": 100}

onready var label = $Label

func say_hello() -> void:
print("Hello from GDScript!")

func add_numbers(a: int, b: int = 10) -> int:
return a + b

func process_value(value: int) -> String:
if value < 0:
return "Negative"
elif value == 0:
return "Zero"
else:
return "Positive"

func sum_array(arr: Array) -> int:
var total: int = 0
for num in arr:
total += num
return total

func describe_number(num: int) -> String:
match num:
0:
return "Zero"
1, 2, 3:
return "Small number"
_:
return "Large number"

func long_description() -> String:
return """This is a test file for GDScript.
It covers variables, functions, control structures, loops, signals, inner classes,
multiline strings, arrays, and dictionaries."""

class InnerExample:
var inner_value: int = 99
func show_value() -> void:
print("Inner value is:", inner_value)

func test_inner_class() -> void:
var inner = InnerExample.new()
inner.show_value()

func trigger_signal() -> void:
emit_signal("custom_signal", "TestParam")

func _ready() -> void:
say_hello()
var result_add = add_numbers(5)
print("Add result:", result_add)
print("Process value for -5:", process_value(-5))
print("Sum of array [10, 20, 30]:", sum_array([10, 20, 30]))
print("Description for 2:", describe_number(2))
print("Long description:\n", long_description())
test_inner_class()
trigger_signal()