Hello,
I am creating a new custom WPF Editor in VS2010 and I noticed that the GoTo line / menu's is not working. When my editor first opens then the menu is enabled but the line count in the menu shows that i can go to line 1 (only 1 line in the document), but as soon as I click cancel all of the goto menu's and keyboard shortcuts are disabled. I set a breakpoint on any code that returns a line count and it still has this same behavior. I really don't want to implement this using a custom goto dialog and this code:
addCommand(mcs, VSConstants.GUID_VSStandardCommandSet97, (int) VSConstants.VSStd97CmdID.Goto, OnGoto, OnQueryGoto);
Has anyone else run into this behavior?
[ComSourceInterfaces(typeof (IVsTextViewEvents))] [ComVisible(true)] public abstract class EditorPaneBase : WindowPane, IPersistFileFormat, //to Enable persistence functionality for document data. IVsPersistDocData2, //to Enable persistence functionality for document data. IVsFileChangeEvents, //to notify the client when file changes on disk IVsDocDataFileChangeControl, //to Determine whether changes to files made outside of the editor should be ignored IVsFileBackup, //to support backup of files. Visual Studio File Recovery backs up all objects in the Running Document Table that support IVsFileBackup and have unsaved changes. IVsStatusbarUser, //support updating the status bar IVsFindTarget, //to implement find and replace capabilities within the editor IVsTextImage, //to support find and replace in a text image IVsTextSpanSet, //needed for Find and Replace to work appropriately IVsTextView, //Manages the text view of an editor window. Contains methods to manage the text view. The view is essentially the editor window shown in the UI. IVsCodeWindow, //needed for Find and Replace to work appropriately IVsTextLines, //needed for Find and Replace to work appropriately IVsToolboxUser, //Sends notification about Toolbox items to the owner of these items IExtensibleObject, //so we can get the atuomation object Document
I've checked the following methods and this doesn't alter this behavior:
/// <summary> /// To return the number of lines in the text image /// </summary> /// <param name="pcLines">pointer to the number of lines in the text image</param> /// <returns>S_OK</returns> int IVsTextImage.GetLineSize(out int pcLines) { //get the number of the lines in the control pcLines = GetTotalLineCount(); return VSConstants.S_OK; }
public int GetLineCount(out int piLineCount) { piLineCount = GetTotalLineCount(); return VSConstants.S_OK; }
Thanks
-Blake Niemyjski