Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lua-language-server-srb2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LJ Sonic
lua-language-server-srb2
Commits
2792f9a6
Unverified
Commit
2792f9a6
authored
Nov 27, 2023
by
最萌小汐
Committed by
GitHub
Nov 27, 2023
Browse files
Options
Downloads
Plain Diff
Merge pull request #2430 from NyakoFox/rawdesc
Add a `rawdesc` field to exported docs
parents
8c4aca0f
5a468a1a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
script/cli/doc.lua
+8
-0
8 additions, 0 deletions
script/cli/doc.lua
script/core/hover/description.lua
+10
-10
10 additions, 10 deletions
script/core/hover/description.lua
with
18 additions
and
10 deletions
script/cli/doc.lua
+
8
−
0
View file @
2792f9a6
...
@@ -65,6 +65,7 @@ local function packObject(source, mark)
...
@@ -65,6 +65,7 @@ local function packObject(source, mark)
end
end
if
source
.
type
==
'function.return'
then
if
source
.
type
==
'function.return'
then
new
[
'desc'
]
=
source
.
comment
and
getDesc
(
source
.
comment
)
new
[
'desc'
]
=
source
.
comment
and
getDesc
(
source
.
comment
)
new
[
'rawdesc'
]
=
source
.
comment
and
getDesc
(
source
.
comment
,
true
)
end
end
if
source
.
type
==
'doc.type.table'
then
if
source
.
type
==
'doc.type.table'
then
new
[
'fields'
]
=
packObject
(
source
.
fields
,
mark
)
new
[
'fields'
]
=
packObject
(
source
.
fields
,
mark
)
...
@@ -82,6 +83,7 @@ local function packObject(source, mark)
...
@@ -82,6 +83,7 @@ local function packObject(source, mark)
end
end
if
source
.
bindDocs
then
if
source
.
bindDocs
then
new
[
'desc'
]
=
getDesc
(
source
)
new
[
'desc'
]
=
getDesc
(
source
)
new
[
'rawdesc'
]
=
getDesc
(
source
,
true
)
end
end
new
[
'view'
]
=
new
[
'view'
]
or
vm
.
getInfer
(
source
):
view
(
ws
.
rootUri
)
new
[
'view'
]
=
new
[
'view'
]
or
vm
.
getInfer
(
source
):
view
(
ws
.
rootUri
)
end
end
...
@@ -115,6 +117,7 @@ local function collectTypes(global, results)
...
@@ -115,6 +117,7 @@ local function collectTypes(global, results)
name
=
global
.
name
,
name
=
global
.
name
,
type
=
'type'
,
type
=
'type'
,
desc
=
nil
,
desc
=
nil
,
rawdesc
=
nil
,
defines
=
{},
defines
=
{},
fields
=
{},
fields
=
{},
}
}
...
@@ -131,6 +134,7 @@ local function collectTypes(global, results)
...
@@ -131,6 +134,7 @@ local function collectTypes(global, results)
extends
=
getExtends
(
set
),
extends
=
getExtends
(
set
),
}
}
result
.
desc
=
result
.
desc
or
getDesc
(
set
)
result
.
desc
=
result
.
desc
or
getDesc
(
set
)
result
.
rawdesc
=
result
.
rawdesc
or
getDesc
(
set
,
true
)
::
CONTINUE
::
::
CONTINUE
::
end
end
if
#
result
.
defines
==
0
then
if
#
result
.
defines
==
0
then
...
@@ -163,6 +167,7 @@ local function collectTypes(global, results)
...
@@ -163,6 +167,7 @@ local function collectTypes(global, results)
field
.
start
=
source
.
start
field
.
start
=
source
.
start
field
.
finish
=
source
.
finish
field
.
finish
=
source
.
finish
field
.
desc
=
getDesc
(
source
)
field
.
desc
=
getDesc
(
source
)
field
.
rawdesc
=
getDesc
(
source
,
true
)
field
.
extends
=
packObject
(
source
.
extends
)
field
.
extends
=
packObject
(
source
.
extends
)
return
return
end
end
...
@@ -180,6 +185,7 @@ local function collectTypes(global, results)
...
@@ -180,6 +185,7 @@ local function collectTypes(global, results)
field
.
start
=
source
.
start
field
.
start
=
source
.
start
field
.
finish
=
source
.
finish
field
.
finish
=
source
.
finish
field
.
desc
=
getDesc
(
source
)
field
.
desc
=
getDesc
(
source
)
field
.
rawdesc
=
getDesc
(
source
,
true
)
field
.
extends
=
packObject
(
source
.
value
)
field
.
extends
=
packObject
(
source
.
value
)
return
return
end
end
...
@@ -199,6 +205,7 @@ local function collectTypes(global, results)
...
@@ -199,6 +205,7 @@ local function collectTypes(global, results)
field
.
start
=
source
.
start
field
.
start
=
source
.
start
field
.
finish
=
source
.
finish
field
.
finish
=
source
.
finish
field
.
desc
=
getDesc
(
source
)
field
.
desc
=
getDesc
(
source
)
field
.
rawdesc
=
getDesc
(
source
,
true
)
field
.
extends
=
packObject
(
source
.
value
)
field
.
extends
=
packObject
(
source
.
value
)
return
return
end
end
...
@@ -237,6 +244,7 @@ local function collectVars(global, results)
...
@@ -237,6 +244,7 @@ local function collectVars(global, results)
extends
=
packObject
(
set
.
value
),
extends
=
packObject
(
set
.
value
),
}
}
result
.
desc
=
result
.
desc
or
getDesc
(
set
)
result
.
desc
=
result
.
desc
or
getDesc
(
set
)
result
.
rawdesc
=
result
.
rawdesc
or
getDesc
(
set
,
true
)
end
end
end
end
if
#
result
.
defines
==
0
then
if
#
result
.
defines
==
0
then
...
...
This diff is collapsed.
Click to expand it.
script/core/hover/description.lua
+
10
−
10
View file @
2792f9a6
...
@@ -336,7 +336,7 @@ local function tryDocFieldComment(source)
...
@@ -336,7 +336,7 @@ local function tryDocFieldComment(source)
end
end
end
end
local
function
getFunctionComment
(
source
)
local
function
getFunctionComment
(
source
,
raw
)
local
docGroup
=
source
.
bindDocs
local
docGroup
=
source
.
bindDocs
if
not
docGroup
then
if
not
docGroup
then
return
return
...
@@ -356,14 +356,14 @@ local function getFunctionComment(source)
...
@@ -356,14 +356,14 @@ local function getFunctionComment(source)
if
doc
.
type
==
'doc.comment'
then
if
doc
.
type
==
'doc.comment'
then
local
comment
=
normalizeComment
(
doc
.
comment
.
text
,
uri
)
local
comment
=
normalizeComment
(
doc
.
comment
.
text
,
uri
)
md
:
add
(
'md'
,
comment
)
md
:
add
(
'md'
,
comment
)
elseif
doc
.
type
==
'doc.param'
then
elseif
doc
.
type
==
'doc.param'
and
not
raw
then
if
doc
.
comment
then
if
doc
.
comment
then
md
:
add
(
'md'
,
(
'@*param* `%s` — %s'
):
format
(
md
:
add
(
'md'
,
(
'@*param* `%s` — %s'
):
format
(
doc
.
param
[
1
],
doc
.
param
[
1
],
doc
.
comment
.
text
doc
.
comment
.
text
))
))
end
end
elseif
doc
.
type
==
'doc.return'
then
elseif
doc
.
type
==
'doc.return'
and
not
raw
then
if
hasReturnComment
then
if
hasReturnComment
then
local
name
=
{}
local
name
=
{}
for
_
,
rtn
in
ipairs
(
doc
.
returns
)
do
for
_
,
rtn
in
ipairs
(
doc
.
returns
)
do
...
@@ -401,13 +401,13 @@ local function getFunctionComment(source)
...
@@ -401,13 +401,13 @@ local function getFunctionComment(source)
end
end
---@async
---@async
local
function
tryDocComment
(
source
)
local
function
tryDocComment
(
source
,
raw
)
local
md
=
markdown
()
local
md
=
markdown
()
if
source
.
value
and
source
.
value
.
type
==
'function'
then
if
source
.
value
and
source
.
value
.
type
==
'function'
then
source
=
source
.
value
source
=
source
.
value
end
end
if
source
.
type
==
'function'
then
if
source
.
type
==
'function'
then
local
comment
=
getFunctionComment
(
source
)
local
comment
=
getFunctionComment
(
source
,
raw
)
md
:
add
(
'md'
,
comment
)
md
:
add
(
'md'
,
comment
)
source
=
source
.
parent
source
=
source
.
parent
end
end
...
@@ -429,7 +429,7 @@ local function tryDocComment(source)
...
@@ -429,7 +429,7 @@ local function tryDocComment(source)
end
end
---@async
---@async
local
function
tryDocOverloadToComment
(
source
)
local
function
tryDocOverloadToComment
(
source
,
raw
)
if
source
.
type
~=
'doc.type.function'
then
if
source
.
type
~=
'doc.type.function'
then
return
return
end
end
...
@@ -438,7 +438,7 @@ local function tryDocOverloadToComment(source)
...
@@ -438,7 +438,7 @@ local function tryDocOverloadToComment(source)
or
not
doc
.
bindSource
then
or
not
doc
.
bindSource
then
return
return
end
end
local
md
=
tryDocComment
(
doc
.
bindSource
)
local
md
=
tryDocComment
(
doc
.
bindSource
,
raw
)
if
md
then
if
md
then
return
md
return
md
end
end
...
@@ -529,7 +529,7 @@ local function tryDocEnum(source)
...
@@ -529,7 +529,7 @@ local function tryDocEnum(source)
end
end
---@async
---@async
return
function
(
source
)
return
function
(
source
,
raw
)
if
source
.
type
==
'string'
then
if
source
.
type
==
'string'
then
return
asString
(
source
)
return
asString
(
source
)
end
end
...
@@ -539,10 +539,10 @@ return function (source)
...
@@ -539,10 +539,10 @@ return function (source)
if
source
.
type
==
'field'
then
if
source
.
type
==
'field'
then
source
=
source
.
parent
source
=
source
.
parent
end
end
return
tryDocOverloadToComment
(
source
)
return
tryDocOverloadToComment
(
source
,
raw
)
or
tryDocFieldComment
(
source
)
or
tryDocFieldComment
(
source
)
or
tyrDocParamComment
(
source
)
or
tyrDocParamComment
(
source
)
or
tryDocComment
(
source
)
or
tryDocComment
(
source
,
raw
)
or
tryDocClassComment
(
source
)
or
tryDocClassComment
(
source
)
or
tryDocModule
(
source
)
or
tryDocModule
(
source
)
or
tryDocEnum
(
source
)
or
tryDocEnum
(
source
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment