diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-11 21:05:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-11 21:05:02 +0800 |
commit | 228613899d6d0562c1cd639e69c796fa65c2636d (patch) | |
tree | 9476134d1d89cdb038cfa07aac3e16a6228caa92 /script/files.lua | |
parent | 6b7a952d6537f389a85df7928ded74ca9c81eee0 (diff) | |
download | lua-language-server-228613899d6d0562c1cd639e69c796fa65c2636d.zip |
stash
Diffstat (limited to 'script/files.lua')
-rw-r--r-- | script/files.lua | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/script/files.lua b/script/files.lua index b085e7fd..3f3d633e 100644 --- a/script/files.lua +++ b/script/files.lua @@ -19,6 +19,7 @@ if platform.OS == 'Windows' then unicode = require 'bee.unicode' end +---@class files local m = {} m.openMap = {} @@ -206,6 +207,24 @@ function m.setRawText(uri, text) m.astMap[uri] = nil end +function m.getCachedRows(uri) + uri = getUriKey(uri) + local file = m.fileMap[uri] + if not file then + return nil + end + return file.rows +end + +function m.setCachedRows(uri, rows) + uri = getUriKey(uri) + local file = m.fileMap[uri] + if not file then + return + end + file.rows = rows +end + --- 获取文件版本 function m.getVersion(uri) uri = getUriKey(uri) @@ -633,17 +652,6 @@ function m.diffedOffsetBack(uri, offset) return smerger.getOffsetBack(file._diffInfo, offset) end -function m.clearDiff(uri) - uri = m.getUri(uri) - local file = m.fileMap[uri] - if not file then - return - end - file._diffInfo = nil - file.text = file.originText - m.linesMap[uri] = m.originLinesMap[uri] -end - --- 将光标位置转化为 position ---@param uri uri ---@param offset integer |