an-sh / flow-minor-mode

Emacs minor mode for editing flowtype files.
BSD 3-Clause "New" or "Revised" License
47 stars 16 forks source link

Colorize type-at-pos #6

Closed jdelStrother closed 6 years ago

jdelStrother commented 7 years ago

Hi there, I've found colorizing the output from type-at-pos can make things a lot more readable - eg:

image

WDYT to this approach?


(Update: For reference, my old approach using web-mode highlighting was here: https://github.com/an-sh/flow-minor-mode/compare/master...jdelStrother:colorize-type-web-mode . I've since updated this branch to remove the web-mode dependency.)

an-sh commented 7 years ago

Hello, looks definitely better, but requiring a big mode just for a single(?) syntax highlighting regexp is an overkill and doesn't feel right in terms of Emacs packaging system (at least as how i see it). Is it problematic to extract just types syntax colorizing from web-mode?

jdelStrother commented 7 years ago

I think that might be beyond my limited elisp skills. I was hoping to get away with it given it's an optional dependency - it should just fall back to plain text if web-mode isn't installed.

jdelStrother commented 7 years ago

FWIW I tweaked the original approach - it still relies on the web-mode package being installed, but sets up the bare minimum of font-lock variables rather than invoking (web-mode), so is quite a bit faster.

jdelStrother commented 7 years ago

Can I do anything to help get this merged?

jdelStrother commented 7 years ago

Thinking about it, I think the syntax we need to deal with is actually very limited. We might be able to get away with something as simple as this 888388b21b4a8aee2a92ec351979102c5ab50c0d, where I've removed the web-mode dependency entirely.

I'm going to try running with this for a week or so and see if I find any glaring syntax omissions.

jdelStrother commented 6 years ago

FWIW this has been working pretty well for me for locally.