Skip to content

Commit 82fa810

Browse files
committed
Add, support require alias (.luaurc)
1 parent 44480f7 commit 82fa810

File tree

16 files changed

+134
-28
lines changed

16 files changed

+134
-28
lines changed

.vscode/c_cpp_properties.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"${workspaceFolder}/submodules/luau/Analysis/include",
99
"${workspaceFolder}/submodules/luau/Ast/include",
1010
"${workspaceFolder}/submodules/luau/CLI/include",
11-
"${workspaceFolder}/submodules/luau/Common/include"
11+
"${workspaceFolder}/submodules/luau/Common/include",
12+
"${workspaceFolder}/submodules/luau/Config/include"
1213
],
1314
"defines": [],
1415
"compilerPath": "/usr/bin/g++",
@@ -19,4 +20,4 @@
1920
}
2021
],
2122
"version": 4
22-
}
23+
}

.vscode/settings.json

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
11
{
2-
"luau-lsp.sourcemap.enabled": false
2+
"luau-lsp.sourcemap.enabled": false,
3+
"files.associations": {
4+
"*.luau": "luau",
5+
"iostream": "cpp",
6+
"fstream": "cpp",
7+
"filesystem": "cpp",
8+
"iosfwd": "cpp",
9+
"array": "cpp",
10+
"bit": "cpp",
11+
"*.tcc": "cpp",
12+
"cmath": "cpp",
13+
"compare": "cpp",
14+
"concepts": "cpp",
15+
"cstdarg": "cpp",
16+
"cstdint": "cpp",
17+
"cstdio": "cpp",
18+
"cstdlib": "cpp",
19+
"unordered_map": "cpp",
20+
"vector": "cpp",
21+
"exception": "cpp",
22+
"algorithm": "cpp",
23+
"functional": "cpp",
24+
"iterator": "cpp",
25+
"memory_resource": "cpp",
26+
"optional": "cpp",
27+
"random": "cpp",
28+
"string": "cpp",
29+
"string_view": "cpp",
30+
"tuple": "cpp",
31+
"type_traits": "cpp",
32+
"utility": "cpp",
33+
"initializer_list": "cpp",
34+
"istream": "cpp",
35+
"limits": "cpp",
36+
"new": "cpp",
37+
"ostream": "cpp",
38+
"ranges": "cpp",
39+
"span": "cpp",
40+
"stdexcept": "cpp",
41+
"typeinfo": "cpp",
42+
"variant": "cpp",
43+
"deque": "cpp",
44+
"list": "cpp",
45+
"unordered_set": "cpp",
46+
"format": "cpp",
47+
"text_encoding": "cpp",
48+
"bitset": "cpp"
49+
}
350
}

example/.luaurc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"languageMode": "strict",
3+
"lint": { "*": true, "LocalUnused": true },
4+
"lintErrors": true,
5+
"typeErrors": true,
6+
"aliases": {
7+
"print": "./lib/print"
8+
}
9+
}

example/a.luau

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ print_counter("Counter A", counter_a)
1313
print_counter("Counter B", counter_b)
1414
print_counter("Counter C", counter_c)
1515

16-
print("A LOADED")
17-
1816
return {
1917
counter_a = counter_a,
2018
counter_b = counter_b,

example/b.luau

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ counter_c:increment(10)
1212
print_counter("Counter B", counter_b)
1313
print_counter("Counter C", counter_c)
1414

15-
print("B LOADED")
16-
1715
return {
1816
counter_b = counter_b,
1917
counter_c = counter_c

example/c.luau

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ print("----- C (C+15)")
88
counter_c:increment(15)
99
print_counter("Counter C", counter_c)
1010

11-
print("C LOADED")
12-
1311
return {
1412
counter_c = counter_c
1513
}

example/hello/.luaurc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"languageMode": "strict",
3+
"lint": { "*": true, "LocalUnused": true },
4+
"lintErrors": true,
5+
"typeErrors": true,
6+
"aliases": {
7+
"w": "./world",
8+
"s": "./space"
9+
}
10+
}

example/hello/init.luau

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
print("HELLO/INIT LOADED")
2-
31
return {
4-
hello = function()
5-
print("Hello")
6-
end
2+
text = ("Hello" .. require("@s").text)
73
}

example/hello/space/init.luau

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
return {
2+
text = (" " .. require("@w").text)
3+
}

example/hello/world.luau

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
return {
2+
text = "World!"
3+
}

0 commit comments

Comments
 (0)