Skip to content
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

file font-locked as built-in in a value position #44

Open
bbatsov opened this issue Apr 14, 2014 · 2 comments
Open

file font-locked as built-in in a value position #44

bbatsov opened this issue Apr 14, 2014 · 2 comments

Comments

@bbatsov
Copy link
Contributor

bbatsov commented Apr 14, 2014

Consider this:

file {'test':
  ensure  => file,
  content => 'test'
}

file in ensure => file gets font-locked as a built-in (I guess it's confused with the file built-in function), but it shouldn't.

@swsnr
Copy link
Contributor

swsnr commented Apr 14, 2014

@bbatsov We have a number of similar problems with function names or keywords appearing in resource parameters.

I don't think that we can reasonably solve these without bloating our font-lock keywords with restrictions on keywords (e.g. name followed by parenthesis), or making a great effort to turn our font lock keywords into some stateful analyser that takes the context into account.

At best, we could go through the list of all builtin functions again, compile a list of all rvalue functions, and change our keywords to require a subsequent parenthesis for all of these functions. That's not particularly difficult and would fix this problem, but given that there are about 50 built-in functions, it'd take a bit of time, and it's a boring task.

So, is it worth the effort?

@swsnr swsnr added bug labels Apr 14, 2014
@bbatsov
Copy link
Contributor Author

bbatsov commented Apr 14, 2014

We use more or less the same technique (checking if function names are followed by params if they require any) in ruby-mode to differentiate between some built-in methods and regular variable names. While not terribly important I guess it should be done at some point or another.

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

No branches or pull requests

2 participants