[PATCH] Contrib: removed ngxBlock syntax group

OOO othree at gmail.com
Fri Mar 4 03:23:40 UTC 2016


Hi Maxim

The `js` issue is not new. It is an old issue.

Here is an example, please look at line 53:
https://www.flickr.com/photos/othree/25460998766/

Every keywords are highlighted.

My change made `location` and other `ngxDirectiveBlock` are same as other
directive.
So the issue appear on `ngxDirectiveBlock` groups also.
I think I can fix this by highlight regexp (plan to use same color as
string).
But will need more test.
Do you know where I can get samples of complex nginx conf?


The last part you talk about is to detect blocks explicitly.
Actually, the old `ngxBloxk` is a fake block.
It start at beginning of a line `^` and ends at `{` .
So I decide to remove it.

I don't think we really need to detect block.
At lease I don't see real benefit for now.

If we really do detect blocks.
The major advantage is more strict directive definition.
For example:
* server block should not contain server directive
* location block should not place on root level (I even can mark them as
Error)

But nginx conf can include other conf file anywhere(in any block).
So conf files like uwsgi.conf[1] will not have correct syntax highlight.


And last thing is I plan to support lua, brotli and maybe njs module.
So I will send another patch.

[1]:https://github.com/nginx/nginx/blob/master/conf/uwsgi_params




2016-03-04 1:48 GMT+08:00 Maxim Dounin <mdounin at mdounin.ru>:

> Hello!
>
> On Thu, Mar 03, 2016 at 11:21:51PM +0800, OOO wrote:
>
> > More info about this patch.
> >
> > Before the patch
> > https://www.flickr.com/photos/othree/24844596133/
> >
> > After the patch
> > https://www.flickr.com/photos/othree/25471327825/
> >
> > The major difference is the `rewrite ` directives are correct now.
> > Old syntax had wrong syntax on rewrite if following regexp have character
> > `{`.
> > Which have special function in regexp.
>
> Another difference is the "js" string now incorrectly highlited
> now in the regexp location.  That's clearly a regression.
>
> > The easiest way to solve this issue is to remove the `ngxBlock`
> definition.
> >
> > Cons of this patch:
> >
> > Old syntax have some debug feature. (incorrect directive follow by `{}`
> > block will not highlight)
> > New syntax don't have this feature.
> >
> > If want to have both correct syntax and debug feature.
> > Will lead to more complete syntax definition.
> > And will be slower.
>
> I tend to think that explicit detection of blocks is a good
> feature, and it would be wrong to remove it.  Especially as it
> causes other problems.
>
> --
> Maxim Dounin
> http://nginx.org/
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>



-- 
OOO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20160304/2125bd16/attachment.html>


More information about the nginx-devel mailing list