Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

LANG env variable needed for proper Rufo formatting #493

@pmk1c

Description

@pmk1c

Your environment

  • vscode-ruby version: 0.23.0
  • Ruby version: 2.4.6
  • Ruby version manager (if any): asdf
  • VS Code version: 1.35.1
  • Operating System: Fedora Linux
  • Using language server? (eg useLanguageServer is true?) yes

Expected behavior

Formatting Ruby files with rufo as formatter should work if the file contains multibyte utf8 characters like "“”"

Actual behavior

It gives an error:

Format: executing rufo --filename=/path/to/file.rb -x...
[Error - 11:12:15] Request textDocument/formatting failed.
  Message: Request textDocument/formatting failed with message: 
    unable to execute rufo --filename=/path/to/file.rb -x:
    Error: Failed with exit code: 1 - unknown error
  Code: -32603 

When running Rufo with the same arguments in the command line on the file content, it works:

cat /path/to/file.rb | rufo --filename=/path/to/file.rb -x

When running the same command with the LANG env variable unset an error occurs:

LANG= cat /path/to/file.rb | rufo --filename=/path/to/file.rb -x
# Error: ./path/to/file.rb has syntax errors

So the reason seems to be, that the LANG environment variable is not set to something with utf8 support like C.UTF-8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions