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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LJ Sonic
lua-language-server-srb2
Commits
d20d2d2d
Commit
d20d2d2d
authored
4 years ago
by
最萌小汐
Browse files
Options
Downloads
Patches
Plain Diff
await.wait 也要使用延迟检查器
parent
390108b1
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
main-beta.lua
+1
-1
1 addition, 1 deletion
main-beta.lua
script-beta/await.lua
+5
-1
5 additions, 1 deletion
script-beta/await.lua
script-beta/vm/guideInterface.lua
+4
-0
4 additions, 0 deletions
script-beta/vm/guideInterface.lua
with
10 additions
and
2 deletions
main-beta.lua
+
1
−
1
View file @
d20d2d2d
...
@@ -5,7 +5,7 @@ local fs = require 'bee.filesystem'
...
@@ -5,7 +5,7 @@ local fs = require 'bee.filesystem'
ROOT
=
fs
.
path
(
rootPath
)
ROOT
=
fs
.
path
(
rootPath
)
LANG
=
LANG
or
'en-US'
LANG
=
LANG
or
'en-US'
--
collectgarbage('generational', 10, 50)
collectgarbage
(
'generational'
,
10
,
50
)
--collectgarbage('incremental', 120, 120, 0)
--collectgarbage('incremental', 120, 120, 0)
log
=
require
'log'
log
=
require
'log'
...
...
This diff is collapsed.
Click to expand it.
script-beta/await.lua
+
5
−
1
View file @
d20d2d2d
...
@@ -31,6 +31,7 @@ function m.create(callback, ...)
...
@@ -31,6 +31,7 @@ function m.create(callback, ...)
return
m
.
checkResult
(
co
,
coroutine.resume
(
co
,
...
))
return
m
.
checkResult
(
co
,
coroutine.resume
(
co
,
...
))
end
end
--- 对当前任务设置一个延迟检查器,当延迟前后检查器的返回值不同时,放弃此任务
function
m
.
setDelayer
(
callback
)
function
m
.
setDelayer
(
callback
)
local
co
=
coroutine.running
()
local
co
=
coroutine.running
()
m
.
coDelayer
[
co
]
=
callback
m
.
coDelayer
[
co
]
=
callback
...
@@ -47,8 +48,11 @@ function m.sleep(time, getVersion)
...
@@ -47,8 +48,11 @@ function m.sleep(time, getVersion)
end
end
local
version
=
getVersion
and
getVersion
()
local
version
=
getVersion
and
getVersion
()
local
co
=
coroutine.running
()
local
co
=
coroutine.running
()
local
delayer
=
m
.
coDelayer
[
co
]
local
dVersion
=
delayer
and
delayer
()
timer
.
wait
(
time
,
function
()
timer
.
wait
(
time
,
function
()
if
version
==
(
getVersion
and
getVersion
())
then
if
version
==
(
getVersion
and
getVersion
())
and
dVersion
==
(
delayer
and
delayer
())
then
return
m
.
checkResult
(
co
,
coroutine.resume
(
co
))
return
m
.
checkResult
(
co
,
coroutine.resume
(
co
))
else
else
coroutine
.
close
(
co
)
coroutine
.
close
(
co
)
...
...
This diff is collapsed.
Click to expand it.
script-beta/vm/guideInterface.lua
+
4
−
0
View file @
d20d2d2d
...
@@ -2,6 +2,7 @@ local vm = require 'vm.vm'
...
@@ -2,6 +2,7 @@ local vm = require 'vm.vm'
local
files
=
require
'files'
local
files
=
require
'files'
local
ws
=
require
'workspace'
local
ws
=
require
'workspace'
local
guide
=
require
'parser.guide'
local
guide
=
require
'parser.guide'
local
await
=
require
'await'
local
m
=
{}
local
m
=
{}
...
@@ -63,6 +64,7 @@ function vm.interface.call(func, args, index)
...
@@ -63,6 +64,7 @@ function vm.interface.call(func, args, index)
if
not
lib
then
if
not
lib
then
return
nil
return
nil
end
end
await
.
delay
()
if
lib
.
name
==
'require'
and
index
==
1
then
if
lib
.
name
==
'require'
and
index
==
1
then
return
m
.
require
(
args
,
index
)
return
m
.
require
(
args
,
index
)
end
end
...
@@ -72,9 +74,11 @@ function vm.interface.call(func, args, index)
...
@@ -72,9 +74,11 @@ function vm.interface.call(func, args, index)
end
end
function
vm
.
interface
.
global
(
name
)
function
vm
.
interface
.
global
(
name
)
await
.
delay
()
return
vm
.
getGlobals
(
name
)
return
vm
.
getGlobals
(
name
)
end
end
function
vm
.
interface
.
link
(
uri
)
function
vm
.
interface
.
link
(
uri
)
await
.
delay
()
return
vm
.
getLinksTo
(
uri
)
return
vm
.
getLinksTo
(
uri
)
end
end
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