diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-10-22 11:42:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-10-22 11:42:13 +0800 |
commit | 7891bd1f332b6cff17524b97084d1c05144bbf02 (patch) | |
tree | 334b51429d70e43628b112a748eb6c830941011b | |
parent | 55a7ae620430ab1c82043e920e1b26bbd9d273ce (diff) | |
download | lua-language-server-7891bd1f332b6cff17524b97084d1c05144bbf02.zip |
fix #752
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/encoder/init.lua (renamed from script/encoding/init.lua) | 0 | ||||
-rw-r--r-- | script/files.lua | 4 | ||||
-rw-r--r-- | script/library.lua | 4 |
4 files changed, 7 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index 796cc74c..1e6a646c 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ## 2.4.6 * `FIX` [#744](https://github.com/sumneko/lua-language-server/issues/744) * `FIX` [#748](https://github.com/sumneko/lua-language-server/issues/748) +* `FIX` [#752](https://github.com/sumneko/lua-language-server/issues/752) ## 2.4.5 `2021-10-18` diff --git a/script/encoding/init.lua b/script/encoder/init.lua index a8f9a8ac..a8f9a8ac 100644 --- a/script/encoding/init.lua +++ b/script/encoder/init.lua diff --git a/script/files.lua b/script/files.lua index 155a6336..dac23b86 100644 --- a/script/files.lua +++ b/script/files.lua @@ -10,7 +10,7 @@ local util = require 'utility' local guide = require 'parser.guide' local smerger = require 'string-merger' local progress = require "progress" -local encoding = require 'encoding' +local encoder = require 'encoder' ---@class files local m = {} @@ -141,7 +141,7 @@ function m.setText(uri, text, isTrust, instance) end if not isTrust then if config.get 'Lua.runtime.fileEncoding' == 'ansi' then - text = encoding.ansi2utf8(text) + text = encoder.ansi2utf8(text) end end if file.originText == text then diff --git a/script/library.lua b/script/library.lua index 1b074242..ba7dc657 100644 --- a/script/library.lua +++ b/script/library.lua @@ -10,6 +10,7 @@ local define = require "proto.define" local files = require 'files' local await = require 'await' local timer = require 'timer' +local encoder = require 'encoder' local m = {} @@ -235,6 +236,9 @@ local function initBuiltIn() local metaDoc = compileSingleMetaDoc(fsu.loadFile(libPath), metaLang, status) if metaDoc then local outPath = metaPath / libName + if encoding == 'ansi' then + metaDoc = encoder.utf82ansi(metaDoc) + end out:saveFile(libName, metaDoc) m.metaPaths[#m.metaPaths+1] = outPath:string() end |