Closed EvanCox14 closed 2 years ago
Currently I have no way to support utf-16 (when you open the file with VSCode, VSCode will convert it to utf-8 and send it to me). You can first set Lua.workspace.maxPreload
to 0 to prevent pre-reading lua files in the workspace.
Is there anything that I could do to investigate the issue and work towards a resolution on my own? If it were possible, where in the code would I start looking to make changes?
I appreciate the tip about setting maxPreload to 0 to avoid the errors. I may try that. But I think I would lose many of the features I chose this extension for, since there are many files that set many global values.
You can refer to here. The main problem is that I don't have the utf16 encoding conversion library used by Lua.
Thanks! I'll look into this tomorrow.
I see now how difficult this task is. Dealing with file encodings is a lot of trouble. I see c++ methods in the bee submodule for converting between ansi, wide strings, and unicode. From my research, I think wide strings may be utf-16 in some cases. If it were possible, I think the simplest way to do it might be to bind those methods into Lua and call them for utf-16 conversion. Though I doubt the work would be as simple as I describe it.
You may open a PR
Describe the bug When parsing files in UTF-16, the syntax checker outputs hundreds of errors for "unexpected symbol" and "unexpected \<exp>" for a simple 20 line file. But once these files are opened directly, the errors disappear. But as soon as the checker reruns on the entire workspace, they all reappear for any file that is not open. In a workspace with over 1000 Lua files in UTF-16 (many of which are translation files), I get over 500K+ errors. It's entirely unmanageable to sift through the problems and find real errors.
To Reproduce
Expected behavior It would be desirable if the problems never appeared if they disappear after being directly opened.
Screenshots After closing and reopening the workspace:
After opening the utf16 file:
Environment
Additional context I cannot change the encoding of the files in my project because the Lua files are part of the game files that I cannot and should not change on my machine. I am trying to use this extension to help me write a mod for the game "Forts." Forts uses a variant of Lua called "LuaPlus" which adds a custom value type called "Wide Character Strings." http://wwhiz.com/LuaPlus/LuaPlus.html#WideCharacterStrings
Provide logs Log of the reproduction test case on my machine: lua_test.log