Hi,
In my application, I would like the intellisense suggestion list to pop up "earlier", more in the manner that it does in Visual Studio. For instance, if I have local variables "foo" and "bar", if I type "foo = bar" in VS, I will get intellisense when I begin typing "foo" and "bar". Using the Syntax editor, I don't get that.
On the flipside though, I don't want the intellisense to pop up when it is inappropriate; for instance, when declaring a new variable (eg "int foo;"), it would be preferable if intellisense pops up for "int" but not "foo", since there is no way that "foo" will be in the auto-completion list.
I have a bit of a go at it by putting a handler on the editor KeyTyped event, but it doesn't quite work properly; perhaps you can help me get it right; or maybe even point me to a code sample that does it already!
Here is my try:This works most of the time, but it pops up intellisense in one case when it shouldn't (that I have found). If I have a class type FooClass, I get unwanted intellisense as I type "foo" in this situation: "FooClass foo;". (NB, if I type "int foo;", it works perfectly).
I hope I've made it clear what I am trying to achieve, please ask for clarification if it is not clear. Thanks in advance.
Regards
John
In my application, I would like the intellisense suggestion list to pop up "earlier", more in the manner that it does in Visual Studio. For instance, if I have local variables "foo" and "bar", if I type "foo = bar" in VS, I will get intellisense when I begin typing "foo" and "bar". Using the Syntax editor, I don't get that.
On the flipside though, I don't want the intellisense to pop up when it is inappropriate; for instance, when declaring a new variable (eg "int foo;"), it would be preferable if intellisense pops up for "int" but not "foo", since there is no way that "foo" will be in the auto-completion list.
I have a bit of a go at it by putting a handler on the editor KeyTyped event, but it doesn't quite work properly; perhaps you can help me get it right; or maybe even point me to a code sample that does it already!
Here is my try:
void editor_KeyTyped(object sender, KeyTypedEventArgs e)
{
if (editor.SelectedView.Selection.FirstOffset > 0) {
CSharpContext context = CSharpContext.GetContextAtOffset(editor.Document, editor.SelectedView.Selection.FirstOffset - 1, (ActiproSoftware.SyntaxEditor.Addons.DotNet.Ast.CompilationUnit)editor.Document.SemanticParseData, dotNetProjectResolver);
if (context.Items != null && context.Items[0].Type == DotNetContextItemType.Unknown) {
editor.Document.Language.ShowIntelliPromptMemberList(editor);
}
}
}
I hope I've made it clear what I am trying to achieve, please ask for clarification if it is not clear. Thanks in advance.
Regards
John