Exemplo n.º 1
0
        public CSharpProjectShim(
            ICSharpProjectRoot projectRoot,
            VisualStudioProjectTracker projectTracker,
            Func <ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt,
            string projectSystemName,
            IVsHierarchy hierarchy,
            IServiceProvider serviceProvider,
            VisualStudioWorkspaceImpl visualStudioWorkspaceOpt,
            HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt,
            ICommandLineParserService commandLineParserServiceOpt)
            : base(projectTracker,
                   reportExternalErrorCreatorOpt,
                   projectSystemName,
                   hierarchy,
                   LanguageNames.CSharp,
                   serviceProvider,
                   visualStudioWorkspaceOpt,
                   hostDiagnosticUpdateSourceOpt,
                   commandLineParserServiceOpt)
        {
            _projectRoot = projectRoot;
            _warningNumberArrayPointer = Marshal.AllocHGlobal(0);

            // Ensure the default options are set up
            ResetAllOptions();
            UpdateOptions();

            projectTracker.AddProject(this);

            ProjectCodeModel = new ProjectCodeModel(this.Id, this, visualStudioWorkspaceOpt, ServiceProvider);
        }
 public int CreateFileCodeModel(
     string fileName,
     object parent,
     out EnvDTE.FileCodeModel ppFileCodeModel
     )
 {
     ppFileCodeModel = ProjectCodeModel.GetOrCreateFileCodeModel(fileName, parent);
     return(VSConstants.S_OK);
 }
Exemplo n.º 3
0
        public EnvDTE.FileCodeModel GetFileCodeModel(EnvDTE.ProjectItem item)
        {
            if (!item.TryGetFullPath(out var filePath))
            {
                return(null);
            }

            return(ProjectCodeModel.GetOrCreateFileCodeModel(filePath, item));
        }
Exemplo n.º 4
0
        public virtual void Disconnect()
        {
            _batchScopeCreator.StopTrackingProject(VisualStudioProject);

            VisualStudioProjectOptionsProcessor?.Dispose();
            ProjectCodeModel.OnProjectClosed();
            VisualStudioProject.RemoveFromWorkspace();

            // Unsubscribe IVsHierarchyEvents
            DisconnectHierarchyEvents();
        }
Exemplo n.º 5
0
        protected void RemoveFile(string filename)
        {
            // We have tests that assert that XOML files should not get added; this was similar
            // behavior to how ASP.NET projects would add .aspx files even though we ultimately ignored
            // them. XOML support is planned to go away for Dev16, but for now leave the logic there.
            if (filename.EndsWith(".xoml"))
            {
                return;
            }

            VisualStudioProject.RemoveSourceFile(filename);
            ProjectCodeModel.OnSourceFileRemoved(filename);
        }
Exemplo n.º 6
0
        public CPSProject(
            VisualStudioProjectTracker projectTracker,
            Func <ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt,
            string projectDisplayName,
            string projectFilePath,
            IVsHierarchy hierarchy,
            string language,
            Guid projectGuid,
            string binOutputPath,
            IServiceProvider serviceProvider,
            VisualStudioWorkspaceImpl visualStudioWorkspaceOpt,
            HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt,
            ICommandLineParserService commandLineParserServiceOpt)
            : base(projectTracker, reportExternalErrorCreatorOpt, projectDisplayName, projectFilePath,
                   hierarchy, language, projectGuid, serviceProvider, visualStudioWorkspaceOpt, hostDiagnosticUpdateSourceOpt, commandLineParserServiceOpt)
        {
            // We need to ensure that the bin output path for the project has been initialized before we hookup the project with the project tracker.
            NormalizeAndSetBinOutputPathAndRelatedData(binOutputPath);

            // Now hook up the project to the project tracker.
            projectTracker.AddProject(this);

            ProjectCodeModel = new ProjectCodeModel(this.Id, new CPSCodeModelInstanceFactory(this), (VisualStudioWorkspaceImpl)this.Workspace, ServiceProvider);
        }
 public int CreateCodeModel(object parent, out EnvDTE.CodeModel codeModel)
 {
     codeModel = ProjectCodeModel.GetOrCreateRootCodeModel((EnvDTE.Project)parent);
     return(VSConstants.S_OK);
 }
Exemplo n.º 8
0
 public EnvDTE.CodeModel GetCodeModel(EnvDTE.Project parent)
 {
     return(ProjectCodeModel.GetOrCreateRootCodeModel(parent));
 }