Giter Club home page Giter Club logo

Comments (8)

bew avatar bew commented on September 20, 2024 1

Thanks! The change looks good, I'll check later today on my computer

from vim-crystal.

bew avatar bew commented on September 20, 2024 1

It works well 👌

from vim-crystal.

rhysd avatar rhysd commented on September 20, 2024

I guess you assume crystal-lang/crystal repository. bin/crystal is a wrapper script, not a crystal command itself. So g:crystal_compiler_command does not consider it. Actual built binary is put at .build/crystal so please use it rather than the wrapper script.

from vim-crystal.

bew avatar bew commented on September 20, 2024

So g:crystal_compiler_command does not consider it.

It actually works, it's just that stderr (with the stdlib message) is also inserted on the top of the formatted file.


Thanks for answering, I know it's a wrapper, it uses the built crystal when available or fallback to system install of crystal.
It also sets a few environments variables for me and points to the correct stdlib (not the system's).

So to have all of that, I'd have to write another wrapper script similar to bin/crystal that doesn't print anything to stderr.

I was thinking about an alternative that I think is more generic: ignore stderr for :CrystalFormat (and maybe display it if the command ends with a non-zero status).

What do you think?

from vim-crystal.

rhysd avatar rhysd commented on September 20, 2024

Since the message is output to stdout, I think it is intended that formatter does not work. The crystal tool format command outputs formatted code to stdout. So there is a conflict between bin/crystal and crystal tool format, meant that vim-crystal has nothing to do with.

I think it's the best way to improve the build/crystal script. For example: Add $BIN_CRYSTAL_SUPPRESS_WARNING environment variable and suppress the warning message when it is set. Modification would be easy so you'd be able to quickly propose it by making a PR. Referring this issue would be useful to explain why it is necessary.

from vim-crystal.

bew avatar bew commented on September 20, 2024

I just checked, the message is output to stderr, as you can see in this little example:
cr_format

from vim-crystal.

rhysd avatar rhysd commented on September 20, 2024

Oh, you're correct.

https://github.com/crystal-lang/crystal/blob/81f728bdead9f43c19561b09ef77386c5fccdf21/bin/crystal#L129

I think we can redirect stderr to suppress it.

from vim-crystal.

rhysd avatar rhysd commented on September 20, 2024

If you have time, would you try f87af4e? stderr now should be redirected to /dev/null (or nul on Windows) so this issue should be fixed

from vim-crystal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.