LuaLS / LuaLS/lua-language-server

Generated doc JSON is invalid utf-8

Open
#2,983 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows WSL

What is the issue affecting?

Other

Expected Behaviour

JSON document output from --doc is standard utf-8 encoding.

Actual Behaviour

When trying to parse the JSON with our site builder, Ruby fails with:

jekyll 3.9.3 | Error:  (/home/rhys/spring/doc/site/_data/doc.json): invalid leading UTF-8 octet at line 1 column 1
/usr/share/rvm/rubies/ruby-3.2.3/lib/ruby/3.2.0/psych/parser.rb:62:in `_native_parse': (/home/rhys/spring/doc/site/_data/doc.json): invalid leading UTF-8 octet at line 1 column 1 (Psych::SyntaxError)
        from /usr/share/rvm/rubies/ruby-3.2.3/lib/ruby/3.2.0/psych/parser.rb:62:in `parse'
        from /usr/share/rvm/gems/ruby-3.2.3/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:143:in `load'

Opening the file in VSCode suggests that it is indeed utf-8, but clicking UTF-8 in the footer and then "Save with encoding > UTF-8" reserializes the file and the parser error is cleared.

Sorry I'm not more specific with the error, I don't know a great deal about file formats.

Reproduction steps
  1. Export docs
  2. Somehow check if they are properly encoded?
Additional Notes

No response

Log File

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the documentation export entry point invoked by --doc, then reproduce the export and inspect the first bytes of the generated JSON. The issue is done when the exported document parses successfully as standard UTF-8 in the reported Ruby/Jekyll site builder.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.