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(); } }; }
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); }
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); }
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); }
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; }
public ITextEditorExtension AttachExtension(ITextEditorExtension extension) { this.extension = extension; return(this); }
ITextEditorExtension IExtensibleTextEditor.AttachExtension (ITextEditorExtension extension) { return se.View.AttachExtension (extension); }