microsoft / vscode-powerquery

Visual Studio Code extension for Power Query / M.
MIT License
88 stars 18 forks source link

field access generalized identifiers highlight as seperate tokens #66

Open ninmonkey opened 4 years ago

ninmonkey commented 4 years ago

Summary

This is minor: field access without quoted-identifiers highlight as separate tokens. ex: The textmate scope of in in [Records in Range] is a language keyword

image

I wasn't sure whether this is at the extension level or microsoft/powerquery-parser I put it here because even though textmate's scope is a keyword -- the parser seems to format correctly. I tried using a strange generalized-identifier to see if I could break the formatting, but it did not.

record textmate scopes

Power BI's editor has the same behaviour

image

Test Query

let
    Source = ...,
    #"Total Records1" = Table.AddColumn(
        Source, "Count 1",
        each Table.RowCount( [#"Records in Range"] ),
        type number
    ),
    #"Total Records2" = Table.AddColumn(
        Source, "Count 2",
        each Table.RowCount( [Records in Range] ),
        type number
    )

in
    #"Total Records2"
## I think this is the grammar involved (Expand) . ![image](https://user-images.githubusercontent.com/3892031/100388383-08217900-2ff0-11eb-9c07-496cb2ffc166.png)
mattmasson commented 3 years ago

Yeah, this is an issue with our grammar file. In theory we could resolve it by enabling semantic highlighting via the powerquery-parser, but it should be pretty straightforward to resolve.

FWIW, we do have a separate github project for the language grammar (that has fallen out of date), but it does have some built in tests. I've been meaning to get it running again, but if anyone else wants to pick that up, please feel free :)

powerquery-language

/@JordanBoltonMN as FYI

ninmonkey commented 3 years ago

@mattmasson Which project is that?

JordanBoltonMN commented 3 years ago

@mattmasson Which project is that?

https://github.com/microsoft/powerquery-language