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

Incorrect issues detected for multiline f-string #1401

Closed
eternal-io opened this issue Jun 6, 2021 · 2 comments
Closed

Incorrect issues detected for multiline f-string #1401

eternal-io opened this issue Jun 6, 2021 · 2 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

@eternal-io
Copy link

Environment data

  • Language Server version: v2021.6.0
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10)

Expected behaviour

Although I know this is not a good code habit, but it can run normally. No errors should be detected.

Actual behaviour

Line | Question
   3 | E: String literal is unterminated
   4 | E: Unterminated expression in f-string; missing close brace
   6 | W: "t_chunks" is not defined
   9 | E: Single close brace not allowed within f-string literal; use double close brace

Code Snippet / Additional information

return f'''<ul class="yhb-lst_t">{
        ''.join(
            map(lambda t_chunks: f"""<li class="_{
                '~x-:+v*'.find(t_chunks[0]) + 1
            }">{
                self.block(t_chunks[1])
            }</li>""", content)
        )
    }</ul>'''
@github-actions github-actions bot added the triage label Jun 6, 2021
@erictraut
Copy link
Contributor

Thanks for reporting the problem. The parser in pylance wasn't properly handling a carriage return within an inner triple-quoted string within a an outer triple-quoted f-string. I've updated the code to handle this situation properly, and the fix will be in the next release of pylance.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Jun 6, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.6.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202161-9-june-2021

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