Beispiel #1
0
        private void Execute()
        {
            var buildOutputSpanForCaret = GetBuildOutputSpanForCaret();

            if (buildOutputSpanForCaret == null)
            {
                return;
            }

            _openDocumentHelper.OpenDocument(buildOutputSpanForCaret.FileName, (vsTextView) => {
                var textView = _adaptersFactoryService.GetWpfTextView(vsTextView);
                if (textView == null)
                {
                    return(null);
                }

                var snapshot = textView.TextBuffer.CurrentSnapshot;
                if (buildOutputSpanForCaret.LineNumber < 0 || buildOutputSpanForCaret.LineNumber >= snapshot.LineCount)
                {
                    return(null);
                }

                var line = snapshot.GetLineFromLineNumber(buildOutputSpanForCaret.LineNumber);
                if (buildOutputSpanForCaret.ColumnNumber < 0 || buildOutputSpanForCaret.ColumnNumber >= line.Length)
                {
                    return(new Span(line.Start, 0));
                }

                return(new Span(line.Start + buildOutputSpanForCaret.ColumnNumber, 0));
            });
        }
Beispiel #2
0
 private void OpenDocument(VsHierarchy hierarchy, NodeViewModel node, bool openWith = false)
 {
     Logger.WrapActionInvocation(
         () => {
         if (!_fileSystem.FileExists(new FullPath(node.FullPathString)))
         {
             return;
         }
         if (openWith)
         {
             _openDocumentHelper.OpenDocumentWith(node.FullPathString, hierarchy, node.ItemId, view => null);
         }
         else
         {
             _openDocumentHelper.OpenDocument(node.FullPathString, view => null);
         }
     });
 }