예제 #1
0
 static CSharpTextEditorIndentation()
 {
     CompletionWindowManager.WordCompleted += delegate(object sender, CodeCompletionContextEventArgs e) {
         IExtensibleTextEditor editor = e.Widget as IExtensibleTextEditor;
         if (editor == null)
         {
             return;
         }
         ITextEditorExtension textEditorExtension = editor.Extension;
         while (textEditorExtension != null && !(textEditorExtension is CSharpTextEditorIndentation))
         {
             textEditorExtension = textEditorExtension.Next;
         }
         CSharpTextEditorIndentation extension = textEditorExtension as CSharpTextEditorIndentation;
         if (extension == null)
         {
             return;
         }
         extension.stateTracker.UpdateEngine();
         if (extension.stateTracker.Engine.NeedsReindent)
         {
             extension.DoReSmartIndent();
         }
     };
 }
예제 #2
0
        internal static HighlightUsagesExtension GetHighlightUsageExtension(MonoDevelop.Ide.Gui.Document doc)
        {
            ITextEditorExtension ext = doc.EditorExtension;

            while (ext != null)
            {
                if (ext is HighlightUsagesExtension)
                {
                    return((HighlightUsagesExtension)ext);
                }
                ext = ext.Next;
            }
            return(null);
        }
예제 #3
0
        protected override void Run()
        {
            var doc = IdeApp.Workbench.ActiveDocument;

            if (doc == null || doc.FileName == FilePath.Null || doc.CompilationUnit == null)
            {
                return;
            }
            ITextEditorExtension ext = doc.EditorExtension;

            while (ext != null && !(ext is CompletionTextEditorExtension))
            {
                ext = ext.Next;
            }
            if (ext == null)
            {
                return;
            }

            ProjectDom        dom   = doc.Dom;
            ImportSymbolCache cache = new ImportSymbolCache();

            List <ImportSymbolCompletionData> typeList = new List <ImportSymbolCompletionData> ();

            foreach (IType type in dom.Types)
            {
                typeList.Add(new ImportSymbolCompletionData(doc, cache, dom, type));
            }
            foreach (var refDom in dom.References)
            {
                foreach (IType type in refDom.Types)
                {
                    typeList.Add(new ImportSymbolCompletionData(doc, cache, dom, type));
                }
            }

            typeList.Sort(delegate(ImportSymbolCompletionData left, ImportSymbolCompletionData right) {
                return(left.Type.Name.CompareTo(right.Type.Name));
            });


            CompletionDataList completionList = new CompletionDataList();

            completionList.IsSorted = true;
            typeList.ForEach(cd => completionList.Add(cd));

            ((CompletionTextEditorExtension)ext).ShowCompletion(completionList);
        }
예제 #4
0
        protected override void Run()
        {
            var doc = IdeApp.Workbench.ActiveDocument;

            if (doc == null || doc.FileName == FilePath.Null || doc.ParsedDocument == null)
            {
                return;
            }
            ITextEditorExtension ext = doc.EditorExtension;

            while (ext != null && !(ext is CompletionTextEditorExtension))
            {
                ext = ext.Next;
            }
            if (ext == null)
            {
                return;
            }

            var dom = doc.Compilation;
            ImportSymbolCache cache = new ImportSymbolCache();
            var lookup = new MemberLookup(null, doc.Compilation.MainAssembly);

            List <ImportSymbolCompletionData> typeList = new List <ImportSymbolCompletionData> ();

            foreach (var type in dom.GetAllTypeDefinitions())
            {
                if (!lookup.IsAccessible(type, false))
                {
                    continue;
                }
                typeList.Add(new ImportSymbolCompletionData(doc, cache, type));
            }

            typeList.Sort(delegate(ImportSymbolCompletionData left, ImportSymbolCompletionData right) {
                return(left.Type.Name.CompareTo(right.Type.Name));
            });


            CompletionDataList completionList = new CompletionDataList();

            completionList.IsSorted = true;
            typeList.ForEach(cd => completionList.Add(cd));

            ((CompletionTextEditorExtension)ext).ShowCompletion(completionList);
        }
예제 #5
0
		ITextEditorExtension IExtensibleTextEditor.AttachExtension (ITextEditorExtension extension)
		{
			Extension = extension;
			this.widget.TextEditor.Extension = extension;
			return this.widget;
		}
		public ITextEditorExtension AttachExtension (ITextEditorExtension extension)
		{
			this.extension = extension;
			return this;
		}
예제 #7
0
 public ITextEditorExtension AttachExtension(ITextEditorExtension extension)
 {
     this.extension = extension;
     return(this);
 }
		ITextEditorExtension IExtensibleTextEditor.AttachExtension (ITextEditorExtension extension)
		{
			return se.View.AttachExtension (extension);
		}