summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-31 20:52:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-31 20:52:39 +0800
commit7c07ff16bea903fb8ca5243d3af6cf9b700e8a48 (patch)
treedda415db647623e327fd27e646e72ea43de9ce2b /script/provider
parent9e43c90c1d5ebf09a73638822bea8d38958130df (diff)
downloadlua-language-server-7c07ff16bea903fb8ca5243d3af6cf9b700e8a48.zip
flush cache before some request
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index e9974250..f8592d0c 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -18,6 +18,7 @@ local lang = require 'language'
local plugin = require 'plugin'
local progress = require 'progress'
local tm = require 'text-merger'
+local vm = require 'vm'
local function updateConfig()
local diagnostics = require 'provider.diagnostic'
@@ -288,6 +289,7 @@ proto.on('textDocument/hover', function (params)
if not files.exists(uri) then
return nil
end
+ vm.flushCache()
local offset = files.offsetOfWord(uri, params.position)
local hover = core.byUri(uri, offset)
if not hover then
@@ -314,6 +316,7 @@ proto.on('textDocument/definition', function (params)
if not files.exists(uri) then
return nil
end
+ vm.flushCache()
local offset = files.offsetOfWord(uri, params.position)
local result = core(uri, offset)
if not result then
@@ -343,6 +346,7 @@ proto.on('textDocument/references', function (params)
if not files.exists(uri) then
return nil
end
+ vm.flushCache()
local offset = files.offsetOfWord(uri, params.position)
local result = core(uri, offset)
if not result then
@@ -364,6 +368,7 @@ proto.on('textDocument/documentHighlight', function (params)
if not files.exists(uri) then
return nil
end
+ vm.flushCache()
local offset = files.offsetOfWord(uri, params.position)
local result = core(uri, offset)
if not result then
@@ -387,6 +392,7 @@ proto.on('textDocument/rename', function (params)
if not files.exists(uri) then
return nil
end
+ vm.flushCache()
local offset = files.offsetOfWord(uri, params.position)
local result = core.rename(uri, offset, params.newName)
if not result then
@@ -412,6 +418,7 @@ proto.on('textDocument/prepareRename', function (params)
if not files.exists(uri) then
return nil
end
+ vm.flushCache()
local offset = files.offsetOfWord(uri, params.position)
local result = core.prepareRename(uri, offset)
if not result then