本文整理汇总了C#中IPsiSourceFile.GetSolution方法的典型用法代码示例。如果您正苦于以下问题:C# IPsiSourceFile.GetSolution方法的具体用法?C# IPsiSourceFile.GetSolution怎么用?C# IPsiSourceFile.GetSolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPsiSourceFile
的用法示例。
在下文中一共展示了IPsiSourceFile.GetSolution方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public void Process(IPsiSourceFile sourceFile, IRangeMarker rangeMarkerMarker, CodeCleanupProfile profile, IProgressIndicator progressIndicator)
{
ISolution solution = sourceFile.GetSolution();
if (!profile.GetSetting(OurDescriptor))
{
return;
}
IPsiFile[] files = sourceFile.GetPsiFiles<PsiLanguage>().Cast<IPsiFile>().ToArray();
using (progressIndicator.SafeTotal("Reformat Psi", files.Length))
{
foreach (IPsiFile 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: Add
public ITreeNode Add(IPsiSourceFile sourceFile, string text, int start, int len)
{
var name = text.Substring(start, len);
NitraDeclaredElement declaredElement;
if (!_declaredElements.TryGetValue(name.ToLower(), out declaredElement))
declaredElement = new NitraDeclaredElement(sourceFile.GetSolution(), name);
if (name.Length > 0 && char.IsUpper(name[0]))
{
var node = new NitraDeclaration(declaredElement, sourceFile, name, start, len);
declaredElement.AddDeclaration(node);
_declaredElements.Add(name, declaredElement);
return node;
}
else
{
List<NitraNameReference> refs;
if (!_references.TryGetValue(declaredElement, out refs))
{
refs = new List<NitraNameReference>();
_references.Add(declaredElement, refs);
}
var node = new NitraNameReference(sourceFile, name, start, len);
refs.Add(node);
return node;
}
}
示例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: 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, JetBrains.Application.Progress.IProgressIndicator progressIndicator)
{
if (projectFile == null)
{
return;
}
if (!this.IsAvailable(projectFile))
{
return;
}
ISolution solution = projectFile.GetSolution();
ICSharpFile file = projectFile.GetDominantPsiFile<CSharpLanguage>() as ICSharpFile;
if (file == null)
{
return;
}
var services = solution.GetPsiServices();
services.Transactions.Execute("Code cleanup", () => this.InternalProcess(profile, file));
StyleCopTrace.Out();
}
示例5: lock
void ICache.Merge(IPsiSourceFile sourceFile, object builtPart)
{
var values = builtPart as List<IUnitTestElement>;
if (values != null)
{
lock (_lock)
{
_elementsInFiles.RemoveKey(sourceFile);
_elementsInFiles.AddValueRange(sourceFile, values);
}
var xml = "<Serialized></Serialized>";
if (_elementsInFiles[sourceFile].Any())
{
var document = new XmlDocument();
document.LoadXml(xml);
var info = new PersistentUnitTestSessionInfo(sourceFile.GetSolution(), null)
{
Elements = _elementsInFiles[sourceFile]
};
info.WriteToXml(document.DocumentElement);
xml = document.OuterXml;
}
if (_persistentCache != null)
{
_persistentCache.AddDataToSave(sourceFile, xml);
}
}
}
示例6: GetPsiFile
public static IPsiFile GetPsiFile(IPsiSourceFile sourceFile)
{
PsiManager manager = PsiManager.GetInstance(sourceFile.GetSolution());
manager.AssertAllDocumentAreCommited();
return manager.GetPsiFile<PsiLanguage>(new DocumentRange(sourceFile.Document, 0)) as IPsiFile;
}
示例7: CreateHighlightDumper
protected virtual TestHighlightingDumper CreateHighlightDumper(IPsiSourceFile sourceFile, TextWriter writer)
{
return new TestHighlightingDumper(sourceFile, writer, GetActiveStages(sourceFile.GetSolution()), HighlightingPredicate, CompilerIdsLanguage);
}