本文整理汇总了C#中IPsiSourceFile.GetPsiFiles方法的典型用法代码示例。如果您正苦于以下问题:C# IPsiSourceFile.GetPsiFiles方法的具体用法?C# IPsiSourceFile.GetPsiFiles怎么用?C# IPsiSourceFile.GetPsiFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPsiSourceFile
的用法示例。
在下文中一共展示了IPsiSourceFile.GetPsiFiles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public void Process(
IPsiSourceFile sourceFile,
IRangeMarker rangeMarkerMarker,
CodeCleanupProfile profile,
IProgressIndicator progressIndicator)
{
ISolution solution = sourceFile.GetSolution();
if (!profile.GetSetting(OurDescriptor))
{
return;
}
INTriplesFile[] files = sourceFile.GetPsiFiles<NTriplesLanguage>().Cast<INTriplesFile>().ToArray();
using (progressIndicator.SafeTotal("Reformat Psi", files.Length))
{
foreach (INTriplesFile file in files)
{
using (IProgressIndicator pi = progressIndicator.CreateSubProgress(1))
{
using (WriteLockCookie.Create())
{
var languageService = file.Language.LanguageService();
Assertion.Assert(languageService != null, "languageService != null");
var formatter = languageService.CodeFormatter;
Assertion.Assert(formatter != null, "formatter != null");
PsiManager.GetInstance(sourceFile.GetSolution()).DoTransaction(
delegate
{
if (rangeMarkerMarker != null && rangeMarkerMarker.IsValid)
{
formatter.Format(
solution,
rangeMarkerMarker.DocumentRange,
CodeFormatProfile.DEFAULT,
true,
false,
pi);
}
else
{
formatter.FormatFile(
file,
CodeFormatProfile.DEFAULT,
pi);
}
},
"Code cleanup");
}
}
}
}
}
示例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: IsAvailable
public bool IsAvailable(IPsiSourceFile sourceFile) {
var settingsStore = sourceFile.GetSettingsStore();
return settingsStore.GetValue((XamlAttributeOrderingSettings x) => x.Enable)
&& sourceFile.GetPsiFiles<XamlLanguage>().Any();
}
开发者ID:kakaruto,项目名称:XamlAttributeOrderingCodeCleanup,代码行数:5,代码来源:XamlAttributeOrderingCodeCleanup.cs
示例4: IsAvailable
/// <inheritdoc/>
public bool IsAvailable(IPsiSourceFile sourceFile)
{
return sourceFile.GetPsiFiles<CSharpLanguage>().Any();
}