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

Using with Rainbow Parentheses? #52

Open
Fryie opened this issue Aug 7, 2015 · 4 comments
Open

Using with Rainbow Parentheses? #52

Fryie opened this issue Aug 7, 2015 · 4 comments

Comments

@Fryie
Copy link

Fryie commented Aug 7, 2015

Hi is there any way to make this plug in to work with Rainbow Parentheses (that plugin basically colors different pairs of parentheses differently. It's admittedly more useful in lisps, but still nice for JS)? Right now, YAJS highlighting seems to override it.

@ohcibi
Copy link

ohcibi commented Aug 17, 2015

I'm using the plugin from @luochen1990 which is more up-to date than the one from @kien. It works nice but the colors are still "a bit" broken. It seems like all parens, brackets and braces are coloured a rightish way except for function-call parenthesis

Those all work:

{{{}}}
[[[]]]
((()))
function(((()))) {{{}}}
if ((())) {{{}}}

Function definitions inside object literals are actually special. I'd say it is better if they are rainbow'ed completely but the current behaviour is kinda reasonable:

var obj = {               // those will have
    method: function() {  // the same color
    }
}

Completely broken however are function calls (as opposed to definitions) and object literals itself:

callAFunction((())) // here all parens are black (the group's name is 'javascriptParens')
var obj = {{{}}} // here all braces have the same color (the group's name is 'javascriptBraces')

The last ones are important to fix imo. I find it reasonable to highlight the parens that enclose the parameters of a function call in a special way as I do for object literals but the highlighting of the parens/braces in deeper levels should not be touched.

Maybe this can be fixed from the other side by just bumping up the priority of the rules. I'm not sure how vim decides which rule gets used when two rules match the same syntax.....

@othree
Copy link
Owner

othree commented Aug 17, 2015

@Fryie Sorry I don't think yajs can work well with Rainbow Parentheses. Because I have full control on almost every nesting scopes. Which causes regexp rule of rainbow parentheses not working.

@ohcibi
Copy link

ohcibi commented Aug 18, 2015

@othree yajs does actually work kinda well with rainbow-parenthesis (at least with the plugin I am using). Its just that for object literals and function calls you should only take control over the outermost pair of parens/braces in aCall((())) or var object = {{{}}}. Isn't this possible? If yes, compatibility would be fine.

@Fryie
Copy link
Author

Fryie commented Aug 18, 2015

@ohcibi thanks, I'll try the improved version out.

Thanks to you two for looking into this :)

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

No branches or pull requests

3 participants