protected override bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            var stringLiteral = element as IJavaScriptLiteralExpression;

            if (stringLiteral == null)
            {
                return(false);
            }

            var file = element.GetContainingFile();

            if (file == null)
            {
                return(false);
            }

            // TODO: We can't use this, due to losing data when we reparse for code completion
            // When we start code completion, the tree node is reparsed with new text inserted,
            // so that references have something to attach to. Reparsing works with IChameleon
            // blocks that allow for resync-ing in-place. Our AngularJs nodes don't have any
            // chameleon blocks (for JS, it's the Block class - anything with braces) so we end
            // up re-parsing the file. This creates a new IFile, (in a sandbox that allows access
            // to the original file's reference provider) but it doesn't copy the user data. We
            // could theoretically look for a containing sandbox, get the context node and try
            // and get the user data there, but that just makes it feel like this is the wrong
            // solution. I think maybe this should be a reference provider for HTML, not AngularJs.
            // It would have the context of the attribute name, but should really work with the
            // injected AngularJs language, if only to see that it's a string literal
            //var originalAttributeType = file.UserData.GetData(AngularJsFileData.OriginalAttributeType);
            //if (originalAttributeType != elementTypes.AngularJsUrlType.Name)
            //    return false;

            return(true);
        }
        protected override bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            var stringLiteral = element as IJavaScriptLiteralExpression;
            if (stringLiteral == null)
                return false;

            var file = element.GetContainingFile();
            if (file == null)
                return false;

            // TODO: We can't use this, due to losing data when we reparse for code completion
            // When we start code completion, the tree node is reparsed with new text inserted,
            // so that references have something to attach to. Reparsing works with IChameleon
            // blocks that allow for resync-ing in-place. Our AngularJs nodes don't have any
            // chameleon blocks (for JS, it's the Block class - anything with braces) so we end
            // up re-parsing the file. This creates a new IFile, (in a sandbox that allows access
            // to the original file's reference provider) but it doesn't copy the user data. We
            // could theoretically look for a containing sandbox, get the context node and try
            // and get the user data there, but that just makes it feel like this is the wrong
            // solution. I think maybe this should be a reference provider for HTML, not AngularJs.
            // It would have the context of the attribute name, but should really work with the
            // injected AngularJs language, if only to see that it's a string literal
            //var originalAttributeType = file.UserData.GetData(AngularJsFileData.OriginalAttributeType);
            //if (originalAttributeType != elementTypes.AngularJsUrlType.Name)
            //    return false;

            return true;
        }
        protected NamedThingsSearchSourceFileProcessorWorkaround(ITreeNode root, ICollection <string> wordsInText,
                                                                 ICollection <string> referenceNames, IDeclaredElementsSet elements)
        {
            myRoot = root;
            myReferenceProvider = GetReferenceProvider2((TreeElement)root);
            myElements          = elements;

            var languageService = root.Language.LanguageService();

            if (languageService != null)
            {
                myCaseSensitive = languageService.IsCaseSensitive;
            }
            myCaseSensitive = myCaseSensitive && elements.CaseSensitive;

            if (wordsInText != null && wordsInText.Count > 0)
            {
                myStringSearchers = wordsInText.Where(word => !string.IsNullOrEmpty(word))
                                    .Select(word => new StringSearcher(word, myCaseSensitive)).ToArray();
            }

            if (referenceNames != null && referenceNames.Count > 0)
            {
                myReferenceNameContainer = new ReferenceNameContainer(referenceNames, myCaseSensitive);
            }
        }
 public bool HasReference(ITreeNode element, IReferenceNameContainer names)
 {
     var literal = element as ILiteralExpression;
     if (literal != null && literal.ConstantValue.IsString())
         return names.Contains((string) literal.ConstantValue.Value);
     return false;
 }
Exemplo n.º 5
0
 public bool HasReference(ITreeNode element, IReferenceNameContainer names)
 {
     if (element is IJavaScriptLiteralExpression literal && literal.IsStringLiteral())
     {
         return(names.Contains(literal.GetStringValue() ?? string.Empty));
     }
     return(false);
 }
 public bool HasReference(ITreeNode element, IReferenceNameContainer names)
 {
     if (element is IPlainScalarNode methodNameValue && CanHaveReference(methodNameValue))
     {
         return(names.Contains(methodNameValue.Text.GetText()));
     }
     return(false);
 }
 public virtual bool HasReference(ITreeNode element, IReferenceNameContainer names)
 {
     if (element is ILiteralExpression literal && literal.ConstantValue.IsString())
     {
         return(names.Contains((string)literal.ConstantValue.Value));
     }
     return(false);
 }
Exemplo n.º 8
0
 public bool HasReference(ITreeNode element, IReferenceNameContainer names)
 {
     if (element is IJsonNewLiteralExpression literal && literal.ConstantValueType == ConstantValueTypes.String)
     {
         return(names.Contains(literal.GetStringValue() ?? string.Empty));
     }
     return(false);
 }
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            if (!(element is VarNode && element.Parent is FDecl))
            {
                return(false);
            }

            return(names.Contains(((VarNode)element).GetText()));
        }
Exemplo n.º 10
0
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            var literalExpression = element as ILiteralExpression;
              if (literalExpression == null)
            return false;

              var referenceName = literalExpression.ConstantValue.Value as string;
              return referenceName != null && names.Contains(referenceName);
        }
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            if (!(element is SpringNodeIdentifier variable))
            {
                return(false);
            }
            var name = variable.GetText();

            return(names.Contains(name));
        }
Exemplo n.º 12
0
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            if (element is SpringVariableReferenceElement refElem)
            {
                string name = refElem.GetText();
                return(names.Contains(name));
            }

            return(false);
        }
        // Names is likely to contain the name of the class. All we have in the file is the guid
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            var guidValue         = element as IPlainScalarNode;
            var guidEntry         = FlowMapEntryNavigator.GetByValue(guidValue);
            var flowIDMap         = FlowMappingNodeNavigator.GetByEntrie(guidEntry);
            var blockMappingEntry = BlockMappingEntryNavigator.GetByValue(flowIDMap);

            return(guidEntry?.Key.MatchesPlainScalarText("guid") == true &&
                   blockMappingEntry?.Key.MatchesPlainScalarText("m_Script") == true);
        }
Exemplo n.º 14
0
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            if (element is PascalVariable variable)
            {
                var name = variable.GetText();
                return(names.Contains(name));
            }

            return(false);
        }
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            var literal = element as ILiteralExpression;

            if (literal != null && literal.ConstantValue.IsString())
            {
                return(names.Contains((string)literal.ConstantValue.Value));
            }
            return(false);
        }
Exemplo n.º 16
0
        public override bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            if (element is ILiteralExpression literal && literal.ConstantValue.IsString())
            {
                // Note that this is case insensitive. I don't think it really matters, as resolving will handle case
                // insensitivity correctly
                return(names.HasAnyNameIn((string)literal.ConstantValue.Value));
            }

            return(false);
        }
Exemplo n.º 17
0
        public bool HasReference(ITreeNode element, IReferenceNameContainer names)
        {
            var literalExpression = element as ILiteralExpression;

            if (literalExpression == null)
            {
                return(false);
            }

            var referenceName = literalExpression.ConstantValue.Value as string;

            return(referenceName != null && names.Contains(referenceName));
        }
Exemplo n.º 18
0
 public bool HasReference(ITreeNode element, IReferenceNameContainer names)
 {
     return(element is SpringReferenceNodeElement reference && names.Contains(reference.GetText()));
 }
Exemplo n.º 19
0
 public bool HasReference(ITreeNode element, IReferenceNameContainer names)
 {
     return(false);
 }
Exemplo n.º 20
0
 public bool HasReference(ITreeNode element, IReferenceNameContainer names) =>
 !GetReferences(element, ReferenceCollection.Empty).IsEmpty;