<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://community.sharpdevelop.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>David Alpert</title><link>http://community.sharpdevelop.net/blogs/davidalpert/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Code Navigation History</title><link>http://community.sharpdevelop.net/blogs/davidalpert/archive/2006/09/18/Code-Navigation-History.aspx</link><pubDate>Mon, 18 Sep 2006 18:09:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:11678</guid><dc:creator>DavidAlpert</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/davidalpert/rsscomments.aspx?PostID=11678</wfw:commentRss><comments>http://community.sharpdevelop.net/blogs/davidalpert/archive/2006/09/18/Code-Navigation-History.aspx#comments</comments><description>&lt;p&gt;Support for a basic Code Navigation History has been added to SharpDevelop 2.1 as of revision 1569.&amp;nbsp; Built to enable &amp;quot;Navigate Back&amp;quot; and &amp;quot;Navigate Forward&amp;quot; with respect to major changes in cursor position, such as that resulting from a &amp;quot;Goto Definition&amp;nbsp; Ctrl-Enter&amp;quot; command or jumping to the position of an Error in the Error log.&lt;/p&gt;

&lt;p&gt; This feature set is a 
    work in progress; basic functionality is enabled but check the &lt;strong&gt;Known issues&lt;/strong&gt; and &lt;strong&gt;Future improvement&lt;/strong&gt; sections below before posting a Bug Report to the forums.  &lt;/p&gt;
&lt;h2&gt;Feature summary&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Two new toolbar buttons provide backwards &amp;amp; forwards navigation through visited positions in the editor windows;&lt;/li&gt;

&lt;li&gt;Navigating backwards &amp;amp; forwards resets the active file &amp;amp; cursor position to the specified point, effectively &amp;quot;undoing&amp;quot; major cursor position changes;&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;When adding a cursor position to the history, recent similar cursor positions in the same method are removed;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The NavigationService that lies underneath this feature set has been built for extensibility, delegating the management and navigation of cursor positions to individual IViewContent implementations.&amp;nbsp; This means that #develop developers can provide backwards/forwards functionality that is tailored to a specific view; for example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;backwards/forwards in a source code file might refer to classes and methods visited rather than specific line numbers;&lt;/li&gt;

&lt;li&gt;backwards/forwards in Design view might refer to a list of controls selected while designing;&lt;/li&gt;

&lt;li&gt;backwards/forwards in an XML document might refer to nodes in a tree representation;&lt;/li&gt;
&lt;/ol&gt;
At the moment, however, only navigation by filename and line number is supported.&amp;nbsp; Text file positions are considered the &amp;quot;same&amp;quot; if the difference in line numbers is less than 5, which helps weed out multiple consecutive positions travelled when scrolling via the cusor keys.&lt;br /&gt;
&lt;h2&gt;Feature tour&lt;/h2&gt;
&lt;ol&gt;

&lt;li&gt;The toolbar buttons appear in the toolbar, disabled when the navigation history is empty:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11689/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11689/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Navigation points are stored when significant changes are made to the cursor position, most notably via jumps such as using the &amp;quot;Goto Definition&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11690/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11690/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Having clicked &amp;quot;Goto Definition&amp;quot; and jumped to a new position in the source code, notice that the &amp;quot;Navigate Back&amp;quot; button is enabled:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11691/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11691/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;We can now click on the &amp;quot;Navigate Back&amp;quot; button to return to the code position we just left:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11692/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11692/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Now that we&amp;#39;ve gone back, notice that the &amp;quot;Navigate Forward&amp;quot; button is also enabled:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11693/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11693/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Clicking the &amp;quot;Navigate Forward&amp;quot; button returns us forward along the code path to the cursor position from which we navigated back:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11694/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11694/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Now that we have returned forward to the end of our history (the place where we first clicked &amp;quot;Navigate Back&amp;quot;) the &amp;quot;Navigate Forward&amp;quot; button is disabled, as expected:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11695/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11695/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Using the drop-down portion of the &amp;quot;Navigate Back&amp;quot; split button control, we can open a list of all cursor positions stored in our history.&amp;nbsp; This list is grouped by file (while only the name of each file appears at the top menu, sorting is done on complete file path):&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11696/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11696/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;


&lt;li&gt;Pulling open each file name&amp;#39;s submenu opens a list of positions in that file, each represented by the line number and a snip of text from that line:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11697/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11697/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11698/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11698/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;The last item in the &amp;quot;Navigate Back&amp;quot; drop-down menu allows you to empty the navigation history:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11699/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11699/original.aspx" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;And we see that both buttons are disabled, as expected:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.sharpdevelop.net/photos/davidalpert/images/11700/original.aspx" target="_blank"&gt;&lt;img border="1" src="http://community.sharpdevelop.net/photos/davidalpert/images/11700/original.aspx" /&gt;&lt;/a&gt;&lt;/li&gt;

&lt;/ol&gt;
Technically, the history is not actually empty at this point, as the current cursor position is stored against the possiblity of future position changes.&amp;nbsp; The buttons are disabled because, although this current position is still stored, forwards and backwards are meaningless when only one position exists.&lt;br /&gt;

&lt;h2&gt;Known issues&amp;nbsp;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Navigation history is &lt;strong&gt;not&lt;/strong&gt; stored between sessions - the navigation history is built from scratch on startup as previously open files are reopened;&lt;/li&gt;

&lt;li&gt;Navigation that involves opening a previously closed file tends to log
an unintended &amp;quot;initial&amp;quot; file position (at line 1, column 1) in addition
to the desired editor position;&lt;/li&gt;

&lt;li&gt;Going &amp;quot;forward&amp;quot; to the end of the navigation path correctly disables the &amp;quot;Navigate Forward&amp;quot; button, but going &amp;quot;backward&amp;quot; to the beginning of the path does not disable the &amp;quot;Navigate Back&amp;quot; button; at present this is by design to allow direct navigation to any stored point via the &amp;quot;Navigate Back&amp;quot; button&amp;#39;s dropdown.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Future improvements&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Filename changes and document operations (insertions/deletions) will be
tracked and navigation points automatically updated accordingly;&lt;/li&gt;

&lt;li&gt;Class &amp;amp; method info will be stored alongside the filename and line number so that the dropdown menu can be organized by class as well as filename;&lt;/li&gt;

&lt;li&gt;When adding a cursor position to the history, all other cursor positions &lt;strong&gt;in the same method &lt;/strong&gt;are removed.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=11678" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/davidalpert/archive/tags/Navigation/default.aspx">Navigation</category></item></channel></rss>