diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 16:37:56 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 16:37:56 +0800 |
commit | 9d955bee3c8471ecb2babc63be4794118890af14 (patch) | |
tree | 2e8f72701fe3a4655414b24f75a6c1fffe6ab4f4 /script/core | |
parent | 69c0e4c50101ee29ac1459897495d4c1219bb8c8 (diff) | |
download | lua-language-server-9d955bee3c8471ecb2babc63be4794118890af14.zip |
no longer ignore file names case in Windows
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/code-action.lua | 1 | ||||
-rw-r--r-- | script/core/command/jsonToLua.lua | 2 | ||||
-rw-r--r-- | script/core/completion.lua | 21 | ||||
-rw-r--r-- | script/core/definition.lua | 4 | ||||
-rw-r--r-- | script/core/diagnostics/init.lua | 2 | ||||
-rw-r--r-- | script/core/highlight.lua | 2 | ||||
-rw-r--r-- | script/core/hover/description.lua | 3 | ||||
-rw-r--r-- | script/core/noder.lua | 3 | ||||
-rw-r--r-- | script/core/reference.lua | 6 | ||||
-rw-r--r-- | script/core/rename.lua | 2 | ||||
-rw-r--r-- | script/core/type-definition.lua | 4 | ||||
-rw-r--r-- | script/core/workspace-symbol.lua | 2 |
12 files changed, 21 insertions, 31 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua index c7727487..e5690fe4 100644 --- a/script/core/code-action.lua +++ b/script/core/code-action.lua @@ -397,7 +397,6 @@ local function checkSwapParams(results, uri, start, finish) return a.source.start > b.source.start end) local target = args[1] - uri = files.getOriginUri(uri) local myArg = target.source[target.index] for i, targetArg in ipairs(target.source) do if i ~= target.index then diff --git a/script/core/command/jsonToLua.lua b/script/core/command/jsonToLua.lua index 6b5613b9..c4f001ff 100644 --- a/script/core/command/jsonToLua.lua +++ b/script/core/command/jsonToLua.lua @@ -24,7 +24,7 @@ return function (data) label = 'json to lua', edit = { changes = { - [files.getOriginUri(data.uri)] = { + [data.uri] = { { range = files.range(data.uri, data.start, data.finish), newText = luaStr, diff --git a/script/core/completion.lua b/script/core/completion.lua index f6556233..ba480451 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -255,7 +255,7 @@ local function buildInsertRequire(ast, targetUri, stemName) end local function isSameSource(ast, source, pos) - if not files.eq(guide.getUri(source), guide.getUri(ast.ast)) then + if guide.getUri(source) ~= guide.getUri(ast.ast) then return false end if source.type == 'field' @@ -337,11 +337,10 @@ local function checkModule(ast, word, offset, results) end local locals = guide.getVisibleLocals(ast.ast, offset) for uri in files.eachFile() do - if files.eq(uri, guide.getUri(ast.ast)) then + if uri == guide.getUri(ast.ast) then goto CONTINUE end - local originUri = files.getOriginUri(uri) - local path = furi.decode(originUri) + local path = furi.decode(uri) local fileName = path:match '[^/\\]*$' local stemName = fileName:gsub('%..+', '') if not locals[stemName] @@ -380,7 +379,7 @@ local function checkModule(ast, word, offset, results) arguments = { { uri = guide.getUri(ast.ast), - target = originUri, + target = uri, name = stemName, }, }, @@ -389,8 +388,8 @@ local function checkModule(ast, word, offset, results) return { detail = buildDetail(targetSource), description = lang.script('COMPLETION_IMPORT_FROM', ('[%s](%s)'):format( - workspace.getRelativePath(originUri), - originUri + workspace.getRelativePath(uri), + uri )) .. '\n' .. buildDesc(targetSource), --additionalTextEdits = buildInsertRequire(ast, originUri, stemName), @@ -637,7 +636,7 @@ local function checkCommon(myUri, word, text, offset, results) if #results >= 100 then break end - if myUri and files.eq(myUri, uri) then + if myUri == uri then goto CONTINUE end local words = files.getWordsOfHead(uri, myHead) @@ -886,8 +885,7 @@ local function checkUri(ast, text, offset, results) end if libName == 'require' then for uri in files.eachFile() do - uri = files.getOriginUri(uri) - if files.eq(myUri, uri) then + if myUri == uri then goto CONTINUE end local path = workspace.getRelativePath(uri) @@ -940,8 +938,7 @@ local function checkUri(ast, text, offset, results) elseif libName == 'dofile' or libName == 'loadfile' then for uri in files.eachFile() do - uri = files.getOriginUri(uri) - if files.eq(myUri, uri) then + if myUri == uri then goto CONTINUE end if vm.isMetaFile(uri) then diff --git a/script/core/definition.lua b/script/core/definition.lua index fb74b73a..1693406c 100644 --- a/script/core/definition.lua +++ b/script/core/definition.lua @@ -119,7 +119,7 @@ return function (uri, offset) if uris then for i, uri in ipairs(uris) do results[#results+1] = { - uri = files.getOriginUri(uri), + uri = uri, source = source, target = { start = 0, @@ -170,7 +170,7 @@ return function (uri, offset) results[#results+1] = { target = src, - uri = files.getOriginUri(root.uri), + uri = root.uri, source = source, } ::CONTINUE:: diff --git a/script/core/diagnostics/init.lua b/script/core/diagnostics/init.lua index b44d6a2c..09688f6e 100644 --- a/script/core/diagnostics/init.lua +++ b/script/core/diagnostics/init.lua @@ -57,7 +57,7 @@ local function check(uri, name, results) end, name) local passed = os.clock() - clock if passed >= 0.5 then - log.warn(('Diagnostics [%s] @ [%s] takes [%.3f] sec!'):format(name, files.getOriginUri(uri), passed)) + log.warn(('Diagnostics [%s] @ [%s] takes [%.3f] sec!'):format(name, uri, passed)) end if DIAGTIMES then DIAGTIMES[name] = (DIAGTIMES[name] or 0) + passed diff --git a/script/core/highlight.lua b/script/core/highlight.lua index 8955be69..47b482d5 100644 --- a/script/core/highlight.lua +++ b/script/core/highlight.lua @@ -267,7 +267,7 @@ return function (uri, offset) if isLiteral ~= isLiteralValue(target) then return end - if not files.eq(uri, guide.getUri(target)) then + if uri ~= guide.getUri(target) then return end local kind diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index 5bb86603..b58a08b7 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -31,9 +31,8 @@ local function asStringInRequire(source, literal) local shows = {} for i, uri in ipairs(result) do local searcher = searchers and searchers[uri] - uri = files.getOriginUri(uri) local path = furi.decode(uri) - if files.eq(path:sub(1, #rootPath), rootPath) then + if path:sub(1, #rootPath) == rootPath then path = path:sub(#rootPath + 1) end path = path:gsub('^[/\\]*', '') diff --git a/script/core/noder.lua b/script/core/noder.lua index a63a1c25..70c24c85 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1518,7 +1518,7 @@ function m.compileAllNodes(source) guide.eachSource(root, function (src) m.compileNode(noders, src) end) - log.debug('compileNodes finish:', files.getOriginUri(guide.getUri(root))) + log.debug('compileNodes finish:', guide.getUri(root)) return noders end @@ -1658,7 +1658,6 @@ function m.compileGlobalNodes(root) end files.watch(function (ev, uri) - uri = files.asKey(uri) if ev == 'update' then local state = files.getState(uri) if state then diff --git a/script/core/reference.lua b/script/core/reference.lua index 8f113a8d..5f5831c6 100644 --- a/script/core/reference.lua +++ b/script/core/reference.lua @@ -111,13 +111,9 @@ return function (uri, offset) elseif src.type == 'table' and src.parent.type ~= 'return' then goto CONTINUE end - local ouri = files.getOriginUri(root.uri) - if not ouri then - goto CONTINUE - end results[#results+1] = { target = src, - uri = ouri, + uri = root.uri, } ::CONTINUE:: end diff --git a/script/core/rename.lua b/script/core/rename.lua index d0a0e25f..0ab7a055 100644 --- a/script/core/rename.lua +++ b/script/core/rename.lua @@ -348,7 +348,7 @@ function m.rename(uri, pos, newname) local mark = {} rename(source, newname, function (target, start, finish, text) - local turi = files.getOriginUri(guide.getUri(target)) + local turi = guide.getUri(target) if not turi then return end diff --git a/script/core/type-definition.lua b/script/core/type-definition.lua index 6d45b601..dee07c61 100644 --- a/script/core/type-definition.lua +++ b/script/core/type-definition.lua @@ -120,7 +120,7 @@ return function (uri, offset) if uris then for i, uri in ipairs(uris) do results[#results+1] = { - uri = files.getOriginUri(uri), + uri = uri, source = source, target = { start = 0, @@ -160,7 +160,7 @@ return function (uri, offset) or src.type == 'doc.type.ltable' then results[#results+1] = { target = src, - uri = files.getOriginUri(root.uri), + uri = root.uri, source = source, } end diff --git a/script/core/workspace-symbol.lua b/script/core/workspace-symbol.lua index 18ab1eeb..265a8d92 100644 --- a/script/core/workspace-symbol.lua +++ b/script/core/workspace-symbol.lua @@ -61,7 +61,7 @@ return function (key) local results = {} for uri in files.eachFile() do - searchFile(files.getOriginUri(uri), key, results) + searchFile(uri, key, results) if #results > 1000 then break end |