summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-15 19:09:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-15 19:09:47 +0800
commita87e0c7cbd8ff44deb009b12efa8c28473db0470 (patch)
tree7637a3db4a65444b9717c12be9e9c7fa96c7e92e /script-beta
parent674892abc53ad6752326135c8aaf60073f80b632 (diff)
downloadlua-language-server-a87e0c7cbd8ff44deb009b12efa8c28473db0470.zip
添加delay,保证自动完成的优先度最高
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/parser/guide.lua2
-rw-r--r--script-beta/provider/diagnostic.lua2
-rw-r--r--script-beta/provider/provider.lua2
-rw-r--r--script-beta/vm/eachDef.lua3
-rw-r--r--script-beta/vm/eachField.lua3
-rw-r--r--script-beta/vm/eachRef.lua3
6 files changed, 13 insertions, 2 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 4ea33430..787926a3 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -1376,6 +1376,8 @@ function m.checkSameSimpleAsReturn(status, ref, start, queue)
if m.checkCallMark(status, ref) then
return
end
+ -- TODO 这里的开销非常大
+ do return end
local newStatus = m.status(status)
m.searchRefsAsFunctionReturn(newStatus, ref, 'ref')
for _, res in ipairs(newStatus.results) do
diff --git a/script-beta/provider/diagnostic.lua b/script-beta/provider/diagnostic.lua
index 28f0cf8e..86d80034 100644
--- a/script-beta/provider/diagnostic.lua
+++ b/script-beta/provider/diagnostic.lua
@@ -212,7 +212,7 @@ end
function m.start()
m._start = true
- --m.diagnosticsAll()
+ m.diagnosticsAll()
end
files.watch(function (env, uri)
diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua
index ba635255..bf96209b 100644
--- a/script-beta/provider/provider.lua
+++ b/script-beta/provider/provider.lua
@@ -319,7 +319,7 @@ proto.on('textDocument/completion', function (params)
if not result then
return nil
end
- local easy = false
+ local easy = true
local items = {}
for i, res in ipairs(result) do
local item = {
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua
index 2b30c0cd..7ab65581 100644
--- a/script-beta/vm/eachDef.lua
+++ b/script-beta/vm/eachDef.lua
@@ -3,6 +3,7 @@ local guide = require 'parser.guide'
local ws = require 'workspace'
local files = require 'files'
local util = require 'utility'
+local await = require 'await'
local m = {}
@@ -24,6 +25,8 @@ function m.eachDef(source, results)
return results
end
+ await.delay()
+
local clock = os.clock()
local myResults, count = guide.requestDefinition(source, vm.interface)
if DEVELOP and os.clock() - clock > 0.1 then
diff --git a/script-beta/vm/eachField.lua b/script-beta/vm/eachField.lua
index 2ae9190f..7dab51e7 100644
--- a/script-beta/vm/eachField.lua
+++ b/script-beta/vm/eachField.lua
@@ -1,6 +1,7 @@
local vm = require 'vm.vm'
local guide = require 'parser.guide'
local library = require 'library'
+local await = require 'await'
local function eachFieldInLibrary(source, lib, results)
if not lib or not lib.child then
@@ -21,6 +22,8 @@ local function eachField(source)
while source.type == 'paren' do
source = source.exp
end
+
+ await.delay()
local results = guide.requestFields(source, vm.interface)
local lib = vm.getLibrary(source)
if lib then
diff --git a/script-beta/vm/eachRef.lua b/script-beta/vm/eachRef.lua
index d372b03b..616dccdd 100644
--- a/script-beta/vm/eachRef.lua
+++ b/script-beta/vm/eachRef.lua
@@ -1,6 +1,7 @@
local vm = require 'vm.vm'
local guide = require 'parser.guide'
local util = require 'utility'
+local await = require 'await'
local function getRefs(source, results)
results = results or {}
@@ -9,6 +10,8 @@ local function getRefs(source, results)
return results
end
+ await.delay()
+
local clock = os.clock()
local myResults, count = guide.requestReference(source, vm.interface)
if DEVELOP and os.clock() - clock > 0.1 then