本文整理汇总了C#中IPsiSourceFile.GetTheOnlyPsiFile方法的典型用法代码示例。如果您正苦于以下问题:C# IPsiSourceFile.GetTheOnlyPsiFile方法的具体用法?C# IPsiSourceFile.GetTheOnlyPsiFile怎么用?C# IPsiSourceFile.GetTheOnlyPsiFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPsiSourceFile
的用法示例。
在下文中一共展示了IPsiSourceFile.GetTheOnlyPsiFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Analyze
public IEnumerable<RegistrationInfo> Analyze(IPsiSourceFile sourceFile)
{
ICSharpFile cSharpFile;
#if SDK70
cSharpFile = sourceFile.GetTheOnlyPsiFile(CSharpLanguage.Instance) as ICSharpFile;
#else
cSharpFile = sourceFile.GetPsiFile(CSharpLanguage.Instance) as ICSharpFile;
#endif
if (cSharpFile == null)
{
return EmptyList<RegistrationInfo>.InstanceList;
}
var usingStatements = cSharpFile.Imports
.Where(directive => !directive.ImportedSymbolName.QualifiedName.StartsWith("System"))
.Select(directive => directive.ImportedSymbolName.QualifiedName).ToList();
IContainerInfo matchingContainer = GetMatchingContainer(usingStatements);
if (matchingContainer == null)
{
return EmptyList<RegistrationInfo>.InstanceList;
}
ISearchDomain searchDomain = searchDomainFactory.CreateSearchDomain(sourceFile);
return ScanRegistrations(matchingContainer, searchDomain);
}
示例2: Build
public CodeStructureRootElement Build(IPsiSourceFile sourceFile, CodeStructureOptions options) {
var t4File = sourceFile.GetTheOnlyPsiFile(T4Language.Instance) as IT4File;
if (t4File == null)
return null;
// TODO: handle VB
var cSharpFile = sourceFile.GetTheOnlyPsiFile(CSharpLanguage.Instance) as ICSharpFile;
var cSharpFileImpl = cSharpFile as IFileImpl;
if (cSharpFileImpl == null || cSharpFileImpl.SecondaryRangeTranslator == null)
return null;
var state = new CSharpCodeStructureProcessingState(CodeStructureOptions.Default);
var rootElement = new T4CodeStructureRootElement(t4File);
foreach (ITreeNode treeNode in t4File.Children())
ProcessT4Node(treeNode, rootElement, cSharpFile, cSharpFileImpl.SecondaryRangeTranslator, state);
return rootElement;
}
示例3:
object ICache.Build(IPsiSourceFile sourceFile, bool isStartup)
{
if (!CanHandle(sourceFile))
{
return null;
}
var dominantPsiFile = sourceFile.GetTheOnlyPsiFile(JavaScriptLanguage.Instance);
if (dominantPsiFile == null)
{
return null;
}
var explored = new List<IUnitTestElement>();
var transitiveDependencies = _javaScriptDependencyManager.GetTransitiveDependencies(sourceFile);
ExploreJasmine(transitiveDependencies, dominantPsiFile, explored);
return explored;
}
示例4: GetPsiFile
private IFile GetPsiFile(IPsiSourceFile psiSourceFile)
{
return psiSourceFile.GetTheOnlyPsiFile(psiSourceFile.PrimaryPsiLanguage);
}