-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add encapsulate with parentheses (quotes, brackets, braces) function #3414
Comments
Good idea. It shouldn't be that hard to implement :-) |
If I may add something to this request, also enclose selection with brackets, curlies, and quotes, when the corresponding key is pressed. |
Would like to implement this if someone points me to the right direction in the code. |
I would start by studying spyder/spyder/widgets/sourcecode/codeeditor.py Line 2668 in da167e4
That block automatically inserts the closing parenthesis when you type the opening parenthesis in foo( .
Good luck! |
@h4gen Spyder already has quote insertion for selected text in master. If you select text and press the This functionality is now implemented as the first example of an editor extension: https://github.com/spyder-ide/spyder/blob/master/spyder/widgets/sourcecode/extensions/closequotes.py This section does the part you want to do with brackets: spyder/spyder/widgets/sourcecode/extensions/closequotes.py Lines 71 to 78 in da167e4
I think you will want to write an editor extension similar to closequotes extension. See this PR for more info. Sounds like a fun project! |
@ccordoba12 Hope you didn't have anyone particular in mind to fix this one because I had some time today so I wrote a close bracket extension that fixes this. |
No, not at all. Thanks for your help in solving this one! |
Encapsulating parentheses and others
I want to be able to highlight code and press the button for some beginning character like the opening parenthesis, so that the whole highlighted text is surrounded by an opening parenthesis on the left and a closing parenthesis on the right, as an example. Many editors support this kind of behavior and I have gotten used to being able to do this.
What steps will reproduce the problem?
What is the expected output? What do you see instead?
Versions and main components
Dependencies
Please go to the menu entry
Help > Optional Dependencies
(orHelp > Dependencies
), press the buttonCopy to clipboard
and paste the contents below:
IPython >=1.0 : 5.1.0 (OK)
jedi >=0.8.1;<0.9.0: 0.9.0 (NOK)
matplotlib >=1.0 : 1.5.1 (OK)
pandas >=0.13.1 : 0.18.1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
psutil >=0.3 : 4.3.1 (OK)
pyflakes >=0.6.0 : 1.3.0 (OK)
pygments >=1.6 : 2.1.3 (OK)
pylint >=0.25 : None (NOK)
qtconsole >=4.0 : 4.2.1 (OK)
rope >=0.9.2 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.4.1 (OK)
sympy >=0.7.3 : None (NOK)
zmq >=2.1.11 : 15.4.0 (OK)
The text was updated successfully, but these errors were encountered: