Skip to content

Commit 7e3258d

Browse files
committed
Use invisible characters in lua markdown
1 parent cffa4e2 commit 7e3258d

File tree

10 files changed

+27
-26
lines changed

10 files changed

+27
-26
lines changed

server/main.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ end
3838

3939
loadArgs()
4040

41+
INV = ""
4142
ROOT = fs.path(expanduser(rootPath))
4243
LOGPATH = LOGPATH and expanduser(LOGPATH) or (ROOT:string() .. '/log')
4344
METAPATH = METAPATH and expanduser(METAPATH) or (ROOT:string() .. '/meta')

server/script/core/hover/arg.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ local function asFunction(source, oop)
4545
)
4646
if arg.default and arg.default ~= "nil" then
4747
if argType == "string" or argType:sub(1, 5) == "Enum." then
48-
args[#args] = args[#args] .. " \f= \"" .. arg.default .. "\""
48+
args[#args] = ("%s %s= \"%s\""):format(args[#args], INV, arg.default)
4949
else
50-
args[#args] = args[#args] .. " \f= " .. arg.default
50+
args[#args] = ("%s %s= %s"):format(args[#args], INV, arg.default)
5151
end
5252
end
5353
else
@@ -101,7 +101,7 @@ local function asTypeFunction(source, oop)
101101
end
102102
end
103103
if arg.default then
104-
args[#args] = args[#args] .. " \f= " .. (arg.default == "" and '""' or arg.default)
104+
args[#args+1] = ("%s %s= %s"):format(args[#args], INV, (arg.default == "" and '""' or arg.default))
105105
end
106106
end
107107
if oop then

server/script/core/hover/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ local function getHoverAsValue(source)
5252
end
5353
end
5454
return {
55-
label = label and "\f" .. label,
55+
label = label and INV .. label,
5656
source = source,
5757
description = desc,
5858
path = getPath(source)
@@ -146,7 +146,7 @@ local function getHoverAsTypeFunction(source, values, oop)
146146
local rtn = buildReturn(value)
147147
lines[#lines+1] = ('function %s(%s)'):format(name, arg)
148148
if rtn then
149-
lines[#lines+1] = "\f" .. rtn .. "\f"
149+
lines[#lines+1] = INV .. rtn .. INV
150150
end
151151
else
152152
other = other + 1

server/script/core/hover/label.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ local function asFunction(source, oop)
1717
local lines = {}
1818
lines[1] = ('function %s(%s)'):format(name, arg)
1919
if rtn then
20-
lines[2] = "\f" .. rtn .. "\f"
20+
lines[2] = INV .. rtn .. INV
2121
end
2222
return table.concat(lines, '\n')
2323
end
@@ -29,7 +29,7 @@ local function asDocFunction(source)
2929
local lines = {}
3030
lines[1] = ('function %s(%s)'):format(name, arg)
3131
if rtn then
32-
lines[2] = "\f" .. rtn .. "\f"
32+
lines[2] = INV .. rtn .. INV
3333
end
3434
return table.concat(lines, '\n')
3535
end
@@ -42,7 +42,7 @@ local function asFunctionType(source, oop)
4242
local lines = {}
4343
lines[1] = ('function %s(%s)'):format(name, arg)
4444
if rtn then
45-
lines[2] = "\f" .. rtn .. "\f"
45+
lines[2] = INV .. rtn .. INV
4646
end
4747
return table.concat(lines, '\n')
4848
end

server/script/core/hover/return.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ local function asTypeAnn(typeAnn)
6161
local line = {}
6262
for i = 1, #returns do
6363
if i == 1 then
64-
line[#line+1] = ' -> ' .. returns[i]
64+
line[#line+1] = '  -> ' .. returns[i]
6565
else
6666
line[#line+1] = ('% 3d. %s'):format(i, returns[i])
6767
end
@@ -83,7 +83,7 @@ local function asFunction(source)
8383
local line = {}
8484
local types = {}
8585
if i == 1 then
86-
line[#line+1] = ' -> '
86+
line[#line+1] = '  -> '
8787
else
8888
line[#line+1] = ('% 3d. '):format(i)
8989
end
@@ -133,7 +133,7 @@ local function asDocFunction(source)
133133
rtn.optional and '?' or ''
134134
)
135135
if i == 1 then
136-
returns[#returns+1] = (' -> %s'):format(rtnText)
136+
returns[#returns+1] = ('  -> %s'):format(rtnText)
137137
else
138138
returns[#returns+1] = ('% 3d. %s'):format(i, rtnText)
139139
end

server/script/core/hover/table.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ local function buildAsHash(classes, literals, reachMax)
119119
local class = classes[key]
120120
local literal = literals[key]
121121
if literal then
122-
lines[#lines+1] = (' %s: %s = %s,'):format(key, class, literal)
122+
lines[#lines+1] = ('    %s: %s = %s,'):format(key, class, literal)
123123
else
124-
lines[#lines+1] = (' %s: %s,'):format(key, class)
124+
lines[#lines+1] = ('    %s: %s,'):format(key, class)
125125
end
126126
end
127127
if reachMax then
128-
lines[#lines+1] = ' ...'
128+
lines[#lines+1] = '    ...'
129129
end
130130
lines[#lines+1] = '}'
131131
return table.concat(lines, '\n')
@@ -145,13 +145,13 @@ local function buildAsConst(classes, literals, reachMax)
145145
local class = classes[key]
146146
local literal = literals[key]
147147
if literal then
148-
lines[#lines+1] = (' %s: %s = %s,'):format(key, class, literal)
148+
lines[#lines+1] = ('    %s: %s = %s,'):format(key, class, literal)
149149
else
150-
lines[#lines+1] = (' %s: %s,'):format(key, class)
150+
lines[#lines+1] = ('    %s: %s,'):format(key, class)
151151
end
152152
end
153153
if reachMax then
154-
lines[#lines+1] = ' ...'
154+
lines[#lines+1] = '    ...'
155155
end
156156
lines[#lines+1] = '}'
157157
return table.concat(lines, '\n')

server/script/core/signature.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ end
5252

5353
local function makeOneSignature(source, oop, index)
5454
local label = hoverLabel(source, oop)
55-
label = label:gsub('%s*\f%s*->.+', ''):gsub("\f", "")
55+
label = label:gsub("[%s ]*" .. INV .. "[%s ]*%-%>.+", ""):gsub(INV, "")
5656
local argStart, argLabel = label:match("()(%b())$")
5757
argLabel = argLabel:sub(2, #argLabel - 1)
5858
for _, pattern in ipairs({"()", "{}", "[]", "<>"}) do

server/script/library/rbxlibs.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ local function parseMembers(data, isObject)
406406
local child = {}
407407
if params and #params > 0 then
408408
local paramsStr = require("core.guide").buildTypeAnn(params)
409-
paramsLabel = string.format("\n\f\f -> %s\n", paramsStr)
409+
paramsLabel = string.format("\n%s  -> %s\n", INV .. INV, paramsStr)
410410
child[1] = {
411411
name = "Wait",
412412
type = "type.library",

server/script/vm/getType.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function vm.getTypeString(source, deep)
1111
if infer.source and infer.source.type == "type.table" then
1212
local fields = {}
1313
for _, field in ipairs(infer.source) do
14-
fields[#fields+1] = "\t" .. guide.buildTypeAnn(field)
14+
fields[#fields+1] = "    " .. guide.buildTypeAnn(field)
1515
end
1616
return ("{\n%s\n}"):format(table.concat(fields, ",\n"))
1717
end

syntaxes/lua.tmLanguage.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@
531531
"hover": {
532532
"patterns": [
533533
{
534-
"begin": "\\f\\b(global|field|event|property|child|callback)\\b (\\w*)\\.?([\\w.]*)(:) ",
535-
"end": "\\f",
534+
"begin": "[‎]\\b(global|field|event|property|child|callback)\\b (\\w*)\\.?([\\w.]*)(:) ",
535+
"end": "[‎]",
536536
"beginCaptures": {
537537
"1": {
538538
"name": "storage"
@@ -554,8 +554,8 @@
554554
]
555555
},
556556
{
557-
"begin": "\\f\\s*-> ",
558-
"end": "\\f",
557+
"begin": "[‎]\\s*-> ",
558+
"end": "[‎]",
559559
"patterns": [
560560
{
561561
"match": "(\\w+): (\\w+(\\.)?\\w*)",
@@ -577,7 +577,7 @@
577577
]
578578
},
579579
{
580-
"begin": " \\f= ",
580+
"begin": " [‎]= ",
581581
"end": "[),]",
582582
"patterns": [
583583
{
@@ -586,7 +586,7 @@
586586
]
587587
},
588588
{
589-
"match": "\\f(type)\\s+(\\w+(\\.)?\\w*)",
589+
"match": "[‎](type)\\s+(\\w+(\\.)?\\w*)",
590590
"captures": {
591591
"1": {
592592
"name": "storage.type.lua"

0 commit comments

Comments
 (0)