本文整理汇总了C#中NRefactoryResolver类的典型用法代码示例。如果您正苦于以下问题:C# NRefactoryResolver类的具体用法?C# NRefactoryResolver怎么用?C# NRefactoryResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NRefactoryResolver类属于命名空间,在下文中一共展示了NRefactoryResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ();
}
示例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;
}
示例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;
}
示例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;
}
示例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#");
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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();
}
示例10: InferredReturnType
internal InferredReturnType(Expression expression, NRefactoryResolver resolver)
{
if (resolver == null)
throw new ArgumentNullException("resolver");
_expression = expression;
_resolver = resolver;
}
示例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;
}
}
示例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);
}
示例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;
}
示例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");
}
示例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);
}