crystal-lang-tools / emacs-crystal-mode

A minimal crystal mode for emacs, based on ruby-mode.
https://melpa.org/#/crystal-mode
GNU General Public License v3.0
47 stars 19 forks source link

Using flycheck-crystal in practice #25

Open hinrik opened 5 years ago

hinrik commented 5 years ago

How do you generally use flycheck-crystal? I find that it's basically useless for lots of perfectly fine code because compiling the source file you're editing on its own can give errors about missing namespaces or namespaces that are incorrectly loaded as modules when they should be classes.

This is not an issue for real-world compilation as the compilation targets (such as bin/something or spec/something_test.cr) usually follow a pattern of calling a main module/class file (e.g. src/something.cr) which loads everything and does so in the correct order.

I thought about extending the call to flycheck-define-checker to also compile spec/spec_helper.cr if it exists, but that's not so clean since a lot of projects use it to set up mocks and other things.

yxhuvud commented 5 years ago

This is the same problem https://github.com/crystal-lang-tools/emacs-crystal-mode/pull/18 would fix and also the same issue that #20 report.

Please have a look at the discussion in #18 and if you have any ideas of how to move forward, please add your suggestion (or fix!) in the thread.