public override void PreprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e)
            {
                int index;
                var roslynSnapshot = GetEntriesSnapshot(entryHandle, out index);

                if (roslynSnapshot == null)
                {
                    return;
                }

                // we always mark it as handled if entry is ours
                e.Handled = true;

                // REVIEW:
                // turning off one click navigation.
                // unlike FindAllReference which don't lose focus even after navigation,
                // error list loses focus once navigation happens. I checked our find all reference implementation, and it uses
                // same mechanism as error list, so it must be the find all reference window doing something to not lose focus or it must
                // taking focus back once navigation happened. we need to implement same thing in error list. until then, I am disabling one
                // click navigation.
                if (!e.IsPreview)
                {
                    roslynSnapshot.TryNavigateTo(index, e.IsPreview);
                }
            }
Esempio n. 2
0
            public override void PreprocessNavigate(
                ITableEntryHandle entry,
                TableEntryNavigateEventArgs e
                )
            {
                if (entry.Identity is ISupportsNavigation supportsNavigation)
                {
                    // TODO: Use a threaded-wait-dialog here so we can cancel navigation.
                    if (supportsNavigation.TryNavigateTo(e.IsPreview, CancellationToken.None))
                    {
                        e.Handled = true;
                        return;
                    }
                }

                if (
                    entry.TryGetValue(StreamingFindUsagesPresenter.SelfKeyName, out var item) &&
                    item is ISupportsNavigation itemSupportsNavigation
                    )
                {
                    // TODO: Use a threaded-wait-dialog here so we can cancel navigation.
                    if (itemSupportsNavigation.TryNavigateTo(e.IsPreview, CancellationToken.None))
                    {
                        e.Handled = true;
                        return;
                    }
                }

                base.PreprocessNavigate(entry, e);
            }
Esempio n. 3
0
            public override void PreprocessNavigate(
                ITableEntryHandle entryHandle,
                TableEntryNavigateEventArgs e
                )
            {
                var roslynSnapshot = GetEntriesSnapshot(entryHandle, out var index);

                if (roslynSnapshot == null)
                {
                    return;
                }

                // don't be too strict on navigation on our item. if we can't handle the item,
                // let default handler to handle it at least.
                // we might fail to navigate if we don't see the document in our solution anymore.
                // that can happen if error is staled build error or user used #line pragma in C#
                // to point to some random file in error or more.

                // TODO: Use a threaded-wait-dialog here so we can cancel navigation.
                e.Handled = roslynSnapshot.TryNavigateTo(
                    index,
                    e.IsPreview,
                    e.ShouldActivate,
                    CancellationToken.None
                    );
            }
Esempio n. 4
0
            public override void PreprocessNavigate(ITableEntryHandle entry, TableEntryNavigateEventArgs e)
            {
                if (entry.Identity is ISupportsNavigation supportsNavigation)
                {
                    if (supportsNavigation.TryNavigateTo(e.IsPreview))
                    {
                        e.Handled = true;
                        return;
                    }
                }

                base.PreprocessNavigate(entry, e);
            }
            public override void PreprocessNavigate(ITableEntryHandle entry, TableEntryNavigateEventArgs e)
            {
                var supportsNavigation = entry.Identity as ISupportsNavigation;
                if (supportsNavigation != null)
                {
                    if (supportsNavigation.TryNavigateTo())
                    {
                        e.Handled = true;
                        return;
                    }
                }

                base.PreprocessNavigate(entry, e);
            }
            public override void PreprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e)
            {
                var roslynSnapshot = GetEntriesSnapshot(entryHandle, out var index);

                if (roslynSnapshot == null)
                {
                    return;
                }

                // we always mark it as handled if entry is ours
                e.Handled = true;

                roslynSnapshot.TryNavigateTo(index, e.IsPreview);
            }
Esempio n. 7
0
                async static Task ProcessNavigateAsync(
                    ISupportsNavigation supportsNavigation, TableEntryNavigateEventArgs e,
                    IAsynchronousOperationListener listener,
                    IUIThreadOperationExecutor operationExecutor)
                {
                    using var token   = listener.BeginAsyncOperation(nameof(ProcessNavigateAsync));
                    using var context = operationExecutor.BeginExecute(
                              ServicesVSResources.IntelliSense,
                              EditorFeaturesResources.Navigating,
                              allowCancellation: true,
                              showProgress: false);

                    await supportsNavigation.NavigateToAsync(e.IsPreview, e.ShouldActivate, context.UserCancellationToken).ConfigureAwait(false);
                }
Esempio n. 8
0
            public override void PreprocessNavigate(ITableEntryHandle entry, TableEntryNavigateEventArgs e)
            {
                var supportsNavigation = entry.Identity as ISupportsNavigation;

                if (supportsNavigation != null)
                {
                    if (supportsNavigation.TryNavigateTo())
                    {
                        e.Handled = true;
                        return;
                    }
                }

                base.PreprocessNavigate(entry, e);
            }
            public override void PreprocessNavigate(ITableEntryHandle entry, TableEntryNavigateEventArgs e)
            {
                var supportsNavigation = entry.Identity as ISupportsNavigation ??
                                         (entry.TryGetValue(StreamingFindUsagesPresenter.SelfKeyName, out var item) ? item as ISupportsNavigation : null);

                if (supportsNavigation != null &&
                    supportsNavigation.CanNavigateTo())
                {
                    // Fire and forget
                    e.Handled = true;
                    _         = ProcessNavigateAsync(supportsNavigation, e, _listener, _operationExecutor);
                }

                base.PreprocessNavigate(entry, e);
                return;

                async static Task ProcessNavigateAsync(
Esempio n. 10
0
            public override void PreprocessNavigate(ITableEntryHandle entry, TableEntryNavigateEventArgs e)
            {
                if (entry.Identity is ISupportsNavigation supportsNavigation)
                {
                    if (supportsNavigation.TryNavigateTo(e.IsPreview))
                    {
                        e.Handled = true;
                        return;
                    }
                }

                if (entry.TryGetValue(StreamingFindUsagesPresenter.SelfKeyName, out var item) && item is ISupportsNavigation itemSupportsNavigation)
                {
                    if (itemSupportsNavigation.TryNavigateTo(e.IsPreview))
                    {
                        e.Handled = true;
                        return;
                    }
                }

                base.PreprocessNavigate(entry, e);
            }
            public override void PreprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e)
            {
                int index;
                ITableEntriesSnapshot snapshot;

                if (!entryHandle.TryGetSnapshot(out snapshot, out index))
                {
                    return;
                }

                var sarifSnapshot = snapshot as SarifSnapshot;

                if (sarifSnapshot == null)
                {
                    return;
                }

                e.Handled = true;
                DeselectItems(snapshot);

                SarifError sarifError = sarifSnapshot.GetItem(index);

                IVsWindowFrame frame;

                if (!CodeAnalysisResultManager.Instance.TryNavigateTo(sarifError, out frame))
                {
                    //return;
                }

                if (sarifError.HasDetails)
                {
                    OpenOrReplaceVerticalContent(frame, sarifError);
                }
                else
                {
                    CloseVerticalContent(frame, sarifError);
                }
            }
Esempio n. 12
0
            /// <summary>
            /// Handles the double-click Error List event.
            /// Displays the SARIF Explorer tool window.
            /// Does not bind the selected item to the Tool Window. The binding is done by PreprocessSelectionChanged.
            /// </summary>
            public override void PreprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e)
            {
                SarifErrorListItem sarifResult;

                if (!TryGetSarifResult(entryHandle, out sarifResult))
                {
                    SarifViewerPackage.SarifToolWindow.Control.DataContext = null;
                    return;
                }

                e.Handled = true;

                if (sarifResult.HasDetails)
                {
                    SarifViewerPackage.SarifToolWindow.Show();
                }

                // Navigate to the source file of the first location for the defect.
                if (sarifResult.Locations?.Count > 0)
                {
                    sarifResult.Locations[0].NavigateTo(false);
                    sarifResult.Locations[0].ApplyDefaultSourceFileHighlighting();
                }
            }
            /// <summary>
            /// Handles the double-click Error List event.
            /// Displays the SARIF Explorer tool window. 
            /// Does not bind the selected item to the Tool Window. The binding is done by PreprocessSelectionChanged.
            /// </summary>
            public override void PreprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e)
            {
                SarifErrorListItem sarifResult;

                if (!TryGetSarifResult(entryHandle, out sarifResult))
                {
                    SarifViewerPackage.SarifToolWindow.Control.DataContext = null;
                    return;
                }

                e.Handled = true;

                if (sarifResult.HasDetails)
                {
                    SarifViewerPackage.SarifToolWindow.Show();
                }

                // Navigate to the source file of the first location for the defect.
                if (sarifResult.Locations?.Count > 0)
                {
                    sarifResult.Locations[0].NavigateTo(false);
                    sarifResult.Locations[0].ApplyDefaultSourceFileHighlighting();
                }
            }
Esempio n. 14
0
 void ITableControlEventProcessor.PreprocessNavigate(ITableEntryHandle entry, TableEntryNavigateEventArgs args)
 {
 }
Esempio n. 15
0
 public override void PostprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e) => _toolWindow.OpenLog(entryHandle);
        public override void PostprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            _toolWindow.OpenLog(entryHandle);
        }