本文整理汇总了C#中ITreeNode.GetContainingFile方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode.GetContainingFile方法的具体用法?C# ITreeNode.GetContainingFile怎么用?C# ITreeNode.GetContainingFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeNode
的用法示例。
在下文中一共展示了ITreeNode.GetContainingFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasReference
protected override bool HasReference(ITreeNode element, ICollection<string> 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;
}
示例2: AddHighLighting
private void AddHighLighting(
DocumentRange range, ITreeNode element, IHighlightingConsumer consumer, IHighlighting highlighting)
{
var info = new HighlightingInfo(range, highlighting, new Severity?());
IFile file = element.GetContainingFile();
if (file != null)
{
consumer.AddHighlighting(info.Highlighting, file);
}
}
示例3: OnPsiChanged
/// <summary>
/// Called when a PSI element changes.
/// </summary>
/// <param name="treeNode">The tree node that changed.</param>
/// <param name="psiChangedElementType">The type of the PSI change.</param>
private void OnPsiChanged(ITreeNode treeNode, PsiChangedElementType psiChangedElementType) {
if (treeNode != null && psiChangedElementType == PsiChangedElementType.ContentsChanged)
OnPsiFileChanged(treeNode.GetContainingFile());
}
示例4: OnPhysicalPsiChanged
/// <summary>
/// Called when a PSI file changes.
/// </summary>
/// <param name="treeNode">The tree node that changed.</param>
/// <param name="psiChangedElementType">The type of the PSI change.</param>
private void OnPhysicalPsiChanged(ITreeNode treeNode, PsiChangedElementType psiChangedElementType)
{
if (treeNode != null && psiChangedElementType == PsiChangedElementType.CONTENTS_CHANGED)
OnPsiFileChanged(treeNode.GetContainingFile());
}