/// <summary> /// Initializes a new instance of the <see cref="MainForm"/> class. /// </summary> public MainForm() { // The InitializeComponent() call is required for Windows Forms designer support. InitializeComponent(); textEditorControl1.ShowEOLMarkers = false; textEditorControl1.ShowInvalidLines = false; HostCallbackImplementation.Register(this); CodeCompletionKeyHandler.Attach(this, textEditorControl1); ToolTipProvider.Attach(this, textEditorControl1); PcRegistry = new ProjectContentRegistry(); // Default .NET 2.0 registry // Persistence lets SharpDevelop.Dom create a cache file on disk so that future starts are faster. // It also caches XML documentation files in an on-disk hash table, thus reducing memory usage. // Paul Meems, 1 Sept. 2010: Create the file if it doesn't exist (Bug #1763): string cacheFolder = Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion"); if (!Directory.Exists(cacheFolder)) { Directory.CreateDirectory(cacheFolder); } PcRegistry.ActivatePersistence(cacheFolder); MyProjectContent = new DefaultProjectContent { Language = IsVisualBasic ? LanguageProperties.VBNet : LanguageProperties.CSharp }; }
/// <summary> /// Initializes a new instance of the <see cref="MainForm"/> class. /// </summary> public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // if (IsVisualBasic) { // textEditorControl1.Text = @" //Class A // Sub B // Dim xx As String // // End Sub //End Class //"; // textEditorControl1.SetHighlighting("VBNET"); // } else { // textEditorControl1.Text = @"using System; //class A //{ // void B() // { // string x; // // } //} //"; // textEditorControl1.SetHighlighting("C#"); // } textEditorControl1.ShowEOLMarkers = false; textEditorControl1.ShowInvalidLines = false; HostCallbackImplementation.Register(this); CodeCompletionKeyHandler.Attach(this, textEditorControl1); ToolTipProvider.Attach(this, textEditorControl1); pcRegistry = new ProjectContentRegistry(); // Default .NET 2.0 registry // Persistence lets SharpDevelop.Dom create a cache file on disk so that // future starts are faster. // It also caches XML documentation files in an on-disk hash table, thus // reducing memory usage. // Paul Meems, 1 Sept. 2010: Create the file if it doesn't exist (Bug #1763): string cacheFolder = Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion"); if (!Directory.Exists(cacheFolder)) { Directory.CreateDirectory(cacheFolder); } pcRegistry.ActivatePersistence(cacheFolder); myProjectContent = new DefaultProjectContent(); myProjectContent.Language = CurrentLanguageProperties; }
public static CodeCompletionKeyHandler Attach(MainForm mainForm, TextEditorControl editor) { CodeCompletionKeyHandler h = new CodeCompletionKeyHandler(mainForm, editor); editor.ActiveTextAreaControl.TextArea.KeyEventHandler += h.TextAreaKeyEventHandler; // When the editor is disposed, close the code completion window editor.Disposed += h.CloseCodeCompletionWindow; return h; }
/// <summary> /// Attaches the events to the editor. /// </summary> /// <param name="mainForm">MainForm needed for creating the CodeCompletionKeyHandler.</param> /// <param name="editor">The editor the events get attached to.</param> /// <returns>The created CodeCompletionKeyHandler.</returns> public static CodeCompletionKeyHandler Attach(MainForm mainForm, TextEditorControl editor) { CodeCompletionKeyHandler h = new CodeCompletionKeyHandler(mainForm, editor); editor.ActiveTextAreaControl.TextArea.KeyEventHandler += h.TextAreaKeyEventHandler; // When the editor is disposed, close the code completion window editor.Disposed += h.CloseCodeCompletionWindow; return(h); }
public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); if (IsVisualBasic) { textEditorControl1.Text = @" Class A Sub B Dim xx As String End Sub End Class "; textEditorControl1.SetHighlighting("VBNET"); } else { textEditorControl1.Text = @"using System; class A { void B() { string x; } } "; textEditorControl1.SetHighlighting("C#"); } textEditorControl1.ShowEOLMarkers = false; textEditorControl1.ShowInvalidLines = false; HostCallbackImplementation.Register(this); CodeCompletionKeyHandler.Attach(this, textEditorControl1); ToolTipProvider.Attach(this, textEditorControl1); pcRegistry = new Dom.ProjectContentRegistry(); // Default .NET 2.0 registry // Persistence lets SharpDevelop.Dom create a cache file on disk so that // future starts are faster. // It also caches XML documentation files in an on-disk hash table, thus // reducing memory usage. pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion")); myProjectContent = new Dom.DefaultProjectContent(); myProjectContent.Language = CurrentLanguageProperties; // create dummy parseInformation to prevent NullReferenceException when using CC before parsing // for the first time parseInformation = new Dom.ParseInformation(new Dom.DefaultCompilationUnit(myProjectContent)); }