public ProjectInfo(
            NemerleProjectNode projectNode,
            IVsHierarchy hierarchy,
            NemerleLanguageService languageService,
            string fileName,
            string location
            )
        {
            ErrorHelper.ThrowIsNull(languageService, "languageService");
            ErrorHelper.ThrowIsNull(projectNode, "projectNode");
            ErrorHelper.ThrowIsNull(hierarchy, "hierarchy");
            Debug.Assert(projectNode.Site != null);

            LanguageService = languageService;
            _errorList      = new ErrorListProvider(languageService.Site);
            ProjectFullPath = Path.GetFullPath(fileName);
            _projectNode    = projectNode;
            _hierarchy      = hierarchy;

            _engine = EngineFactory.Create(this, new TraceWriter(), false);             // it enables parser working.

            Engine.TypedtreeCreated += delegate
            {
                _buildTypedtreeCount++;
                AstToolWindow tool = AstToolWindow.AstTool;
                if (tool != null)
                {
                    tool.BuildTypedtreeCount = _buildTypedtreeCount;
                }
            };

            if (!string.IsNullOrEmpty(location))
            {
                _projectLocation = location;
            }
            else
            {
                _projectLocation = Path.GetDirectoryName(fileName);
            }

            if (!_projectLocation.EndsWith("\\"))
            {
                _projectLocation += "\\";
            }
        }
Exemple #2
0
        private void ShowAst(IVsTextView view, bool showInfo)
        {
            NemerleSource source = Source as NemerleSource;

            if (source != null && source.ProjectInfo != null)
            {
                int line, col;
                ErrorHandler.ThrowOnFailure(view.GetCaretPos(out line, out col));
                //Debug.WriteLine(
                //		string.Format("OnChangeScrollInfo line={0}, col={1}", line + 1, col + 1));
                AstToolWindow tw = (AstToolWindow)source.ProjectInfo.ProjectNode.Package
                                   .FindToolWindow(typeof(AstToolWindow), 0, true);

                if (showInfo)
                {
                    tw.ShowInfo(source);
                }

                tw.Activate(line + 1, col + 1);
            }
        }