예제 #1
0
        internal string GetDescription(ITextBuffer textBuffer, SnapshotPoint point)
        {
            string           description = String.Empty;
            IdentifierSource word        = ReverseParser.ParseIdentifier(point);
            // Try to get description in the file
            Declaration inFileDeclaration = _model.GetDeclaration(word.Identifier, word.Span);

            if (inFileDeclaration != null)
            {
                return(inFileDeclaration.Description);
            }

            // Try to get description in the predefined declarations in xml
            if (_analyzer != null)
            {
                Declaration predefinedDeclaration = _analyzer.GetDeclarationFromPredeined(word.Identifier);
                if (predefinedDeclaration != null)
                {
                    return(predefinedDeclaration.Description);
                }
            }

            // Not find declaration in the file, try to get description from loaded file
            Declaration loadedFileDeclaration = GetDeclarationinIncludedFiles(word.Identifier);

            if (loadedFileDeclaration != null)
            {
                return(loadedFileDeclaration.Description);
            }

            return(description);
        }
예제 #2
0
        internal KeyValuePair <string, ScopeSpan>?GetDeclarationLocation(ITextView textView, SnapshotPoint point)
        {
            IdentifierSource word = ReverseParser.ParseIdentifier(point);

            // Find declaration in its own file
            Declaration res = _model.GetDeclaration(word.Identifier, word.Span);

            if (res != null)
            {
                return(new KeyValuePair <string, ScopeSpan>(_path, res.Scope));
            }
            // Find declaration in files in project
            res = GetDeclarationinIncludedFiles(word.Identifier);
            if (res != null)
            {
                return(new KeyValuePair <string, ScopeSpan>(res.FilePath, res.Scope));
            }
            return(null);
        }