Spyder: Enable automatic insertion of closing quotes inside function calls

Created on 23 Mar 2018  路  11Comments  路  Source: spyder-ide/spyder

Problem Description

I want the same behaviour as in jupyter notebook of automatic closing of quotes. I change the setting of spyder editor to enable automatic insertion of closing quotes.

It works fine while typing in the editor but does not works inside functions.

Could you help me how to resolve this issue!?

What steps will reproduce the problem?



    1. 2.
  1. 3.

What is the expected output? What do you see instead?

Paste Traceback/Error Below (if applicable)

import numpy as np
import matplotlib.pyplot as plt

a = np.linspace(0,10,2001)
b = np.cos(a*np.pi)

plt.plot(a, b)
plt.title(') # does not work here: only opening quotes

'' # works here: automatically closes the quotes

Package Versions

  • Spyder: 3.2.6
  • Python: 3.6.4
  • Qt:
  • PyQt:
  • Operating System: windows 10

Dependencies

PASTE DEPENDENCIES HERE
Editor Reproduced

Most helpful comment

No but after it's merged I can look at refactoring to make one function work for both extensions

All 11 comments

I can confirm this behavior also occurs on my machine. However, I am not sure if it is intended for some reason, or is just a current limitation of the system. I'd certainly prefer if it worked.

@ccordoba12 ?

I think this happens when there's some text to the right of the quote you're inserting. @Khalilsqu, could you verity it?

@ccordoba12 Yup, that's it. In this case, its the auto-insertion of the closing paren of the function call that blocks it.

@ccordoba12 yes, whenever there is a leading character in the line, the automatic insertion of closing quotes does not work.

@Khalilsqu A leading character? According to my tests and confirming @ccordoba12 's suspicion above, it was the trailing character that was the problem, not the leading one.

Hi, Thanks for all efforts toward releasing spyder 4, I installed the dev version but still have this issue.

That's why this issue is still open.

A fix for this should close the quotes when any closing bracket type or a comma is the next character to the right. A similar functionality is in close brackets.

So is this going to be fixed by your PR too?

No but after it's merged I can look at refactoring to make one function work for both extensions

That'd be really handy, thanks! I can't tell you how many times I forget this, haha.

Was this page helpful?
0 / 5 - 0 ratings