Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

GoToLine is no longer working in 2012 / 2013 when calling the internal methods to show the go to line dialog.

$
0
0

We have a VS Package that has a custom editor. We want to show the native go-to line dialog that visual studio uses. We have had this implemented in 2010 using the following code:

[CommandExecMethod]
        [VsCommandId(VSConstants.VSStd97CmdID.Goto)]
        protected void ExecuteGoTo()
        {
            var lineNumber = GetGoToLineNumberFromDialog();

            if (lineNumber < 0)
                return;

            NavigateTo(new TextSpan[]
                         {
                             new TextSpan
                                 {
                                     iStartLine = lineNumber,
                                     iStartIndex = 0,
                                     iEndLine = lineNumber,
                                     iEndIndex = 0
                                 }
                         });
        }

        protected int GetGoToLineNumberFromDialog()
        {
            var dataSource = new Microsoft.Internal.VisualStudio.PlatformUI.UIDataSource();
            dataSource.AddBuiltInProperty("MinimumLine", 1);
            dataSource.AddBuiltInProperty("MaximumLine", TemplateEditorControl.LineCount);
            dataSource.AddBuiltInProperty("CurrentLine", TemplateEditorControl.CurrentLine);
            Microsoft.Internal.VisualStudio.PlatformUI.WindowHelper.AddHelpTopic(dataSource,"vs.gotoline");
            if (Microsoft.Internal.VisualStudio.PlatformUI.WindowHelper.ShowModalElement(VSConstants.GUID_VSStandardCommandSet97, 231, dataSource) == 1)
            {
                var result = new Microsoft.Internal.VisualStudio.PlatformUI.UIObject(dataSource["CurrentLine"]);
                return (((int)result.Data) - 1);
            }

            return -1;
        }

I recently noticed that this stopped working and is not working in 2012 or 2013.

https://connect.microsoft.com/VisualStudio/feedback/details/798015/gotoline-is-no-longer-working-in-2012-2013-when-calling-the-internal-methods-to-show-the-go-to-line-dialog#tabs


-Blake Niemyjski (Software Development Engineer)


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>