当前位置: 首页>>代码示例>>C#>>正文


C# ITreeNode.GetContainingFile方法代码示例

本文整理汇总了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;
        }
开发者ID:jv9,项目名称:resharper-angularjs,代码行数:28,代码来源:AngularJsIncludeFileReferenceProvider.cs

示例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);
     }
 }
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:10,代码来源:ContextErrorHighlighterProcess.cs

示例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());
		}
开发者ID:mnaoumov,项目名称:ForTea,代码行数:9,代码来源:T4FileDataCache.cs

示例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());
 }
开发者ID:sscctech,项目名称:ForTea,代码行数:10,代码来源:T4FileDataCache.cs


注:本文中的ITreeNode.GetContainingFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。