本文整理汇总了C#中IPsiSourceFile类的典型用法代码示例。如果您正苦于以下问题:C# IPsiSourceFile类的具体用法?C# IPsiSourceFile怎么用?C# IPsiSourceFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPsiSourceFile类属于命名空间,在下文中一共展示了IPsiSourceFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public static CachePair Read(BinaryReader reader, IPsiSourceFile sourceFile)
{
IList<PsiRuleSymbol> ruleData = ReadRules(reader, sourceFile);
IList<PsiOptionSymbol> optionData = ReadOptions(reader, sourceFile);
return new CachePair(ruleData, optionData);
}
示例2: XXLanguageXXFile
public XXLanguageXXFile(FileStatistics statistics, IPsiSourceFile psiSourceFile, XXLanguageXXProject project)
: base(null)// TODO: add statistics
{
_psiSourceFile = psiSourceFile;
_fullName = psiSourceFile.GetLocation().FullPath;
_project = project;
}
示例3: GetMixedLexerFactory
public ILexerFactory GetMixedLexerFactory(IBuffer buffer, IPsiSourceFile sourceFile, PsiManager manager)
{
var LanguageService = RaconteurLanguage.Instance.LanguageService();
return LanguageService == null ? null
: LanguageService.GetPrimaryLexerFactory();
}
示例4: lock
void ICache.MarkAsDirty(IPsiSourceFile sourceFile)
{
lock (lockObject)
{
dirtyFiles.Add(sourceFile);
}
}
示例5: 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;
}
}
示例6: 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);
}
示例7: T4Parser
internal T4Parser([NotNull] T4Environment t4Environment, [NotNull] DirectiveInfoManager directiveInfoManager, [NotNull] ILexer lexer,
[CanBeNull] IPsiSourceFile sourceFile) {
_t4Environment = t4Environment;
_directiveInfoManager = directiveInfoManager;
_lexer = lexer;
_sourceFile = sourceFile;
}
示例8: 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);
}
示例9: IsSupported
protected override bool IsSupported(IPsiSourceFile sourceFile)
{
if (sourceFile == null || !sourceFile.IsValid())
return false;
return sourceFile.IsLanguageSupported<CSharpLanguage>();
}
示例10: GetSelectedRange
public ISelectedRange GetSelectedRange(IPsiSourceFile sourceFile, DocumentRange documentRange) {
Pair<IT4File, IFile> pair = GetFiles(sourceFile, documentRange);
IT4File t4File = pair.First;
IFile codeBehindFile = pair.Second;
if (t4File == null)
return null;
ITreeNode t4Node = t4File.FindNodeAt(documentRange);
if (t4Node == null)
return null;
// if the current selection is inside C# code, use the C# extend selection directly
if (codeBehindFile != null) {
ISelectEmbracingConstructProvider codeBehindProvider = PsiShared.GetComponent<PsiProjectFileTypeCoordinator>()
.GetByPrimaryPsiLanguageType(codeBehindFile.Language)
.SelectNotNull(fileType => Shell.Instance.GetComponent<IProjectFileTypeServices>().TryGetService<ISelectEmbracingConstructProvider>(fileType))
.FirstOrDefault();
if (codeBehindProvider != null) {
ISelectedRange codeBehindRange = codeBehindProvider.GetSelectedRange(sourceFile, documentRange);
if (codeBehindRange != null)
return new T4CodeBehindWrappedSelection(t4File, codeBehindRange);
}
}
return new T4NodeSelection(t4File, t4Node);
}
示例11: SaveInvocationData
private static void SaveInvocationData(ControlFlowElementData data, IVariableDeclaration variable,
byte position, string name, int offset, IPsiSourceFile sourceFile)
{
data[variable] = VariableDisposeStatus.DependsOnInvocation;
var invokedExpression = new InvokedExpressionData(name, offset, position, sourceFile);
data.InvokedExpressions.Add(variable, invokedExpression);
}
示例12: IsSupported
protected static bool IsSupported(IPsiSourceFile sourceFile)
{
if (sourceFile == null || !sourceFile.IsValid())
return false;
return sourceFile.IsLanguageSupported<AngularJsLanguage>();
}
示例13: PsiOptionSymbol
public PsiOptionSymbol(string name, int offset, string value, IPsiSourceFile psiSourceFile)
{
myName = name;
myOffset = offset;
myValue = value;
myPsiSourceFile = psiSourceFile;
}
示例14: Process
public void Process(IPsiSourceFile sourceFile, IRangeMarker rangeMarker, CodeCleanupProfile profile, IProgressIndicator progressIndicator)
{
var file = sourceFile.GetNonInjectedPsiFile<CSharpLanguage>();
if (file == null)
return;
if (!profile.GetSetting(DescriptorInstance))
return;
CSharpElementFactory elementFactory = CSharpElementFactory.GetInstance(sourceFile.PsiModule);
file.GetPsiServices().PsiManager.DoTransaction(
() =>
{
using (_shellLocks.UsingWriteLock())
file.ProcessChildren<IExpression>(
expression =>
{
ConstantValue value = expression.ConstantValue;
if (value.IsInteger() && Convert.ToInt32(value.Value) == int.MaxValue)
ModificationUtil.ReplaceChild(expression, elementFactory.CreateExpression("int.MaxValue"));
}
);
},
"Code cleanup");
}
示例15: Read
public static DisposeCacheData Read(BinaryReader reader, IPsiSourceFile sourceFile)
{
var count = reader.ReadInt32();
var statuses = new List<DisposeMethodStatus>(count);
for (var i = 0; i < count; i++)
statuses.Add(DisposeMethodStatus.Read(reader, sourceFile));
return new DisposeCacheData(statuses);
}