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

Support dictionary indexers on nested properties in F# lexer #1482

Merged

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Apr 7, 2020

A dictionary indexer on a nested property currently breaks the F# lexer. This PR adds support for this by popping the :dotted state when a [ is encountered.

This fixes #1480.

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Apr 7, 2020
@pyrmont pyrmont self-assigned this Apr 7, 2020
@pyrmont
Copy link
Contributor Author

pyrmont commented Apr 7, 2020

@mlapierre I have no familiarity with F# and so have implemented what may be an overly naïve fix. What do you think?

@mlapierre
Copy link

@pyrmont Thanks, but unfortunately I have no familiarity with it either! I'll ask the user who reported it to me to take a look 😀

@pyrmont
Copy link
Contributor Author

pyrmont commented Apr 7, 2020

@mlapierre Cheers!

@seanamosw
Copy link

<- Original reporter here

It looks correct to me, but I'm not very familiar with rouge.

The only cases in F# where a [ would appear in the dotted state would be for indexes/keys:

let value = array.[0]
let value = dict.Test.["key"]

@pyrmont pyrmont merged commit 9def927 into rouge-ruby:master Apr 9, 2020
@pyrmont
Copy link
Contributor Author

pyrmont commented Apr 9, 2020

@seanamosw Thanks! Have tested it with an update visual sample and it's now merged in. It will be available in the version 3.18.0 release of Rouge. We're expecting to push that out on Tuesday 14 April. I am not sure when GitLab will decide to upgrade to that so you'll have to check with them about that.

@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Apr 9, 2020
@pyrmont pyrmont deleted the bugfix.f-sharp-dictionary-indexers branch April 9, 2020 08:42
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 21, 2020
…uby#1482)

A dictionary indexer on a nested property currently breaks the F#
lexer. This commit adds support for these indexers by treating the `[`
as a character that triggers the `:dotted` state to be popped.
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

Successfully merging this pull request may close these issues.

F# syntax highlighting breaks on dictionary indexers
3 participants