本文整理汇总了C#中IPsiSourceFile.GetPsiServices方法的典型用法代码示例。如果您正苦于以下问题:C# IPsiSourceFile.GetPsiServices方法的具体用法?C# IPsiSourceFile.GetPsiServices怎么用?C# IPsiSourceFile.GetPsiServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPsiSourceFile
的用法示例。
在下文中一共展示了IPsiSourceFile.GetPsiServices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSupported
private bool IsSupported(IPsiSourceFile sourceFile)
{
if (sourceFile == null || !sourceFile.IsValid())
{
return false;
}
IPsiServices psiServices = sourceFile.GetPsiServices();
IFile psiFile = psiServices.Files.GetDominantPsiFile<CSharpLanguage>(sourceFile);
return psiFile != null && psiFile.Language.Is<CSharpLanguage>();
}
示例2: Process
public void Process(
IPsiSourceFile sourceFile, IRangeMarker rangeMarker,
CodeCleanupProfile profile, IProgressIndicator progressIndicator) {
var settingsStore = sourceFile.GetSettingsStore();
var settings = settingsStore.GetKey<XamlAttributeOrderingSettings>(SettingsOptimization.OptimizeDefault);
if (!profile.GetSetting(DescriptorInstance) || !settings.Enable) {
return;
}
foreach (var xamlFile in sourceFile.GetPsiFiles<XamlLanguage>().OfType<IXamlFile>()) {
sourceFile.GetPsiServices().Transactions.Execute("Code cleanup",
() => {
var comparer = new AttributesComparer(settings);
xamlFile.ProcessDescendants(new ReorderAttributesProcessor(comparer));
});
}
}
开发者ID:kakaruto,项目名称:XamlAttributeOrderingCodeCleanup,代码行数:17,代码来源:XamlAttributeOrderingCodeCleanup.cs
示例3: GetNTriplesFile
public static INTriplesFile GetNTriplesFile(IPsiSourceFile sourceFile)
{
var psiServices = sourceFile.GetPsiServices();
psiServices.Files.AssertAllDocumentAreCommitted();
return psiServices.Files.GetDominantPsiFile<NTriplesLanguage>(sourceFile) as INTriplesFile;
}
示例4: Process
/// <inheritdoc/>
public void Process(
IPsiSourceFile sourceFile,
IRangeMarker rangeMarker,
CodeCleanupProfile profile,
IProgressIndicator progressIndicator)
{
IPsiServices psiServices = sourceFile.GetPsiServices();
IPsiFiles psiFiles = psiServices.Files;
IContextBoundSettingsStore settings = sourceFile.GetSettingsStore();
var orderUsingSettings =
settings.GetKey<OrderUsingsSettings>(SettingsOptimization.DoMeSlowly);
OrderUsingsConfiguration config = null;
if (!string.IsNullOrWhiteSpace(orderUsingSettings.OrderSpecificationXml))
{
config = ConfigurationSerializer.FromXml(new StringReader(orderUsingSettings.OrderSpecificationXml));
}
if (config == null)
{
return;
}
var file = psiFiles.GetDominantPsiFile<CSharpLanguage>(sourceFile) as ICSharpFile;
if (file == null)
{
return;
}
if (!profile.GetSetting(DescriptorInstance))
{
return;
}
file.GetPsiServices().Transactions.Execute(
"Code cleanup",
() =>
{
using (_shellLocks.UsingWriteLock())
{
CleanUsings(file, config);
WalkNamespaceDeclarations(file.NamespaceDeclarations, config);
}
});
}