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

Issue with variant selection in f-strings. #263

Closed
flaree opened this issue Aug 20, 2020 · 4 comments
Closed

Issue with variant selection in f-strings. #263

flaree opened this issue Aug 20, 2020 · 4 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@flaree
Copy link

flaree commented Aug 20, 2020

Environment data

  • Language Server version: Pylance language server 2020.8.0
  • OS and version: Win 10 - 2004, 20175.1000
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.5

Expected behaviour

Correctly identify the variant selector following a unicode emoji in an f-string.

Actual behaviour

Raises a warning stating unexpected token and "VARIATION" is not defined.

Code Snippet / Additional information

variable = f"\N{BLACK QUESTION MARK ORNAMENT}\N{VARIATION SELECTOR-16}"

This is pretty much what produced the output below.

☔️TwinMediumforestgreenGerbil🐊

@erictraut
Copy link
Contributor

I didn't realize that "-" was an allowed character in a "\N" escape. The Python spec on lexical analysis is vague about what it accepts here. It simply says:

\N{name} : Character named name in the Unicode database

Do you happen to know if there are other characters besides a-zA-Z0-9 and "-" within a Unicode name?

@erictraut erictraut added the bug Something isn't working label Aug 20, 2020
@github-actions github-actions bot removed the triage label Aug 20, 2020
@flaree
Copy link
Author

flaree commented Aug 20, 2020

I haven't had any other warning/error occur apart from this specific one.

@erictraut
Copy link
Contributor

Thanks again for reporting this. I've introduced a fix, and it will be included in an upcoming version of Pylance. I don't know if it will make it into this week's build.

@erictraut erictraut added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Aug 20, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.8.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202082-20-august-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants