private async Task <(HierarchyId itemid, IVsHierarchy?hierarchy, IVsContainedLanguageFactory?containedLanguageFactory)> GetContainedLanguageFactoryForFileAsync(string filePath)
        {
            await _projectContextHost.PublishAsync();

            await _projectVsServices.ThreadingService.SwitchToUIThread();

            var     priority = new VSDOCUMENTPRIORITY[1];
            HResult result   = _projectVsServices.VsProject.IsDocumentInProject(filePath, out int isFound, priority, out uint itemid);

            if (result.Failed || isFound == 0)
            {
                return(HierarchyId.Nil, null, null);
            }

            Assumes.False(itemid == HierarchyId.Nil);

            IVsContainedLanguageFactory?containedLanguageFactory = await _containedLanguageFactory.GetValueAsync();

            if (containedLanguageFactory == null)
            {
                return(HierarchyId.Nil, null, null);
            }

            return(itemid, _projectVsServices.VsHierarchy, containedLanguageFactory);
        }
        public Task InitializeAsync()
        {
            // While we want make sure it's loaded before PrioritizedProjectLoadedInHost,
            // we don't want to block project factory completion on its load, so fire and forget
            _tasksService.PrioritizedProjectLoadedInHostAsync(() => _activeWorkspaceProjectContextHost.PublishAsync())
            .Forget();

            return(Task.CompletedTask);
        }
Пример #3
0
        public Task InitializeAsync()
        {
            // While we want make sure it's loaded before PrioritizedProjectLoadedInHost,
            // we don't want to block project factory completion on its load, so fire and forget
            Task result = _tasksService.PrioritizedProjectLoadedInHostAsync(() => _activeWorkspaceProjectContextHost.PublishAsync());

            _projectFaultHandler.Forget(result, _project, ProjectFaultSeverity.LimitedFunctionality);

            return(Task.CompletedTask);
        }