示例#1
0
 public AnalysisEntry(string path)
 {
     _analyzer = null;
     _path     = path;
     _fileId   = 0;
     _parser   = new Parser(LuaGrammar.Instance);
     InitModel();
 }
示例#2
0
 public AnalysisEntry(ProjectAnalyzer analyzer, string path, int fileId)
 {
     _analyzer = analyzer;
     _path     = path;
     _fileId   = fileId;
     _parser   = new Parser(LuaGrammar.Instance);
     InitModel();
 }
示例#3
0
        public void SetAnalyzer(ITextBuffer textBuffer, ProjectAnalyzer analyzer)
        {
            if (textBuffer == null)
            {
                throw new ArgumentNullException(nameof(textBuffer));
            }

            if (analyzer == null)
            {
                textBuffer.Properties.RemoveProperty(typeof(ProjectAnalyzer));
                return;
            }

            textBuffer.Properties[typeof(ProjectAnalyzer)] = analyzer;
        }
示例#4
0
        public bool TryGetAnalyzer(ITextView textView, out ProjectAnalyzer analyzer, out string filename)
        {
            if (textView == null)
            {
                throw new ArgumentNullException(nameof(textView));
            }

            // Try to get the analyzer from the main text buffer
            if (TryGetAnalyzer(textView.TextBuffer, out analyzer, out filename))
            {
                return(true);
            }

            analyzer = null;
            filename = null;
            return(false);
        }
示例#5
0
        public bool TryGetAnalyzer(ITextBuffer textBuffer, out ProjectAnalyzer analyzer, out string filename)
        {
            if (textBuffer == null)
            {
                throw new ArgumentNullException(nameof(textBuffer));
            }

            // If we have set an analyzer explicitly, return that
            analyzer = null;
            if (textBuffer.Properties.TryGetProperty(typeof(ProjectAnalyzer), out analyzer))
            {
                filename = textBuffer.GetFilePath();
                return(analyzer != null);
            }

            analyzer = null;
            filename = null;
            return(false);
        }