spyder icon indicating copy to clipboard operation
spyder copied to clipboard

Bookmarks for Spyder Editor

Open spyder-bot opened this issue 10 years ago • 33 comments

From [email protected] on 2012-01-15T11:12:30Z

Hallo,

The spyder editor should support bookmarks like the VIM-editor or the editor in MATLAB. Both bookmark-systems differ in the way you set and access the bookmarks and have their own charm.

MALAB: In Matlab all bookmarks were set with the same bookmark-keyboard-shortcut (Ctrl-F2). This bookmarks can then be cycled trough by pressing a different shortcut like F2. A short description (including pictures) about the behaviour of the bookmark-system can be found here http://blogs.mathworks.com/desktop/2007/06/15/scroll-less-with-editor-bookmarks/ This variant is better if you have only two or three bookmarks because you do not have to worry about remembering the specific shortcuts for different locations.

VIM In VIM it is possible to set several bookmarks which can be accessed (moved to) separately. See http://www.thegeekstuff.com/2009/02/how-to-add-bookmarks-inside-vi-and-vim-editor/ Especially if you use bookmarks a lot it is better to have specific jump-locations so you do not have to cycle trough all of them.

Thanks in advance, HoWil

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

spyder-bot avatar Feb 17 '15 00:02 spyder-bot

From ccordoba12 on 2013-02-13T09:21:58Z

We'll consider them for 2.3

Labels: Cat-Editor MS-v2.3

spyder-bot avatar Feb 17 '15 00:02 spyder-bot

From pierre.raybaut on 2013-05-11T05:42:37Z

Labels: -MS-v2.3 MS-v2.4

spyder-bot avatar Feb 17 '15 00:02 spyder-bot

From [email protected] on 2013-09-02T17:43:49Z

I have much experience with the Vim method and the method in Delphi (objectpascal) IDE.

In Vim the keystroke to set a bookmark (or "mark") is followed by the name of the mark, e.g. . Then, to jump back to mark "a", the keystrokes are <`>. I am used to the Vim method, but I don't think it makes sense to implement this exactly as-is.

For spyder, I would much prefer the Delphi method: to set a bookmark, the keystrokes are

<CTRL><SHIFT><[0-9]>

So you have 10 slots in which to store a bookmark. Then, to jump back to such a numbered bookmark, say, number 3, the keystrokes are:

<CTRL><3>

In Delphi, a little icon with the number of the bookmark is drawn into the gutter of the editor.

I am happy to help out with implementing this feature, unless anyone else has already started?

spyder-bot avatar Feb 17 '15 00:02 spyder-bot

From [email protected] on 2013-09-07T07:58:26Z

An easy way to implement this would be to replicate most of the functionality that already exists for breakpoints, namely:

  1. Setting or clearing bookmarks by double-clicking on the margin of the editor (Ctrl-double-click or something else to differentiate from breakpoints)
  2. Have a window that shows the bookmarks. Double-clicking on an item takes you to the bookmark.

All one would have to add would be a key combination that would jump to the next bookmark.

spyder-bot avatar Feb 17 '15 00:02 spyder-bot

No matter how but I really think that is very important implement it, asap ...

@goanpeca, what do you think?

ccordoba12 avatar Dec 29 '15 04:12 ccordoba12

I do not see as so important to be honest, users could use the outline explorer and special comments to have quick access "bookmarks". Overloading functionality on the linenumber does not sound so good...


....
# --- Bookmark 1     This will appear in the outline explorer
.... 
# --- Bookmark 2      This will appear in the outline explorer

We could provide a "Special comments" view to create a better experience


@ccordoba12 , PR #2885 #2861 and #2184 are waiting :smiling_imp:

goanpeca avatar Dec 29 '15 04:12 goanpeca

Em 29/12/2015 02:10, Gonzalo Peña-Castellanos escreveu:

I do not see as so important to be honest, users could use the outline explorer and special comments to have quick access "bookmarks". Overloading functionality on the linenumber does not sound so good...

....

--- Bookmark 1 This will appear in the outline explorer

....

--- Bookmark 1 This will appear in the outline explorer


@ccordoba12 https://github.com/ccordoba12 , PR #2885 https://github.com/spyder-ide/spyder/pull/2885 #2861 https://github.com/spyder-ide/spyder/pull/2861 and #2184 https://github.com/spyder-ide/spyder/pull/2184 are waiting :smiling_imp:

— Reply to this email directly or view it on GitHub https://github.com/spyder-ide/spyder/issues/910#issuecomment-167715391.

I see, but those are not the same thing ..., what you propose is to use a workaround to solve this issue and I have proposed to implement one way useful, easy and quick to get some places in our code ... just is it ... no matter how but when, because in my opinion this is very useful ... just compare this kind of command with some another IDE ... When you use the best tool for your work, it ends better and faster than before ...

Ademir Francisco da Silva Skype ...: Ademir_Francisco_da_Silva [ CMC ] God will do me justice


Este email foi escaneado pelo Avast antivírus. https://www.avast.com/antivirus

Em 29/12/2015 09:57, Ademir Francisco da Silva escreveu:

Em 29/12/2015 02:10, Gonzalo Peña-Castellanos escreveu:

I do not see as so important to be honest, users could use the outline explorer and special comments to have quick access "bookmarks". Overloading functionality on the linenumber does not sound so good...

....

--- Bookmark 1 This will appear in the outline explorer

....

--- Bookmark 1 This will appear in the outline explorer


@ccordoba12 https://github.com/ccordoba12 , PR #2885 https://github.com/spyder-ide/spyder/pull/2885 #2861 https://github.com/spyder-ide/spyder/pull/2861 and #2184 https://github.com/spyder-ide/spyder/pull/2184 are waiting :smiling_imp:

— Reply to this email directly or view it on GitHub https://github.com/spyder-ide/spyder/issues/910#issuecomment-167715391.

Have you ever tried it with a text file, for example? Just simple, it doesn't work ... or then fix the code explorer, the question here is what is better and simple to do ... Think about it ... But anyway, thank for your precious tip ...

Ademir Francisco da Silva Skype ...: Ademir_Francisco_da_Silva [ CMC ] God will do me justice

Ademir Francisco da Silva Skype ...: Ademir_Francisco_da_Silva [ CMC ] God will do me justice


Este email foi escaneado pelo Avast antivírus. https://www.avast.com/antivirus

The fact that this feature is not in the Roadmap probably means that it is very low on the priority list and has little chance to be implemented? That's a pity.

If I should ever find myself having advanced a lot in Python/GUI programming - any hints of where to start on a feature like this? If I understand correctly, the two approaches mentioned here would either be using the breakpoint framework or that of the Outline Explorer / special comments. I guess the second approach would be easier to implement? Just finding the right regular expression, parsing the name/title of the 'bookmark' and adding it to the project outline in the appropriate location.

Foucl avatar Sep 29 '16 13:09 Foucl

Thanks for your answer ...

Em 29/09/2016 10:09, Christopher escreveu:

The fact that this feature is not in the Roadmap https://github.com/spyder-ide/spyder/wiki/Roadmap probably means that it is very low on the priority list and has little chance to be implemented? That's a pity.

If I should ever find myself having advanced a lot in Python/GUI programming - any hints of where to start on a feature like this? If I understand correctly, the two approaches mentioned here would either be using the breakpoint framework or that of the Outline Explorer / special comments. I guess the second approach would be easier to implement? Just finding the right regular expression, parsing the name/title of the 'bookmark' and adding it to the project outline in the appropriate location.

Ademir Francisco da Silva Skype ...: Ademir_Francisco_da_Silva [ CMC ] God will do me justice


Este email foi escaneado pelo Avast antivírus. https://www.avast.com/antivirus

it is very low on the priority

Since this feature has not been requested by many users (yet), yes it is indeed not a very high priority, but with this growing interest I can assure you that this is definitely going to be included in Spyder 4.0 or in the Master Branch in a couple of months.

The thing is that we are decoupling several parts of the Spyder API and widgets to make them more extendable and that work is currently happening with the editor so we can better support code folding and now this feature.

Thanks for using Spyder and suggesting how to make it even better :-)

goanpeca avatar Sep 29 '16 13:09 goanpeca

Wow !!! Definitely I'm very happy now ...

Em 29/09/2016 10:51, Gonzalo Peña-Castellanos escreveu:

it is very low on the priority

Since this feature has not been requested by many users (yet), yes it is indeed not a very high priority, but with this growing interest I I can assure you that this is definitely going to be included in Spyder 4.0 or in the Master Branch in a couple of months.

The thing is that we are decoupling several parts of the Spyder API and widgets to make them more extendable and that work is currently happening with the editor so we can better support code folding and now this feature.

Thanks for using Spyder and suggesting how to make it even better :-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/910#issuecomment-250471789, or mute the thread https://github.com/notifications/unsubscribe-auth/ABrL8sK6DLUFwHwR3KgselDL3JntqXUpks5qu8J4gaJpZM4DhQT3.

Ademir Francisco da Silva Skype ...: Ademir_Francisco_da_Silva [ CMC ] God will do me justice


Este email foi escaneado pelo Avast antivírus. https://www.avast.com/antivirus

@ccordoba12 Is anyone working on this? I would like to have this feature very much in Spyder. I actually use break points as a way to put bookmarks since I don't use the debugger much...

jnsebgosselin avatar Aug 23 '17 01:08 jnsebgosselin

Nop, there's none working on it. Would you like to give it a shot?

ccordoba12 avatar Aug 23 '17 01:08 ccordoba12

Yes, I will do it.

jnsebgosselin avatar Aug 23 '17 12:08 jnsebgosselin

I think it is indispensable ! @jnsebgosselin how do you think about the Bookmarks ?

It can be enumerable (0 to 9) and swap between the opened files (like android studio) ? This feature is helpful in android studio !

wcipriano avatar Mar 15 '18 14:03 wcipriano

Did anything over come of this discussion? This is the only thing I miss about the Matlab and Visual Studio editors when I'm working in Spyder, and it would be fantastic to find a way to do this, even if there's some kind of hack that creates an experience kind of like this.

agentmorris avatar Dec 06 '18 16:12 agentmorris

Are Spyder Bookmarks still in preparation? Any idea when we might see them? This is really the only feature that I miss on Spyder .....

RayJohnson2 avatar Jan 24 '20 12:01 RayJohnson2

They'll be added in Spyder 5, to be released in a year or year and a half.

ccordoba12 avatar Jan 24 '20 14:01 ccordoba12

They'll be added in Spyder 5, to be released in a year or year and a half.

Thanks for your reply!

RayJohnson2 avatar Jan 24 '20 14:01 RayJohnson2

Did a version of this end up making its way into Spyder 5.0.0? I couldn't find anything in the changelog, but it may have been introduced with terminology other than "bookmarks". Thanks!

agentmorris avatar Apr 12 '21 20:04 agentmorris

No, it didn't and it (most probably) won't arrive until Spyder 6, sorry.

ccordoba12 avatar Apr 12 '21 22:04 ccordoba12

NP, thanks for the quick reply!

agentmorris avatar Apr 12 '21 22:04 agentmorris

Since this feature has not been requested by many users (yet), yes it is indeed not a very high priority, but with this growing interest I can assure you that this is definitely going to be included in Spyder 4.0 or in the Master Branch in a couple of months.

The thing is that we are decoupling several parts of the Spyder API and widgets to make them more extendable and that work is currently happening with the editor so we can better support code folding and now this feature.

Thanks for using Spyder and suggesting how to make it even better :-)

I would really like this feature too, much like cup holders in cars people realized how useful it was once they had it!

cach-dies avatar Apr 13 '21 23:04 cach-dies

I do not see as so important to be honest, users could use the outline explorer and special comments to have quick access "bookmarks". Overloading functionality on the linenumber does not sound so good...

....
# --- Bookmark 1     This will appear in the outline explorer
.... 
# --- Bookmark 2      This will appear in the outline explorer

We could provide a "Special comments" view to create a better experience

@ccordoba12 , PR #2885 #2861 and #2184 are waiting 😈

I think this is also a great solution however there is one problem, if you have functions inside a "bookmark" (with this method) then you would need to indent the entire function (an the rest of your code for that matter) so that the outline navigator understands the hierarchy. Meaning you would have to write your code like this:

# --- Bookmark 1

    def hello:
        print("hello")

    # --- Bookmark 1.1
        # More code here

    # --- Bookmark 1.2
   #...

# --- Bookmark 2
#...

which is weird and also raises the pycodestyle warning E113 or E116 (not ideal). Instead it would be nice to have some sort of special comment, say # *** Bookmark that would produce the same outline as the chunk above but that would allow for other outline elements not to be indented like so:

# *** Bookmark 1

def hello:
    print("hello")

    # *** Bookmark 1.1
        # More code here

    # *** Bookmark 1.2
   #...

# *** Bookmark 2
#...

Oh also, this doesn't seem to work on spyder 5 (it does on spyder 4) -_-

cach-dies avatar Apr 14 '21 00:04 cach-dies

What you describe sounds great, but a very different experience than what I think the advocates for this feature are referring to. The way we're using the word "bookmarks", we're referring to something much more akin to marks in vi, or bookmarks in Matlab/Visual Studio, which are transient and lightweight, and don't have names (they appear as just dots in the line number area, analogous to the way breakpoints are displayed).

Among those examples, I think only VS even stores them from session to session, and only vi lets you bind specific keys to them. The extremely minimalist Matlab approach of just having transient, unnamed marks that appear as little boxes in the line number area - with a single key (F2 in Matlab, and I think also in VS) to cycle through all bookmarks - is fantastically helpful for many workflows.

agentmorris avatar Apr 14 '21 00:04 agentmorris

What you describe sounds great, but a very different experience than what I think the advocates for this feature are referring to. The way we're using the word "bookmarks", we're referring to something much more akin to marks in vi, or bookmarks in Matlab/Visual Studio, which are transient and lightweight, and don't have names (they appear as just dots in the line number area, analogous to the way breakpoints are displayed).

Among those examples, I think only VS even stores them from session to session, and only vi lets you bind specific keys to them. The extremely minimalist Matlab approach of just having transient, unnamed marks that appear as little boxes in the line number area - with a single key (F2 in Matlab, and I think also in VS) to cycle through all bookmarks - is fantastically helpful for many workflows.

Yeah, maybe. I just want a way to organize your code hierarchically

cach-dies avatar Apr 14 '21 01:04 cach-dies

What you describe sounds great, but a very different experience than what I think the advocates for this feature are referring to. The way we're using the word "bookmarks", we're referring to something much more akin to marks in vi, or bookmarks in Matlab/Visual Studio, which are transient and lightweight, and don't have names (they appear as just dots in the line number area, analogous to the way breakpoints are displayed).

Among those examples, I think only VS even stores them from session to session, and only vi lets you bind specific keys to them. The extremely minimalist Matlab approach of just having transient, unnamed marks that appear as little boxes in the line number area - with a single key (F2 in Matlab, and I think also in VS) to cycle through all bookmarks - is fantastically helpful for many workflows.

Yes, this is the way that I picture it (And that I know from other editors). And that would work for me. Just 3 keys (F2, SHIFT - F2 and CTRL - F2 for example) . F2 to jump from bookmark to bookmark (forward). SHIFT - F2 to jump backwards from bookmark to bookmark. CTRL - F2 to toggle (create/delete) the bookmarks on the current line. A little indicator icon right before the bookmarked line numbers (where now already some icons are placed) would be nice, but that would not even be 'a must'.

I now use a quick and dirty AutoIt3 script to call the 'Goto Line' command (CTRL - L) , then paste a line number in it. It works, but it is a little tedious because I regularly have to adjust the line numbers.

RayJohnson2 avatar Apr 14 '21 07:04 RayJohnson2

When is it expected for the Spyder 6 release? I want to have this feature.

lwbaqueros avatar Jul 12 '22 15:07 lwbaqueros

Perhaps in the middle of 2023. But I don't know if we'll have time to implement this feature.

ccordoba12 avatar Jul 12 '22 16:07 ccordoba12