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 Python f-string #69

Open
Jeromearsene opened this issue Jun 23, 2022 · 5 comments
Open

Support Python f-string #69

Jeromearsene opened this issue Jun 23, 2022 · 5 comments
Assignees

Comments

@Jeromearsene
Copy link

It's impossible to parse Python f-strings for the moment:


Capture d’écran 2022-06-23 à 09 42 43


Capture d’écran 2022-06-23 à 09 43 15

It would be very practical to add this possibility 🙏

@barklan
Copy link
Owner

barklan commented Jun 23, 2022

Added syntax highlighting for multi-line f-strings in 2.14

@Jeromearsene
Copy link
Author

Sorry, but I don't understand how it works. I tried with your Python example but got this result:
Capture d’écran 2022-06-23 à 15 41 15

So, I conclude that doesn't work.

You explain here never to do that. Ok, this is not a good practice. But should we understand that it is impossible with your lib ?

Thanks for explanations

@barklan barklan reopened this Jun 23, 2022
@barklan
Copy link
Owner

barklan commented Jun 23, 2022

But should we understand that it is impossible with your lib ?

No, it's not my place to "punish" people for something that might be unsafe. And there is no indication of unsanitized input here.
The last two strings in your screenshot work for me. Not sure yet why they don't work for you.

Screenshot_20220623_184006

I also prematurely closed it without adding support for single-line f-strings) Will add later.

The only string that does not work by design (so far) is this one:

multiline_without_marker = f"""
    SELECT * FROM {table_name};
"""

I've open separate issue for queries like this one: #78. Thanks for your input.

@barklan barklan self-assigned this Jun 23, 2022
@Jeromearsene
Copy link
Author

With your last version it's good !
Capture d’écran 2022-06-24 à 10 11 08

Before update:
Capture d’écran 2022-06-24 à 10 08 07

@torzsmokus
Copy link

I also prematurely closed it without adding support for single-line f-strings) Will add later.

As far as I can tell, single-line f-strings are still not supported :(

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

No branches or pull requests

3 participants