Пример #1
0
        public NemerleContainedLanguage(IVsTextBufferCoordinator bufferCoordinator, NemerleIntellisenseProvider intellisenseProject, uint itemId, IVsHierarchy pHierarchy)
        {
            if (null == bufferCoordinator)
            {
                throw new ArgumentNullException("bufferCoordinator");
            }
            if (null == intellisenseProject)
            {
                throw new ArgumentNullException("intellisenseProject");
            }
            _hierarchy = pHierarchy;

            object projectItem = null;

            pHierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_ExtObject, out projectItem);

            _projectItem = projectItem as EnvDTE.ProjectItem;

            EnvDTE.Property prop = _projectItem.Properties.Item("FullPath");
            if (prop != null)
            {
                _filePath = prop.Value as string;
            }

            var project = _projectItem.ContainingProject as NemerleOAProject;

            if (project != null)
            {
                _projectInfo = ((NemerleProjectNode)project.Project).ProjectInfo;
            }

            _typeResolutionService = null;
            DynamicTypeService typeService = LanguageService.GetService(typeof(DynamicTypeService)) as DynamicTypeService;

            if (typeService != null)
            {
                _typeResolutionService = typeService.GetTypeResolutionService(this._hierarchy);
            }

            this.bufferCoordinator   = bufferCoordinator;
            this.intellisenseProject = intellisenseProject;
            this.itemId = itemId;

            // Make sure that the secondary buffer uses the IronPython language service.
            IVsTextLines buffer;

            ErrorHandler.ThrowOnFailure(bufferCoordinator.GetSecondaryBuffer(out buffer));

            Guid languageGuid;

            this.GetLanguageServiceID(out languageGuid);
            ErrorHandler.ThrowOnFailure(buffer.SetLanguageServiceID(ref languageGuid));

            _documentClosingEventHandler = new _dispDocumentEvents_DocumentClosingEventHandler(OnDocumentClosing);
        }
Пример #2
0
        public NemerleContainedLanguage(IVsTextBufferCoordinator bufferCoordinator, NemerleIntellisenseProvider intellisenseProject, uint itemId, IVsHierarchy pHierarchy)
        {
            if (null == bufferCoordinator)
            {
                throw new ArgumentNullException("bufferCoordinator");
            }
            if (null == intellisenseProject)
            {
                throw new ArgumentNullException("intellisenseProject");
            }
            _hierarchy = pHierarchy;

            object projectItem = null;
            pHierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_ExtObject, out projectItem);

            _projectItem = projectItem as EnvDTE.ProjectItem;

            EnvDTE.Property prop = _projectItem.Properties.Item("FullPath");
            if (prop != null)
                _filePath = prop.Value as string;

            var project = _projectItem.ContainingProject as NemerleOAProject;
            if(project != null)
            {
                _projectInfo = ((NemerleProjectNode)project.Project).ProjectInfo;
            }

            _typeResolutionService = null;
            DynamicTypeService typeService = LanguageService.GetService(typeof(DynamicTypeService)) as DynamicTypeService;
            if (typeService != null)
                _typeResolutionService = typeService.GetTypeResolutionService(this._hierarchy);

            this.bufferCoordinator = bufferCoordinator;
            this.intellisenseProject = intellisenseProject;
            this.itemId = itemId;

            // Make sure that the secondary buffer uses the IronPython language service.
            IVsTextLines buffer;
            ErrorHandler.ThrowOnFailure(bufferCoordinator.GetSecondaryBuffer(out buffer));

            Guid languageGuid;
            this.GetLanguageServiceID(out languageGuid);
            ErrorHandler.ThrowOnFailure(buffer.SetLanguageServiceID(ref languageGuid));

            _documentClosingEventHandler = new _dispDocumentEvents_DocumentClosingEventHandler(OnDocumentClosing);
        }