diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-27 16:41:09 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-27 16:41:09 +0800 |
commit | f8c9c70e8693a2471f914d47ed36bbe19c982f0c (patch) | |
tree | 9641f814cfb5a51d8bd06d5e4ed3d59e1070b26f | |
parent | 1de77a38e4ec3ea6cb1a2b2b3045c2c08f4311c0 (diff) | |
download | lua-language-server-f8c9c70e8693a2471f914d47ed36bbe19c982f0c.zip |
#1385
-rw-r--r-- | script/file-uri.lua | 4 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/script/file-uri.lua b/script/file-uri.lua index 88e1111a..f9ede668 100644 --- a/script/file-uri.lua +++ b/script/file-uri.lua @@ -92,6 +92,10 @@ function m.split(uri) return uri:match('([^:]*):/?/?([^/]*)(.*)') end +function m.isValid(uri) + return m.split(uri) ~= nil +end + function m.normalize(uri) if uri == '' then return uri diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 11fe0dfa..973ae9ec 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -45,7 +45,9 @@ end --- 初始化工作区 function m.create(uri) - uri = furi.normalize(uri) + if furi.isValid(uri) then + uri = furi.normalize(uri) + end log.info('Workspace create: ', uri) if uri == furi.encode '/' or uri == furi.encode(os.getenv 'HOME' or '') then |