Author Topic: No automatic closing quote with python f-string  (Read 595 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
No automatic closing quote with python f-string
« on: September 21, 2022, 04:04:42 PM »
I have my config setup so that when I type an opening quote then a close quote is automatically inserted.

This works find in Python when I don't use f-string, for example if I type:

Code: [Select]
print("
Then the closing quote is automatically inserted.

However if I do an f-string, put an f before the ", such as typing:

Code: [Select]
print(f"
Then the close quote is not inserted.

I'm on Linux x64 beta3.

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: No automatic closing quote with python f-string
« Reply #1 on: September 21, 2022, 05:00:03 PM »
I can not reproduce this in a default configuration.  Have you modified your Python color coding options?

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: No automatic closing quote with python f-string
« Reply #2 on: September 21, 2022, 05:10:06 PM »
I just uploaded to support: user.cfg.xml.rob

Hopefully this can answer your questions about my config.

I don't recall changing anything about Python color coding options.

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: No automatic closing quote with python f-string
« Reply #3 on: September 21, 2022, 05:34:20 PM »
Tried that test case with your config and it worked fine.  This must have something to do with the context it is used in.  Is this embedded Python code?  Could you send a larger, complete source file that exhibits the problem?

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: No automatic closing quote with python f-string
« Reply #4 on: September 21, 2022, 05:46:24 PM »
Look for "test_rob.py" on support. Search for REPRODUCE. Follow the instructions there.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: No automatic closing quote with python f-string
« Reply #5 on: September 21, 2022, 05:49:05 PM »
In the same line in my test_rob.py there seems to be another issue. After typing opening quote I'm getting 2 blue lines, such as for dynamic surround. I attached a picture. Maybe it is related to the f string quote problem.

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: No automatic closing quote with python f-string
« Reply #6 on: September 21, 2022, 06:03:26 PM »
OK, I can reproduce the issue when the closing paren is present.

The horizontal lines is a new feature in v27, horizontal dynamic surround.  Document > Python Options... > Auto-Close >
  • Use Horizontal Dynamic Surround



Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: No automatic closing quote with python f-string
« Reply #7 on: September 21, 2022, 06:30:23 PM »
Fixed for Beta4.