예제 #1
0
        private void CommandEventsOnAfterExecute(string guid, int id1, object customIn, object customOut)
        {
            if (_vsInstance == null)
            {
                return;
            }

            var command = _vsInstance.Commands.Item(guid, id1);

            //string logLine = $"Name:{command.Name} | GUID:{command.Guid} | ID:{command.ID}";
            //Logger.Log(logLine);

            foreach (var actionName in StepActionNames)
            {
                if (command.Name != actionName)
                {
                    continue;
                }
                if (Check == null)
                {
                    OnCheckPass.Fire(true);
                }
                else
                {
                    _shellLocks.QueueReadLock("StepActionChecker.CheckOnAfterAction",
                                              () => _psiFiles.CommitAllDocumentsAsync(CheckCode));
                }
            }
        }
예제 #2
0
        private void RequestShaderContexts(Lifetime lt, IPsiSourceFile sourceFile, Rd.Tasks.RdTask <List <ShaderContextDataBase> > task)
        {
            if (!lt.IsAlive)
            {
                task.SetCancelled();
                return;
            }

            myPsiFiles.CommitAllDocumentsAsync(() =>
            {
                var possibleRoots = myCppGlobalSymbolCache.IncludesGraphCache.CollectPossibleRootsForFile(new CppFileLocation(sourceFile)).ToList();
                var result        = new List <ShaderContextDataBase>();
                foreach (var root in possibleRoots)
                {
                    if (root.IsInjected())
                    {
                        var item = GetContextDataFor(root);
                        if (item != null)
                        {
                            result.Add(item);
                        }
                    }
                }
                task.Set(result);
            }, () => RequestShaderContexts(lt, sourceFile, task));
        }
예제 #3
0
        public void Navigate(TutStep.TutorialStep step)
        {
            if (step.NavNode == null)
            {
                return;
            }

            if (step.NavNode.RunMethod != null)
            {
                RunCustomNavigation(step.NavNode.RunMethod);
                return;
            }

            if (step.NavNode.TypeName == null && step.NavNode.MethodName == null && step.NavNode.TextToFind == null)
            {
                return;
            }

            _shellLocks.ExecuteOrQueueReadLock(_lifetime, "Navigate", () =>
            {
                _psiFiles.CommitAllDocumentsAsync(() =>
                {
                    var project = PsiNavigationHelper.GetProjectByName(_solution, step.NavNode.ProjectName);

                    var file = PsiNavigationHelper.GetCSharpFile(project, step.NavNode.FileName);

                    var node = PsiNavigationHelper.GetTreeNodeForStep(file, step.NavNode.TypeName,
                                                                      step.NavNode.MethodName,
                                                                      step.NavNode.MethodNameOccurrence, step.NavNode.TextToFind, step.NavNode.TextToFindOccurrence);

                    if (node == null)
                    {
                        MessageBox.ShowExclamation("OOPS! Someone has changed the code in an unexpected way. " +
                                                   "That wasn't you, right?;) Anyway, now it would be better to restart tutorial.");
                    }
                    else
                    {
                        PsiNavigationHelper.NavigateToNode(_documentManager, _editorManager, node, true);
                    }
                });
            });
        }
예제 #4
0
 private void OnPsiChanged()
 {
     _shellLocks.QueueReadLock("StepPsiChecker.CheckOnPsiChanged",
                               () => _psiFiles.CommitAllDocumentsAsync(CheckCode));
 }