New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom heads-up display messages / warnings? #124

Open
lynaghk opened this Issue Nov 12, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@lynaghk

lynaghk commented Nov 12, 2018

Hi Bruce, first let me say thanks for all of your work on Figwheel over the years, it's a great tool!

Is it possible to show custom warnings on via the Figwheel heads-up display?

I'm working on a hiccup compiler that forces you to explicitly choose whether you want to pay the performance cost of runtime interpretation.
During macroexpansion it emits a warning when it encounters a form that it can't compile.
Right now I can run:

(binding [*out* *err*]
  (println "Please annotate:" expr))

and have the warning show up in the console running Figwheel, but it'd be even better to have this warning in the heads-up display (showing the code in context, just like with cljs compiler errors/warnings).

I tried patching into that by emitting my own cljs warnings:

(defmethod cljs.analyzer/error-message :foo
  [warning-type info]
  "Foo")

;;during macroexpansion, this is run:
(cljs.analyzer/warning :foo @cljs.env/*compiler* {})

but that didn't work.

Would you be open to Figwheel-main supporting this functionality?
I couldn't figure out what was going on from poking around the code, but would be happy to take a crack at a PR if you think it's in scope and can give me some pointers.
Thanks!

@bhauman

This comment has been minimized.

Owner

bhauman commented Nov 19, 2018

I think if you add a warning you also have to add it to the list of warnings that are being listened for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment