Beispiel #1
0
        private static void RunCodeAnalysis(object sender, EventArgs e)
        {
            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                try
                {
                    var view = Shell.ActiveView;
                    if (view == null)
                    {
                        return;
                    }

                    var appSettings = ProbeEnvironment.CurrentAppSettings;

                    var fileName = VsTextUtil.TryGetDocumentFileName(view.TextBuffer);

                    var fileStore = CodeModel.FileStore.GetOrCreateForTextBuffer(view.TextBuffer);
                    if (fileStore == null)
                    {
                        return;
                    }
                    var model = fileStore.CreatePreprocessedModel(appSettings, fileName, view.TextSnapshot, false, "Code Analysis");

                    var pane = Shell.CreateOutputPane(GuidList.guidCodeAnalysisPane, "DK Code Analysis");
                    pane.Clear();
                    pane.Show();

                    var ca = new CodeAnalysis.CodeAnalyzer(pane, model);
                    ca.Run();
                }
                catch (Exception ex)
                {
                    Shell.ShowError(ex);
                }
            });
        }
Beispiel #2
0
        private bool _removeHeaderString;                               // Does not inherit on clone

        public RunScope(CodeAnalyzer ca, FunctionDefinition funcDef, int funcOffset)
        {
            _ca         = ca;
            _funcDef    = funcDef;
            _funcOffset = funcOffset;
        }