voxpupuli / puppet-mode

Edit Puppet manifests with GNU Emacs 24
https://github.com/voxpupuli/puppet-mode
GNU General Public License v3.0
90 stars 60 forks source link

Font-lock facts and built-in variables #47

Open bbatsov opened 10 years ago

bbatsov commented 10 years ago

I think it would be great if we font-locked facts and built-in variables differently from user-defined variables to highlight their special status. A list of them is available here. In ruby-mode we use font-lock-builtin-face for those, although I guess we can introduce a different face in puppet-mode.

They'll also be a great candidate for completion when we get to the completion-at-point-functions support.

swsnr commented 10 years ago

We can add a list of all built-in facts, but it's going to be huge, and how should we deal with variable facts, e.g. ipaddress_eth0?

For completion, I'd not rely upon a built-in list of facts, but rather parse the output of facter.

bbatsov commented 10 years ago

The problem is that if you have a master/server setup it's unlikely that you'll have facter installed locally.

If you think this list is huge I guess you haven't seen the built-in lists in ruby-mode and clojure-mode. :-)

swsnr commented 10 years ago

@bbatsov I don't think that we'll be able to re-use the list compiled for fontification for completion. Fontification must use regular expressions to deal with variable fact names (e.g. ipaddress_.+), but we can't complete with such expressions.

bbatsov commented 10 years ago

I think we can generate the regexp from the list of built-in vars/facts and use the list itself as a completion source.

swsnr commented 10 years ago

@bbatsov Sounds good. I'll look into it.