public void FireEvents(DocumentId documentId, CancellationToken cancellationToken)
            {
                var project = _workspace.ProjectTracker.GetProject(documentId.ProjectId);

                if (project == null)
                {
                    return;
                }

                var codeModelProvider = project as IProjectCodeModelProvider;

                if (codeModelProvider == null)
                {
                    return;
                }

                var filename = _workspace.GetFilePath(documentId);

                if (filename == null)
                {
                    return;
                }

                ComHandle <EnvDTE80.FileCodeModel2, FileCodeModel> fileCodeModelHandle;

                if (!codeModelProvider.ProjectCodeModel.TryGetCachedFileCodeModel(filename, out fileCodeModelHandle))
                {
                    return;
                }

                var codeModel = fileCodeModelHandle.Object;

                _notificationService.RegisterNotification(() => codeModel.FireEvents(), _listener.BeginAsyncOperation("CodeModelEvent"), cancellationToken);
            }
예제 #2
0
            public void FireEvents(DocumentId documentId, CancellationToken cancellationToken)
            {
                _notificationService.RegisterNotification(() =>
                {
                    var project = _workspace.DeferredState.ProjectTracker.GetProject(documentId.ProjectId);
                    if (project == null)
                    {
                        return(false);
                    }

                    var codeModelProvider = project as IProjectCodeModelProvider;
                    if (codeModelProvider == null)
                    {
                        return(false);
                    }

                    var filename = _workspace.GetFilePath(documentId);
                    if (filename == null)
                    {
                        return(false);
                    }

                    if (!codeModelProvider.ProjectCodeModel.TryGetCachedFileCodeModel(filename, out var fileCodeModelHandle))
                    {
                        return(false);
                    }

                    var codeModel = fileCodeModelHandle.Object;
                    return(codeModel.FireEvents());
                },
                                                          _listener.BeginAsyncOperation("CodeModelEvent"),
                                                          cancellationToken);
            }
예제 #3
0
            public void FireEvents(DocumentId documentId, CancellationToken cancellationToken)
            {
                var project = _workspace.ProjectTracker.GetProject(documentId.ProjectId);

                if (project == null)
                {
                    return;
                }

                var codeModelProvider = project as IProjectCodeModelProvider;

                if (codeModelProvider == null)
                {
                    return;
                }

                var filename = _workspace.GetFilePath(documentId);

                if (filename == null)
                {
                    return;
                }

                var fileCodeModel = codeModelProvider.ProjectCodeModel.GetFileCodeModelInstance(filename);

                if (fileCodeModel == null)
                {
                    return;
                }

                var codeModel = fileCodeModel.Value.Object;

                _notificationService.RegisterNotification(() => codeModel.FireEvents(), _listener.BeginAsyncOperation("CodeModelEvent"), cancellationToken);
            }