本文整理汇总了C#中IPsiSourceFile.GetPsiFile方法的典型用法代码示例。如果您正苦于以下问题:C# IPsiSourceFile.GetPsiFile方法的具体用法?C# IPsiSourceFile.GetPsiFile怎么用?C# IPsiSourceFile.GetPsiFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPsiSourceFile
的用法示例。
在下文中一共展示了IPsiSourceFile.GetPsiFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public static IList<DisposeMethodStatus> Build(IPsiSourceFile sourceFile)
{
var file = sourceFile.GetPsiFile<CSharpLanguage>(new DocumentRange(sourceFile.Document, 0)) as ICSharpFile;
if (file == null)
return null;
return Build(file);
}
示例2: 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);
}
示例3: Process
/// <summary>
/// Process clean-up on file.
/// </summary>
/// <param name="projectFile">
/// The project file to process.
/// </param>
/// <param name="rangeMarker">
/// The range marker to process.
/// </param>
/// <param name="profile">
/// The code cleanup settings to use.
/// </param>
/// <param name="progressIndicator">
/// The progress indicator.
/// </param>
public void Process(
IPsiSourceFile projectFile, IRangeMarker rangeMarker, CodeCleanupProfile profile, JB::JetBrains.Application.Progress.IProgressIndicator progressIndicator)
{
if (projectFile == null)
{
return;
}
if (!this.IsAvailable(projectFile))
{
return;
}
ISolution solution = projectFile.GetSolution();
ICSharpFile file = projectFile.GetPsiFile<CSharpLanguage>() as ICSharpFile;
if (file == null)
{
return;
}
PsiManager.GetInstance(solution).DoTransaction(() => this.InternalProcess(profile, file), "Code cleanup");
StyleCopTrace.Out();
}
示例4: IsAvailable
/// <summary>
/// Check if this module can handle given project file.
/// </summary>
/// <param name="projectFile">
/// The project file to check.
/// </param>
/// <returns>
/// <c>True.</c>if the project file is available; otherwise
/// <c>False.</c>.
/// </returns>
public bool IsAvailable(IPsiSourceFile projectFile)
{
return projectFile.GetPsiFile<CSharpLanguage>() != null;
}
示例5: GetPsiFile
private static IFile GetPsiFile(IPsiSourceFile psiSourceFile)
{
return psiSourceFile.GetPsiFile(psiSourceFile.PrimaryPsiLanguage);
}
示例6: GetDeclarationsIn
public static IList<IDeclaration> GetDeclarationsIn(
IPsiSourceFile sourceFile, IUriIdentifierDeclaredElement declaredElement)
{
var psiFile = sourceFile.GetPsiFile<NTriplesLanguage>(new DocumentRange(sourceFile.Document, 0)) as NTriplesFile;
if (psiFile == null)
{
return EmptyList<IDeclaration>.InstanceList;
}
var uri = declaredElement.GetUri();
if (string.IsNullOrEmpty(uri))
{
return EmptyList<IDeclaration>.InstanceList;
}
var uriIdentifiers = psiFile.GetUriIdentifiers(uri);
return uriIdentifiers;
}
示例7: Build
public static ICollection<IPsiSymbol> Build(IPsiSourceFile sourceFile)
{
var file = sourceFile.GetPsiFile<PsiLanguage>(new DocumentRange(sourceFile.Document, 0)) as IPsiFile;
if (file == null)
{
return null;
}
return Build(file);
}