question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Outermost function when using $ operator isn't parsed as a function

See original GitHub issue

When I have multiple functions chained together using the $ operator, the outermost function doesn’t get highlighted as a function.

The problem

Here is my code:

exactMatches :: Code -> Code -> Int
exactMatches actualPegs guessPegs =
    length $ filter foundMatch $ zip actualPegs guessPegs where
        foundMatch :: (Peg, Peg) -> Bool
        foundMatch (actual, guess) = actual == guess

Here is what it looks like with the onedark.nvim colorscheme in neovim: image The outermost function, length, is not highlighted the same color as the functions filter and zip. So, I suspect that tree-sitter isn’t parsing it as a function.

Expected behavior

I expected length to be highlighted the same color as other functions. When I use parentheses instead, length is highlighted correctly. image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tekcommented, Jul 1, 2022

I guess it would make sense to synchronize the queries from nivim-treesitter…go ahead if you like!

1reaction
tekcommented, Jun 23, 2022

yep!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arrow function expressions - JavaScript - MDN Web Docs
Although the arrow in an arrow function is not an operator, arrow functions have special parsing rules that interact differently with ...
Read more >
Identify outermost call to recursive parser - Stack Overflow
When the top level is parsed, there is no higher level to set it to "not the outermost", so it remains at "I...
Read more >
XPath and XQuery Functions and Operators 3.1 - W3C
These functions and operators are defined for use in [XML Path Language (XPath) 3.1] and [XQuery 3.1: An XML Query Language] and [XSL ......
Read more >
Rest parameters and spread syntax
A function can be called with any number of arguments, no matter how it is defined. Like here: function ...
Read more >
Functions, operators, and conditionals in Google Standard SQL
Removes the outermost quotes and unescapes the values. ... not comply with RFC 3986 formatting, this function makes a best effort to parse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found