本文整理汇总了C#中NRefactoryResolver类的典型用法代码示例。如果您正苦于以下问题:C# NRefactoryResolver类的具体用法?C# NRefactoryResolver怎么用?C# NRefactoryResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NRefactoryResolver类属于命名空间,在下文中一共展示了NRefactoryResolver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FindReferences
public override IEnumerable<MemberReference> FindReferences (ProjectDom dom, FilePath fileName, IEnumerable<INode> searchedMembers)
{
HashSet<int > positions = new HashSet<int> ();
var editor = TextFileProvider.Instance.GetTextEditorData (fileName);
FindMemberAstVisitor visitor = new FindMemberAstVisitor (editor.Document);
visitor.IncludeXmlDocumentation = IncludeDocumentation;
visitor.Init (searchedMembers);
if (!visitor.FileContainsMemberName ()) {
yield break;
}
var doc = ProjectDomService.ParseFile (dom, fileName, () => editor.Text);
if (doc == null || doc.CompilationUnit == null)
yield break;
var resolver = new NRefactoryResolver (dom, doc.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, editor, fileName);
visitor.ParseFile (resolver);
visitor.RunVisitor (resolver);
foreach (var reference in visitor.FoundReferences) {
if (positions.Contains (reference.Position))
continue;
positions.Add (reference.Position);
yield return reference;
}
visitor.ClearParsers ();
}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:25,代码来源:CSharpReferenceFinder.cs
示例2: WatchListAutoCompleteCell
public WatchListAutoCompleteCell()
{
InitializeComponent();
console = new ConsoleControl();
console.TextAreaTextEntered += new TextCompositionEventHandler(consoleControl_TextAreaTextEntered);
console.TextAreaPreviewKeyDown += new KeyEventHandler(console_TextAreaPreviewKeyDown);
console.LostFocus += new RoutedEventHandler(console_LostFocus);
console.HideScrollBar();
ConsolePanel.Content = console;
// get language
if (ProjectService.CurrentProject == null)
language = "C#";
else
language = ProjectService.CurrentProject.Language;
resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language));
// FIXME set language
if (language == "VB" || language == "VBNet") {
console.SetHighlighting("VBNET");
}
else {
console.SetHighlighting("C#");
}
// get process
WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger;
debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) {
this.Process = e.Process;
};
this.Process = debugger.DebuggedProcess;
}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:34,代码来源:WatchListAutoCompleteCell.cs
示例3: WatchInputBox
public WatchInputBox(string text, string caption) : base()
{
InitializeComponent();
// UI
text = StringParser.Parse(text);
this.Title = StringParser.Parse(caption);
this.ConsolePanel.Content = console;
if (ProjectService.CurrentProject == null) return;
// get language
language = ProjectService.CurrentProject.Language;
resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language));
// FIXME set language
if (language == "VB" || language == "VBNet") {
console.SetHighlighting("VBNET");
}
else {
console.SetHighlighting("C#");
}
// get process
WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger;
debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) {
this.Process = e.Process;
};
this.Process = debugger.DebuggedProcess;
}
开发者ID:siegfriedpammer,项目名称:SharpDevelop,代码行数:31,代码来源:WatchInputBox.xaml.cs
示例4: WatchInputBox
public WatchInputBox(string text, string caption) : base()
{
InitializeComponent();
// UI
text = StringParser.Parse(text);
this.Title = StringParser.Parse(caption);
this.ConsolePanel.Content = console;
if (ProjectService.CurrentProject == null)
language = GetLanguageFromActiveViewContent();
else
language = GetLanguage(ProjectService.CurrentProject.Language);
resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language.ToString()));
switch (language) {
case SupportedLanguage.CSharp:
console.SetHighlighting("C#");
break;
case SupportedLanguage.VBNet:
console.SetHighlighting("VBNET");
break;
}
// get process
this.Process = ((WindowsDebugger)DebuggerService.CurrentDebugger).DebuggedProcess;
}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:28,代码来源:WatchInputBox.xaml.cs
示例5: ConditionCell
public ConditionCell()
{
InitializeComponent();
console = new ConsoleControl();
console.TextAreaTextEntered += new TextCompositionEventHandler(consoleControl_TextAreaTextEntered);
console.TextAreaPreviewKeyDown += new KeyEventHandler(console_TextAreaPreviewKeyDown);
console.LostFocus += new RoutedEventHandler(console_LostFocus);
console.HideScrollBar();
ConsolePanel.Content = console;
// get language
if (ProjectService.CurrentProject == null)
language = "C#";
else
language = ProjectService.CurrentProject.Language;
resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language));
// FIXME set language
if (language == "VB" || language == "VBNet") {
console.SetHighlighting("VBNET");
}
else {
console.SetHighlighting("C#");
}
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:26,代码来源:ConditionCell.xaml.cs
示例6: OnToolTipRequest
private void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
{
if (e.InDocument && !e.ToolTipShown)
{
IExpressionFinder expressionFinder;
if (MainForm.IsVisualBasic)
{
expressionFinder = new VBExpressionFinder();
}
else
{
expressionFinder = new CSharpExpressionFinder(mainForm.parseInformation);
}
ExpressionResult expression = expressionFinder.FindFullExpression(
editor.Text,
editor.Document.PositionToOffset(e.LogicalPosition));
if (expression.Region.IsEmpty)
{
expression.Region = new DomRegion(e.LogicalPosition.Line + 1, e.LogicalPosition.Column + 1);
}
TextArea textArea = editor.ActiveTextAreaControl.TextArea;
NRefactoryResolver resolver = new NRefactoryResolver(mainForm.myProjectContent.Language);
ResolveResult rr = resolver.Resolve(expression,
mainForm.parseInformation,
textArea.MotherTextEditorControl.Text);
string toolTipText = GetText(rr);
if (toolTipText != null)
{
e.ShowToolTip(toolTipText);
}
}
}
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:33,代码来源:ToolTipProvider.cs
示例7: OnToolTipRequest
private void OnToolTipRequest(object sender, TextEditor.ToolTipRequestEventArgs e)
{
if (!e.InDocument || e.ToolTipShown)
return;
IExpressionFinder expressionFinder;
if (IntellisenseForm.SupportedLanguage == SupportedLanguage.VisualBasic)
{
expressionFinder = new VBExpressionFinder();
}
else
{
expressionFinder = new CSharpExpressionFinder(_iForm.ParseInformation);
}
var expression = expressionFinder.FindFullExpression(
_editor.Text,
_editor.Document.PositionToOffset(e.LogicalPosition));
if (expression.Region.IsEmpty)
{
expression.Region = new DomRegion(e.LogicalPosition.Line + 1, e.LogicalPosition.Column + 1);
}
var textArea = _editor.ActiveTextAreaControl.TextArea;
var resolver = new NRefactoryResolver(_iForm.ProjectContent.Language);
var rr = resolver.Resolve(expression,
_iForm.ParseInformation,
textArea.MotherTextEditorControl.Text);
var toolTipText = GetText(rr);
if (toolTipText != null)
{
e.ShowToolTip(toolTipText);
}
}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:35,代码来源:ToolTipProvider.cs
示例8: CreateReturnType
public static IReturnType CreateReturnType(TypeReference reference, NRefactoryResolver resolver)
{
return CreateReturnType(reference,
resolver.CallingClass, resolver.CallingMember,
resolver.CaretLine, resolver.CaretColumn,
resolver.ProjectContent, ReturnTypeOptions.None);
}
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:7,代码来源:TypeVisitor.cs
示例9: GenerateCompletionData
public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
{
// We can return code-completion items like this:
// return new ICompletionData[] {
// new DefaultCompletionData("Text", "Description", 1)
// };
NRefactoryResolver resolver = new NRefactoryResolver(mainForm.myProjectContent);
Dom.ResolveResult rr = resolver.Resolve(FindExpression(textArea),
textArea.Caret.Line,
textArea.Caret.Column,
fileName,
textArea.MotherTextEditorControl.Text);
List<ICompletionData> resultList = new List<ICompletionData>();
if (rr != null) {
ArrayList completionData = rr.GetCompletionData(mainForm.myProjectContent);
if (completionData != null) {
AddCompletionData(resultList, completionData);
}
}
//textArea.MotherTextEditorControl.Text = backup;
return resultList.ToArray();
}
开发者ID:cleciusjm,项目名称:db4oanalyzer,代码行数:26,代码来源:CodeCompletionProvider.cs
示例10: InferredReturnType
internal InferredReturnType(Expression expression, NRefactoryResolver resolver)
{
if (resolver == null)
throw new ArgumentNullException("resolver");
_expression = expression;
_resolver = resolver;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:8,代码来源:InferredReturnType.cs
示例11: OnLanguageChanged
void OnLanguageChanged()
{
switch (SelectedLanguage) {
case SupportedLanguage.CSharp:
resolver = new NRefactoryResolver(LanguageProperties.CSharp);
SetHighlighting("C#");
break;
case SupportedLanguage.VBNet:
resolver = new NRefactoryResolver(LanguageProperties.VBNet);
SetHighlighting("VBNET");
break;
}
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:13,代码来源:ConsolePad.cs
示例12: LambdaReturnType
internal LambdaReturnType(AnonymousMethodExpression expression, NRefactoryResolver resolver)
: base(resolver.CompilationUnit)
{
this.resolver = resolver;
if (expression.HasParameterList) {
base.MethodParameters = new List<IParameter>();
foreach (ParameterDeclarationExpression param in expression.Parameters) {
base.MethodParameters.Add(NRefactoryASTConvertVisitor.CreateParameter(param, resolver.CallingMember as IMethod, resolver.CallingClass, resolver.CompilationUnit));
}
}
expression.Body.AcceptVisitor(new ReturnStatementFinder(returnExpressions), null);
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:13,代码来源:LambdaReturnType.cs
示例13: FindReferences
IEnumerable<MemberReference> FindReferences (ProjectDom dom, FilePath fileName, INode member)
{
var editor = TextFileProvider.Instance.GetTextEditorData (fileName);
var doc = ProjectDomService.GetParsedDocument (dom, fileName);
if (doc == null || doc.CompilationUnit == null)
return null;
var resolver = new NRefactoryResolver (dom, doc.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, editor, fileName);
FindMemberAstVisitor visitor = new FindMemberAstVisitor (editor.Document, resolver, member);
visitor.IncludeXmlDocumentation = IncludeDocumentation;
visitor.RunVisitor ();
return visitor.FoundReferences;
}
开发者ID:thild,项目名称:monodevelop,代码行数:14,代码来源:CSharpReferenceFinder.cs
示例14: LambdaParameterReturnType
public LambdaParameterReturnType(LambdaExpression lambda, string name, NRefactoryResolver resolver)
{
if (lambda == null)
throw new ArgumentNullException("lambda");
if (name == null)
throw new ArgumentNullException("name");
if (resolver == null)
throw new ArgumentNullException("resolver");
this.lambda = lambda;
this.parameterName = name;
this.parameterIndex = lambda.Parameters.FindIndex(p => p.ParameterName == name);
this.resolver = resolver;
if (parameterIndex < 0)
throw new ArgumentException("there is no lambda parameter with that name");
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:15,代码来源:LambdaParameterReturnType.cs
示例15: NRefactoryParameterDataProvider
public NRefactoryParameterDataProvider (TextEditorData editor, NRefactoryResolver resolver, MethodResolveResult resolveResult)
{
this.staticResolve = resolveResult.StaticResolve;
bool includeProtected = true;
HashSet<string> alreadyAdded = new HashSet<string> ();
foreach (IMethod method in resolveResult.Methods) {
if (method.IsConstructor)
continue;
string str = ambience.GetString (method, OutputFlags.IncludeParameters | OutputFlags.GeneralizeGenerics | OutputFlags.IncludeGenerics);
if (alreadyAdded.Contains (str))
continue;
alreadyAdded.Add (str);
if (method.IsAccessibleFrom (resolver.Dom, resolver.CallingType, resolver.CallingMember, includeProtected))
methods.Add (method);
}
methods.Sort (MethodComparer);
}
开发者ID:hduregger,项目名称:monodevelop,代码行数:17,代码来源:NRefactoryParameterDataProvider.cs
示例16: SearchMember
IEnumerable<MemberReference> SearchMember (INode member, ProjectDom dom, FilePath fileName, Mono.TextEditor.TextEditorData editor, Mono.TextEditor.Document buildDocument, List<LocalDocumentInfo.OffsetInfo> offsetInfos, ParsedDocument parsedDocument)
{
var resolver = new NRefactoryResolver (dom, parsedDocument.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, editor, fileName);
FindMemberAstVisitor visitor = new FindMemberAstVisitor (buildDocument, member);
visitor.IncludeXmlDocumentation = IncludeDocumentation;
visitor.RunVisitor (resolver);
foreach (var result in visitor.FoundReferences) {
var offsetInfo = offsetInfos.FirstOrDefault (info => info.ToOffset <= result.Position && result.Position < info.ToOffset + info.Length);
if (offsetInfo == null)
continue;
var offset = offsetInfo.FromOffset + result.Position - offsetInfo.ToOffset;
var loc = editor.OffsetToLocation (offset);
yield return new MemberReference (null, fileName, offset, loc.Line, loc.Column, result.Name, null);
}
}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:17,代码来源:ASPNetReferenceFinder.cs
示例17: FindReferences
public override IEnumerable<MemberReference> FindReferences (ProjectDom dom, FilePath fileName, INode member)
{
var editor = TextFileProvider.Instance.GetTextEditorData (fileName);
AspNetAppProject project = dom.Project as AspNetAppProject;
System.Console.WriteLine ("project:" + project);
if (project == null)
yield break;
var unit = AspNetParserService.GetCompileUnit (project, fileName, true);
System.Console.WriteLine ("unit:" + unit);
if (unit == null)
yield break;
System.Console.WriteLine ("go ");
var refman = new DocumentReferenceManager (project);
var parsedAspDocument = (AspNetParsedDocument)new AspNetParser ().Parse (dom, fileName, editor.Text);
refman.Doc = parsedAspDocument;
var usings = refman.GetUsings ();
var documentInfo = new DocumentInfo (unit, usings, refman.GetDoms ());
var builder = new AspLanguageBuilder ();
var buildDocument = new Mono.TextEditor.Document ();
var offsetInfos = new List<LocalDocumentInfo.OffsetInfo> ();
buildDocument.Text = builder.BuildDocumentString (documentInfo, editor, offsetInfos, true);
var parsedDocument = AspLanguageBuilder.Parse (fileName, buildDocument.Text);
var resolver = new NRefactoryResolver (dom, parsedDocument.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, editor, fileName);
FindMemberAstVisitor visitor = new FindMemberAstVisitor (buildDocument, resolver, member);
visitor.IncludeXmlDocumentation = IncludeDocumentation;
visitor.RunVisitor ();
foreach (var result in visitor.FoundReferences) {
var offsetInfo = offsetInfos.FirstOrDefault (info => info.ToOffset <= result.Position && result.Position < info.ToOffset + info.Length);
if (offsetInfo == null)
continue;
var offset = offsetInfo.FromOffset + result.Position - offsetInfo.ToOffset;
var loc = editor.OffsetToLocation (offset);
yield return new MemberReference (null, fileName, offset, loc.Line, loc.Column, result.Name, null);
}
}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:42,代码来源:ASPNetReferenceFinder.cs
示例18: NRefactoryTemplateParameterDataProvider
public NRefactoryTemplateParameterDataProvider (TextEditorData editor, NRefactoryResolver resolver, IEnumerable<string> namespaces, ExpressionResult expressionResult, DomLocation loc)
{
// this.editor = editor;
ResolveResult plainResolveResult = resolver.Resolve (expressionResult, loc);
MethodResolveResult resolveResult = plainResolveResult as MethodResolveResult;
if (resolveResult != null) {
foreach (IMethod method in resolveResult.Methods) {
if (method.TypeParameters.Count > 0)
this.types.Add (method);
}
} else {
string typeName = expressionResult.Expression.Trim ();
foreach (string ns in namespaces) {
string prefix = ns + (ns.Length > 0 ? "." : "") + typeName + "`";
for (int i = 1; i < 99; i++) {
IType possibleType = resolver.Dom.GetType (prefix + i);
if (possibleType != null)
this.types.Add (possibleType);
}
}
IType resolvedType = plainResolveResult != null ? resolver.Dom.GetType (plainResolveResult.ResolvedType) : null;
if (resolvedType == null) {
int idx = expressionResult.Expression.LastIndexOf (".");
if (idx < 0)
return;
typeName = expressionResult.Expression.Substring (idx + 1);
expressionResult.Expression = expressionResult.Expression.Substring (0, idx);
plainResolveResult = resolver.Resolve (expressionResult, loc);
resolvedType = resolver.Dom.GetType (plainResolveResult.ResolvedType);
}
if (resolvedType == null)
return;
foreach (IType innerType in resolvedType.InnerTypes) {
this.types.Add (innerType);
}
}
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:37,代码来源:NRefactoryTemplateParameterDataProvider.cs
示例19: FindParameterReferences
public override IEnumerable<MemberReference> FindParameterReferences (RefactorerContext ctx, string fileName, IParameter param, bool includeXmlComment)
{
NRefactoryResolver resolver = new NRefactoryResolver (ctx.ParserContext, param.DeclaringMember.DeclaringType.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, null, fileName);
resolver.CallingMember = param.DeclaringMember;
FindMemberAstVisitor visitor = new FindMemberAstVisitor (resolver, ctx.GetFile (fileName), param);
visitor.IncludeXmlDocumentation = includeXmlComment;
visitor.RunVisitor ();
SetContext (visitor.FoundReferences, ctx);
return visitor.FoundReferences;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:12,代码来源:CodeGenerator.cs
示例20: FindVariableReferences
public override IEnumerable<MemberReference> FindVariableReferences (RefactorerContext ctx, string fileName, LocalVariable var)
{
//System.Console.WriteLine("Find variable references !!!");
// ParsedDocument parsedDocument = ProjectDomService.ParseFile (fileName);
NRefactoryResolver resolver = new NRefactoryResolver (ctx.ParserContext, var.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, null, fileName);
resolver.CallingMember = var.DeclaringMember;
FindMemberAstVisitor visitor = new FindMemberAstVisitor (resolver, ctx.GetFile (fileName), var);
visitor.RunVisitor ();
SetContext (visitor.FoundReferences, ctx);
return visitor.FoundReferences;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:12,代码来源:CodeGenerator.cs
注:本文中的NRefactoryResolver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论