Example #1
0
            public override void PreprocessNavigate(ITableEntryHandle entryHandle, TableEntryNavigateEventArgs e)
            {
                int index;
                ITableEntriesSnapshot snapshot;

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

                var roslynSnapshot = snapshot as AbstractTableEntriesSnapshot <TData>;

                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);
                }
            }
            protected static AbstractTableEntriesSnapshot <TData> GetEntriesSnapshot(ITableEntryHandle entryHandle, out int index)
            {
                ITableEntriesSnapshot snapshot;

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

                return(snapshot as AbstractTableEntriesSnapshot <TData>);
            }
        private static AbstractTableEntriesSnapshot <DiagnosticData> GetEntriesSnapshot(ITableEntryHandle entryHandle, out int index)
        {
            ITableEntriesSnapshot snapshot;

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

            return(snapshot as AbstractTableEntriesSnapshot <DiagnosticData>);
        }
Example #4
0
            bool TryGetSarifResult(ITableEntryHandle entryHandle, out SarifErrorListItem sarifResult)
            {
                ITableEntriesSnapshot entrySnapshot;
                int entryIndex;

                sarifResult = default(SarifErrorListItem);

                if (entryHandle.TryGetSnapshot(out entrySnapshot, out entryIndex))
                {
                    var snapshot = entrySnapshot as SarifSnapshot;

                    if (snapshot != null)
                    {
                        sarifResult = snapshot.GetItem(entryIndex);
                    }
                }

                return(sarifResult != null);
            }
            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);
                }
            }
        private static AbstractTableEntriesSnapshot<DiagnosticData> GetEntriesSnapshot(ITableEntryHandle entryHandle, out int index)
        {
            ITableEntriesSnapshot snapshot;
            if (!entryHandle.TryGetSnapshot(out snapshot, out index))
            {
                return null;
            }

            return snapshot as AbstractTableEntriesSnapshot<DiagnosticData>;
        }
            bool TryGetSarifResult(ITableEntryHandle entryHandle, out SarifErrorListItem sarifResult)
            {
                ITableEntriesSnapshot entrySnapshot;
                int entryIndex;
                sarifResult = default(SarifErrorListItem);

                if (entryHandle.TryGetSnapshot(out entrySnapshot, out entryIndex))
                {
                    var snapshot = entrySnapshot as SarifSnapshot;

                    if (snapshot != null)
                    {
                        sarifResult = snapshot.GetItem(entryIndex);
                    }
                }

                return sarifResult != null;
            }