spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.25k stars 1.6k forks source link

Add multiline editing to the Editor #2112

Open spyder-bot opened 9 years ago

spyder-bot commented 9 years ago

From geoffrey...@gmail.com on 2015-01-13T04:28:43Z

Is a feature of multi-editing / multi-selection planned?

Basically the idea is to be able to set multiple cursors to edit at different places of the code at the same time.

Link with the ability to select several occurrence of the same word, it can be used as a very quick "find and replace" for instance.

Here an example: http://blog.jetbrains.com/ruby/2014/03/whats-mining-multiple-cursors-and-selection/

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=2112

roobooot commented 5 years ago

I have kept a close eye this for a long time, but it looks still no. Becaues in the pycharm this function has been here for a long time, and its really convenient, I don't wish more people will change IDE for this

DanHickstein commented 5 years ago

I just want to add another vote for implementing this feature. I miss this feature every time that I use Spyder!

grgsolymosi commented 5 years ago

I'd like to use too, as it is not so convenient changing to VScode and back to my favorite IDE. VScode is the side-effect of Spyder3 by me. So I'm giving the millionth up for the column editing feature.

JustinClarkHydrologist commented 5 years ago

I need this tool. I use Atom Text Editor (sublime-block-comment 0.5.1) or TextPad (Block Select Mode) to get to this option. The two implementations are quite different and I use them for different tasks.

Please help me get this option into Spyder, the future of hydrology may depend on it. I was being a bit hyperbolic, but water scientists will use this if we can get it going.

MAFiA303 commented 5 years ago

never forget multiline editing tool!

brupelo commented 5 years ago

Never tested spider and the only I know about it is that is a well-respected project in the python community, maybe you guys could be interested in a project i've uploaded right now to github? I call it pyblime. Right now it's not usable, only supports windows and it needs a lot of work to make it production ready 😂. Maybe anyone here want to contribute to it? Ty in advance 😋.... Oh. I forgot, it gives basic support for multiselection... The idea is this widget will become as powerful as sublime views hehe

OverLordGoldDragon commented 5 years ago

+1, looking forward to it - excellent timesaver

brupelo commented 5 years ago

Well, after wasting 1 whole day I've been able to generate the dependency to (theorically) run the widget on linux+python3.6... In case you're interested to try here's the doc.

That said, the idea is this widget will be a drop-in widget that you should plug-in easily in tools like Spider or similars... I've got a bunch of 3d tools I'll be using it myself...

As I said, I need people who share the passion with the idea so we'll be able to make it production-ready faster as right now it's just a simple prototype :) . On the other hand, it's funny... cos this thread has been opened forever and I don't see you guys have implemented multiple cursors in all this time lol xDD

Cheers!

brupelo commented 5 years ago

For those who may be interested on this widget... the pyblime project is already living in PyPi, you just need to:

Have fun!

ccordoba12 commented 5 years ago

@brupelo, I'm sorry but our editor is tightly integrated with our other components, so there's no chance for us to use your project.

brupelo commented 5 years ago

@ccordoba12 Ok Carlos, gracias por hacĂ©rmelo saber, claro, ningĂșn problema. Simplemente pensĂ© que podrĂ­a haber sido interesante para vosotros desacoplar esa parte de Spyder, buena suerte con el proyecto de todas formas, saludos!

ccordoba12 commented 5 years ago

@brupelo, thanks for understanding. This could have been possible 6 years ago, but right now there's no way to do it.

brupelo commented 5 years ago

So, here is a proof of concept

It is doable but it is a bit hackish:

  • Basically we keep track of the main and the additional cursors (here entered by Ctrl+MouseClick for convenience)
  • We make the main cursor invisible
  • We set a timer and draw the main cursor (ourselves) plus any other stored additional cursor to ensure proper blinking sync
  • Any keys collected in the keyPressEvent are forwarded to all cursors (if any).

@goanpeca Hi! For the past weeks I've been exploring the idea of transforming a QScintilla component into a SublimeText widget but at this point I'm not sure that's the best idea in the long term, so right now I was considering to implement a new editor from scratch where I'd inherit from QPlainTextEdit, the first feature I'd like to sort out is the ability of having multiple cursors/selections. I'd like to implement correctly so it'd behave exactly like SublimeText/CodeMirror et al 1:1.

Thing is, I've been toying with setExtraSelections but it seems that function won't draw any extra blinking cursors, just static selections. When you'd experimented with it (I've seen your old proof of concept video... there is no code available anywhere?), which point had you reached? Had you solved the problem completely? If that's the case, any place where I could take look at your experiment?

One important thing to me when implementing this feature is the ability that when undoing/redoing the selections will be shown correctly (like ST).

Also... with Sublime you've got the ability to not have selections at all, just try this on the ST console:

view.sel().clear()
len(view.sel())

and you'll see as the number of selections is 0 . With QScintilla this was just not possible as there is this strange limitation of having always the so called "Main selection", really strange concept... although it makes sense as that component wasn't created with the idea of "multiple selections" from the very beginning and then the author just added this as feature... but it hasn't been properly implemented (some sort of workaround)

Anyway, please let me know more about this interested subject as I'm extremely interested myself to know how to implement properly this essential feature.

Thanks in advance!

MulesNose commented 4 years ago

Hi! Is this feature included in the recent Spyder 4.0.0 general release?

goanpeca commented 4 years ago

Hi! Is this feature included in the recent Spyder 4.0.0 general release?

No, it is not.

MulesNose commented 4 years ago

Hi! Is this feature included in the recent Spyder 4.0.0 general release?

No, it is not.

Bummer, that would be a great one to have! However, really enjoying a lot of the new features in 4.0!

ccordoba12 commented 4 years ago

This is top in our list of priorities for Spyder 5, to be released next year.

ical10 commented 4 years ago

This is top in our list of priorities for Spyder 5, to be released next year.

@ccordoba12 Do you have a release date already for Spyder 5 ? Would love to have this feature as well, I've only found this in VSCode for now!

ccordoba12 commented 4 years ago

Do you have a release date already for Spyder 5 ?

End of 2020 or first half of 2021

hezy commented 4 years ago

This thread is now 5 years old :)

goanpeca commented 4 years ago

It is, that does not mean we are not working on it. We are a small team with limited resources and we need to prioritize the work that gets done @hezy. I created a POC some years ago but never got around to actually implementing it.

Would you be interested in giving us a hand?

Cheers!

leos313 commented 4 years ago

When the implementation exists, please report the new feature to the community using also StackOverflow (for example here ). I was not aware of this discussion. However, it is a really useful feature

GitHunter0 commented 4 years ago

From ccordoba12 on 2015-01-13T04:31:20Z

Nop, it hasn't been considered so far. It seems cool but I don't know how hard it will be to implement it.

Summary: Add multiline editing to the Editor (was: Feature Request) Labels: Cat-Editor

RStudio has this feature for R. It uses the shortcut Ctrl+Alt+Mouse Click or Up or Down Arrow. It could serve as a reference. It would be a great feature indeed.

Thank you for the great work in Spyder so far.

TarAlacrin commented 4 years ago

This can't come sooner. Column select is one of those things that is so useful when you need it, and now that I'm used to using it from visual studio community, it makes using other editors rough.

Spyder is otherwise awesome though, absolutely fantastic work. (when you do add column select please implement it like visual studio proper and Notepad++ do, I'm not as much of a fan of vscode's implementation. It feels slower and overdesigned 90% of the time compared to the other solutions out there)

danuker commented 4 years ago

Column select

Have you not seen multiple cursors? It is much more useful than fixed-column selection.

https://github.com/spyder-ide/spyder/issues/2112#issuecomment-184377301

grgsolymosi commented 4 years ago

@danuker Why you downvoted @TarAlacrin "columnselect" lays on the same basis like "multiply cursor".

danuker commented 4 years ago

@matthewmav I don't like column select mentioned by @TarAlacrin because:

  1. I do not find column selection useful, for anything other than perfectly aligned text or ASCII art
  2. The original request here says "multiple cursors at different places of the code"; this does not sound like one vertical cursor like column select

I would love to place cursors ANYWHERE. See my message above.

cliffckerr commented 3 years ago

As an avid supporter of and heavy user of Spyder, I wanted to say thanks for your hard work on this and on the 5.0 release! Just wanted to comment that my current workflow requires opening Sublime every few minutes to make a multiline edit, so personally this feature is far and away No. 1 on my wishlist for Spyder features :)

brupelo commented 3 years ago

I'm not involved in this project but from what I've seen I think is pretty amazing.

One thing I'm really interested in is how this feature is evolving over time, why? Because you won't see many qt/pyqt projects out there having proper multiline edit. When I say "proper" I really mean it... for instance, Scintilla/QScintilla... when you delete/cut blocks of text the multiselections these will be lost in the ether. But if do the same on editors such as vscode/atom/sublime... the multiple selections will be preserved properly when undoing/redoing and that's really unvaluable. But I guess achieving that level of quality is difficult to reach though.

With that said, this PR is pretty amazing https://github.com/spyder-ide/spyder/pull/4987/files !

hyamanieu commented 3 years ago

I can also say I tried to switch to VS Code or Jupyter Lab (which both have this function), but Spyder feels like home when it gets down to software developing. I was thinking GitHub sponsoring could be linked with issues, so that we vote with money, because I'm willing to give money to have this function implemented. I know Spyder uses opencollective rather than github sponsors.

cliffckerr commented 3 years ago

@hyamanieu I think think it's a balance between providing useful information on which features are highest priority from the community perspective, vs. letting the Spyder developers prioritize features in a way that makes the most sense for them and for the project. But I encourage you to donate anyway, since more resources could help accelerate all timelines :) (Disclosure: I've donated.) https://opencollective.com/spyder

hyamanieu commented 3 years ago

I did that and I encourage others to do it as well. But we're digressing.

Firestar-Reimu commented 3 years ago

This has been asked many times in the past and we'll try to implement in Spyder 6, to be released next year.

Do you have any idea about using Ctrl or Alt for multi cursor, or we should give a choice?

ccordoba12 commented 3 years ago

@1900011604, I don't understand what you mean.

Firestar-Reimu commented 3 years ago

@1900011604, I don't understand what you mean.

I mean choice like this: https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier

sergiokapone commented 2 years ago

Has Spyder 5.1.5 a multi cursor support now?

Firestar-Reimu commented 2 years ago

Has Spyder 5.1.5 a multi cursor support now?

Sorry, no

sanjiv856 commented 2 years ago

Is multi cursor support available in Spyder version 5.2.2?

FreyGeospatial commented 2 years ago

Just adding here, that I along with everyone else think that it would be great to have multi-cursor support! CTRL-ALT would be a great key combination, like in RStudio.

NicholasJudge commented 1 year ago

I was quite excited to get going w/ Spyder, but I see there still is no simple hotkey for multiline editing? that seems like too basic functionality to not be included, though. Am I missing something?

Firestar-Reimu commented 1 year ago

Same here on Spyder 5.3.2 installed via https://archlinux.org/packages/community/any/spyder/

ccordoba12 commented 1 year ago

@NicholasJudge and @Firestar-Reimu, sorry but this is hard to implement and it won't come soon (at least one year because we're quite busy with other things).

OverLordGoldDragon commented 11 months ago

Just noting that, in another editor, multi-line editing is somewhat slower than in Notepad++, and that bothers me enough to just not use it there and instead paste into N++.

With AutoHotKey, I press Ctrl + 3 to open N++ when needed - paste there, edit there, then paste back into Spyder. Personally I'm fully content with this workaround. For reference, here's the script to accomplish that (can use any other hotkey combo) - see full script at bottom:

^3::
Run "C:\Program Files\Notepad++\notepad++.exe"
return

Pressing Ctrl + 3 when N++ is already open will bring up the N++ window if it's minimized, so it's very quick.

(So if it's so hard to do in Spyder, maybe it won't be as good as in N++, and users who are expecting it may not like it as much, and are better off accustoming with alternatives.)

full script ```ahk #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #InstallKeybdHook ^3:: Run "C:\Program Files\Notepad++\notepad++.exe" return ```
yashpundir commented 7 months ago

Hi, just wanted to get an update on the multiline select feature. Do the devs have this feature on their priority list now? Spyder is amazing though ❀ Thanks Regards

ccordoba12 commented 7 months ago

Hey @yashpundir, thanks for your kind words. Unfortunately, we haven't had time to work on this because it's very tricky and we've been busy with other things, sorry.

Firestar-Reimu commented 3 weeks ago

It seems that 6.0.0 still do not have this feature, if it has, how to toggle it?

ccordoba12 commented 3 weeks ago

Sorry, this is not available yet. We'll try to implement it for 6.2 (most work for 6.1 is already planned).