summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md1
-rw-r--r--script/encoder/init.lua (renamed from script/encoding/init.lua)0
-rw-r--r--script/files.lua4
-rw-r--r--script/library.lua4
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