Coder Social home page Coder Social logo

Comments (3)

JordanBoltonMN avatar JordanBoltonMN commented on May 22, 2024

Take a look at the formal spec for identifier:

identifier:
    regular-identifier
    quoted-identifier

regular-identifier:
    available-identifier
    available-identifier dot-character regular-identifier

In short an identifier can't end with a period. The lexer reads available-identifier, then optionally reads . followed by available-identifier.

from powerquery-parser.

mattmasson avatar mattmasson commented on May 22, 2024

Ahhh - this likely explains why the Grammar treats Access.Database as one token, and Access. as two tokens. That creates an annoyance for intellisense purposes, though. I can't think of a case where you'd want . to be treated as a separate word/token.

I could fix this on the grammar side by treating . as a valid identifier char, but I was hoping to always rely on the positions returned by the parser code. (It would also break once VS Code allows us to stop using the grammar entirely).

Any suggestions on how to resolve?

I guess we could solve this within the intellisense code itself... if we find the last char is ., we adjust the current word position to include the previous identifier as well.

from powerquery-parser.

JordanBoltonMN avatar JordanBoltonMN commented on May 22, 2024

As far as I know there's no situation where an identifier followed by a dot isn't intended to be an identifier. I see two main options:

  • Handle it in the Intellisense code
  • Add an optional flag on how to tokenize identifiers (eg. Strict vs Intellisense)

Adding an additional flag would more tightly couple the parser's code with the VSCode extension, which is something I'd like to avoid if possible. That said if it's not easy to implement the fix in the Intellisense code and/or it requires a hacky solution then I'd prefer a flag over code separation ideology.

from powerquery-parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.