public static void Register(CodeEditorDocument document)
        {
            // Must be implemented. Gets the parse information for the specified file.
            HostCallback.GetParseInformation = delegate(string fileName) {
                if (fileName != document.ContentFile.FullName)
                {
                    throw new Exception("Unknown file");
                }
                if (document.LastCompilationUnit == null)
                {
                    return(null);
                }
                ParseInformation pi = new ParseInformation();
                pi.ValidCompilationUnit = document.LastCompilationUnit;
                return(pi);
            };

            // Must be implemented. Gets the project content of the active project.
            HostCallback.GetCurrentProjectContent = delegate {
                return(Global.Projects.CSProjectContent);
            };

            // The default implementation just logs to Log4Net. We want to display a MessageBox.
            // Note that we use += here - in this case, we want to keep the default Log4Net implementation.
            HostCallback.ShowError += delegate(string message, Exception ex) {
                MessageBox.Show(message + Environment.NewLine + ex.ToString());
            };
            HostCallback.ShowMessage += delegate(string message) {
                MessageBox.Show(message);
            };
            HostCallback.ShowAssemblyLoadError += delegate(string fileName, string include, string message) {
                MessageBox.Show("Error loading code-completion information for "
                                + include + " from " + fileName
                                + ":\r\n" + message + "\r\n");
            };
        }
Esempio n. 2
0
        private void UpdateIDE()
        {
            CodeEditorDocument codeEditor = Global.DockManager.ActiveDocument as CodeEditorDocument;

            _buildMenuItem.Visible = codeEditor != null;
        }
 public CodeCompletionProvider(CodeEditorDocument document)
 {
     this._document = document;
 }