public override ResolveResultWithInfo ResolveWithoutCache() { ISymbolTable table = GetReferenceSymbolTable(true); IList <DeclaredElementInstance> elements = new List <DeclaredElementInstance>(); { IList <ISymbolInfo> infos = table.GetSymbolInfos(GetName()); foreach (ISymbolInfo info in infos) { var element = new DeclaredElementInstance(info.GetDeclaredElement(), EmptySubstitution.INSTANCE); elements.Add(element); } } if (elements.Count == 0) { var ruleName = myOwner as RuleName; if (PsiTreeUtil.HasParent <InterfacesDefinition>(myOwner) && (ruleName != null)) { elements = new List <DeclaredElementInstance> { new DeclaredElementInstance(new UnresolvedRuleInterfacesDeclaredElement(ruleName.GetSourceFile(), GetName(), myOwner.GetPsiServices())) }; } } return(new ResolveResultWithInfo(ResolveResultFactory.CreateResolveResultFinaly(elements), ResolveErrorType.OK)); }
public override IReference BindTo(IDeclaredElement element) { var namespacePrefix = (IPrefixUri)this.GetTreeNode(); if (namespacePrefix.Parent != null) { PsiTreeUtil.ReplaceChild(namespacePrefix, namespacePrefix.FirstChild, element.ShortName); namespacePrefix.SetName(element.ShortName); } return(this); }
public override IReference BindTo(IDeclaredElement element) { var variableName = (IVariableName)GetTreeNode(); if (variableName.Parent != null) { PsiTreeUtil.ReplaceChild(variableName, variableName.FirstChild, element.ShortName); variableName.SetName(element.ShortName); } return(this); }
public override IReference BindTo(IDeclaredElement element) { var uriString = (IUriString)this.GetTreeNode(); if (uriString.Parent != null) { PsiTreeUtil.ReplaceChild(uriString, uriString.FirstChild, element.ShortName); uriString.SetReferenceName(element.ShortName); } return(this); }
public override IReference BindTo(IDeclaredElement element) { var localName = (ILocalName)this.GetTreeNode(); if (localName.Parent != null) { PsiTreeUtil.ReplaceChild(localName, localName.FirstChild, element.ShortName); localName.SetReferenceName(element.ShortName); } return(this); }
public override IReference BindTo(IDeclaredElement element) { var optionName = (IOptionName)GetTreeNode(); if (optionName.Parent != null && optionName.FirstChild != null) { if (!(element.ShortName.Equals(optionName.FirstChild.GetText()))) { PsiTreeUtil.ReplaceChild(optionName, optionName.FirstChild, element.ShortName); } } return(this); }
public override IReference BindTo(IDeclaredElement element) { var pathName = (IPathName)GetTreeNode(); if (pathName.Parent != null) { PsiTreeUtil.ReplaceChild(pathName, pathName.FirstChild, element.ShortName); } IReference reference = new PsiPathReference(pathName); pathName.SetReference(reference); return(reference); }
public override IReference BindTo(IDeclaredElement element) { var optionName = (IRoleName)GetTreeNode(); if (optionName.Parent != null) { if (((RoleDeclaredElement)element).ChangeName) { PsiTreeUtil.ReplaceChild(optionName, optionName.FirstChild, ((RoleDeclaredElement)element).NewName); } } return(this); }
public override void VisitRuleDeclaration(IRuleDeclaration ruleDeclaration, IHighlightingConsumer consumer) { IRuleBody body = ruleDeclaration.Body; ITreeNode child = PsiTreeUtil.GetFirstChild <IRuleName>(body); var ruleName = child as IRuleName; if (ruleName != null) { if (ruleName.GetText().Equals(ruleDeclaration.DeclaredName)) { consumer.AddHighlighting(new LeftRecursionWarning(ruleName), File); } } base.VisitRuleDeclaration(ruleDeclaration, consumer); }
public override void VisitPsiExpression(IPsiExpression psiExpression, IHighlightingConsumer consumer) { ITreeNode child = psiExpression.FirstChild; IList <ISequence> list = new List <ISequence>(); while (child != null) { if (child is ISequence) { list.Add(child as ISequence); } if (child is IChoiceTail) { list.Add((child as IChoiceTail).Sequence); } child = child.NextSibling; } if (list.Count > 1) { ISequence[] sequences = list.ToArray(); var isRepeated = new bool[sequences.Count()]; for (int i = 0; i < sequences.Count() - 1; ++i) { if (!isRepeated[i]) { ISequence sequence1 = sequences[i]; for (int j = i + 1; j < sequences.Count(); ++j) { ISequence sequence2 = sequences[j]; if (PsiTreeUtil.EqualsElements(sequence1, sequence2)) { if (!isRepeated[i]) { consumer.AddHighlighting(new RepeatedChoiceWarning(sequence1), File); isRepeated[i] = true; } consumer.AddHighlighting(new RepeatedChoiceWarning(sequence2), File); isRepeated[j] = true; } } } } } base.VisitPsiExpression(psiExpression, consumer); }
public void SetName(string name) { PsiTreeUtil.ReplaceChild(PathName, PathName.FirstChild, name); }
protected override IReference BindToInternal(IDeclaredElement declaredElement, ISubstitution substitution) { PsiTreeUtil.ReplaceChild(myOwner, myOwner.FirstChild, declaredElement.ShortName); return(this); }
public void SetName(string name) { PsiTreeUtil.ReplaceChild(this.PrefixName, this.PrefixName.FirstChild, name); }
public void SetName(string name) { Assertion.Assert(FirstChild != null, "FirstChild != null"); PsiTreeUtil.ReplaceChild(FirstChild, FirstChild.FirstChild, name); }
public void SetName(string name) { PsiTreeUtil.ReplaceChild(this, this.Value, name); }