Skip to content
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

Bookmarks for Spyder Editor #910

Open
spyder-bot opened this issue Feb 17, 2015 · 31 comments
Open

Bookmarks for Spyder Editor #910

spyder-bot opened this issue Feb 17, 2015 · 31 comments

Comments

@spyder-bot
Copy link
Collaborator

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
Copy link
Collaborator Author

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

We'll consider them for 2.3

Labels: Cat-Editor MS-v2.3

@spyder-bot
Copy link
Collaborator Author

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

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

@spyder-bot
Copy link
Collaborator Author

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

<[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:

<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
Copy link
Collaborator Author

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.

@ccordoba12 ccordoba12 modified the milestones: v4.0, v3.0 Jul 13, 2015
@Ademir-Francisco-da-Silva

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

@ccordoba12
Copy link
Member

@goanpeca, what do you think?

@goanpeca
Copy link
Member

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 😈

@Ademir-Francisco-da-Silva

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
#2885 #2861
#2861 and #2184
#2184 are waiting
😈


Reply to this email directly or view it on GitHub
#910 (comment).

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

@Ademir-Francisco-da-Silva

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
#2885 #2861
#2861 and #2184
#2184 are waiting
😈


Reply to this email directly or view it on GitHub
#910 (comment).

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

@Foucl
Copy link

Foucl commented Sep 29, 2016

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.

@Ademir-Francisco-da-Silva

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

@goanpeca
Copy link
Member

goanpeca commented Sep 29, 2016

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 :-)

@Ademir-Francisco-da-Silva

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
#910 (comment),
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 ccordoba12 modified the milestones: v4.1, v4.0beta1 Aug 13, 2017
@jnsebgosselin
Copy link
Member

@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...

@ccordoba12
Copy link
Member

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

@ccordoba12 ccordoba12 modified the milestones: future, v4.0beta3 Mar 29, 2019
@ccordoba12 ccordoba12 modified the milestones: v4.0beta3, v4.0beta4 May 18, 2019
@ccordoba12 ccordoba12 modified the milestones: v4.0betaX, v4.0beta4 Jun 17, 2019
@ccordoba12 ccordoba12 modified the milestones: v4.0beta4, v4.0beta5 Jul 20, 2019
@oscargus oscargus mentioned this issue Jul 31, 2019
11 tasks
@ccordoba12 ccordoba12 modified the milestones: v4.0beta5, future Aug 10, 2019
@RayJohnson2
Copy link

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

@ccordoba12
Copy link
Member

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

@RayJohnson2
Copy link

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

Thanks for your reply!

@goanpeca goanpeca removed this from the future milestone Feb 23, 2020
@agentmorris
Copy link

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!

@ccordoba12
Copy link
Member

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

@agentmorris
Copy link

NP, thanks for the quick reply!

@cach-dies
Copy link

cach-dies commented Apr 13, 2021

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
Copy link

cach-dies commented Apr 14, 2021

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) -_-

@agentmorris
Copy link

agentmorris commented Apr 14, 2021

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.

@cach-dies
Copy link

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

@RayJohnson2
Copy link

RayJohnson2 commented Apr 14, 2021

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.

@lwbaqueros
Copy link

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

@ccordoba12
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.