Author |
Topic |
|
efortier
Ketchup Master
Canada
89 Posts |
Posted - Mar 29 2006 : 7:03:43 PM
|
One of the great feature of Borland's Delphi (and BCB) text editor is that you can set a numbered bookmark on a line and jump back to this exact spot by using a shortcut.
You have 10 numbered bookmarks you set by pressing Ctrl+Shift and a number from 0 to 9. A bookmark icon appears in the gutter of the text editor showing the number inside of it. Each file has its own set of 10 bookmarks.
When you want to jump back to a precise spot you simply press Ctrl + the number, say Ctrl + 1. If you know that Ctrl+1 is function A and Ctrl+2 is function B, it's very easy to move between the two even if you have 8 other bookmarks defined.
This is really helpful when tracking bugs or when working on several functions at the same time. I hate having to cycle through all my bookmarks in Visual Studio trying to reach a place I know, and using the task list is nice but not as direct as the bookmarks in Delphi.
I have no clue why Microsoft never implemented that feature. Either it's there and I haven't searched hard enough or there are just too few of us using it? I doubt that!
Anyway, maybe VAX could fix that oversight?
Thanks!
--Eric
PS: I tried a couple of add-ins that claimed to support direct bookmarks, but they both popped a window asking me to select a bookmark to go back to. Good try but no cake! |
VS2005 Pro/Team Suite English http://www.tlnewsreader.com |
|
support
Whole Tomato Software
5566 Posts |
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Apr 02 2006 : 1:31:36 PM
|
it has been requested before, but that is no guarantee it will actually make it into VA
case=706 |
zen is the art of being at one with the two'ness |
|
|
efortier
Ketchup Master
Canada
89 Posts |
Posted - Apr 03 2006 : 11:30:10 PM
|
At least it's being considered. If anyone else would like this feature, please reply. With enough interest this suggestion may be bumbed higher in the TODO list ;) |
VS2005 Pro/Team Suite English http://www.tlnewsreader.com |
|
|
peterchen
Tomato Guru
126 Posts |
Posted - Apr 20 2006 : 04:33:09 AM
|
I'd be happy with a list of bookmarks (file, line, maybe some surrounding code), but what you suggest certainly would certainly fit my needs, too. |
|
|
bugfix
Tomato Guru
Germany
324 Posts |
Posted - May 07 2006 : 06:46:42 AM
|
how about using macro like these which you bind to some keys?
Dim bookmarks(10)
Sub mySetBookmark(ByVal idx As Integer)
bookmarks(idx) = DTE.ActiveDocument.Selection.ActivePoint.Line
DTE.ActiveDocument.Selection.SetBookmark()
End Sub
Sub myGotoBookmark(ByVal idx As Integer)
DTE.ActiveDocument.Selection.GotoLine(bookmarks(idx))
End Sub
Sub mySetBookmark0()
mySetBookmark(0)
End Sub
Sub mySetBookmark1()
mySetBookmark(1)
End Sub
Sub myGotoBookmark0()
myGotoBookmark(0)
End Sub
Sub myGotoBookmark1()
myGotoBookmark(1)
End Sub
(c) -bugfix :P |
http://www.mf-sd.de |
|
|
efortier
Ketchup Master
Canada
89 Posts |
Posted - May 07 2006 : 11:24:40 AM
|
Hi Bugfix,
I can't begin to thank you enough! I don't know a lot about writing macros and the like and the code you provided allowed me to do exactly what I wanted. I still need to write the bookmarks number on a per-document basis to a file, and since my knowledge of VB is really poor, that'll wait!
Here's my final setbookmark function, in case someone else follows this thread:
Sub mySetBookmark(ByVal idx As Integer)
Dim textPoint As EnvDTE.TextPoint
Dim objTW As TextWindow
Dim objStart As TextPoint
objTW = DTE.ActiveWindow.Object
objStart = objTW.ActivePane.StartPoint
Dim cLine = DTE.ActiveDocument.Selection.ActivePoint.Line
' are we on the same line as the new bookmark we are trying to set.
If cLine = bookmarks(idx) Then
' clear bookmark.
bookmarks(idx) = 0
DTE.ActiveDocument.Selection.ClearBookmark()
Else
' remove prior bookmark, if any.
If bookmarks(idx) <> 0 And bookmarks(idx) <> cLine Then
DTE.ActiveDocument.Selection.GotoLine(bookmarks(idx))
DTE.ActiveDocument.Selection.ClearBookmark()
End If
' go to bookmark line.
DTE.ActiveDocument.Selection.GotoLine(cLine)
' set new bookmark.
bookmarks(idx) = cLine
DTE.ActiveDocument.Selection.SetBookmark()
' show top line.
objStart.TryToShow(vsPaneShowHow.vsPaneShowTop)
End If
End Sub The other thing that I can't seem to figure out is if there is a way to lock the text editor so that it doesn't update while I jump between lines. Like BeginUpdate/EndUpdate, LockWindowUpdate, etc.
Is there a way to do that?
Anyway, thanks again. |
VS2005 Pro/Team Suite English http://www.tlnewsreader.com |
|
|
bugfix
Tomato Guru
Germany
324 Posts |
Posted - May 08 2006 : 02:31:59 AM
|
I know s**t about VB and Macro but I know you can do almost everything w/ it and if I need smth I usually find my way:)
As for per doc bookmarks try smth like this:
Public Structure blub
Public bookmarks() As Integer
Public Sub init()
ReDim bookmarks(10)
End Sub
End Structure
Dim bookmarks As New Collection
Sub mySetBookmark(ByVal idx As Integer)
Dim x = Nothing
Try
x = bookmarks.Item(DTE.ActiveDocument.Name)
Catch
x = New blub
x.init()
bookmarks.Add(x, DTE.ActiveDocument.Name)
End Try
x.bookmarks(idx) = DTE.ActiveDocument.Selection.ActivePoint.Line
DTE.ActiveDocument.Selection.SetBookmark()
End Sub
About blocking IDE from updating... sorry, no idea how to do that.
-bugfix
I've uploaded a more or less complete vb file at: http://www.dword.de/mfBookMarks.vb |
http://www.mf-sd.de |
Edited by - bugfix on May 08 2006 05:24:17 AM |
|
|
ladzin
Starting Member
Switzerland
1 Posts |
Posted - Mar 15 2012 : 08:48:15 AM
|
It's been a while -- any updates on numbered bookmarks (Borland Delphi style)? I've tried a couple of 3rd party plugins and they didn't work very well... |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Mar 15 2012 : 7:40:07 PM
|
There is no progress yet. Anyway, are you aware that you can use named bookmarks in Visual Studio?
View -> Bookmark Window
I know it's not the same (since you cannot assign keyboard shortcuts to them), but seems usable. |
|
|
|
Topic |
|