diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-11-04 17:23:31 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2014-11-04 17:23:31 +0300 |
commit | 5613a032aea64b01dd65919ce52a850b3cd4782d (patch) | |
tree | 11dbfa42835c0ed763b2e540ab758dd0227c67ea /main/src/addins/MonoDevelop.SourceEditor2 | |
parent | cee5236688d8c233caa487cdb776c9f50a35c3bd (diff) | |
parent | aeabf3a8efc71496e314a110658260503a8ade87 (diff) |
Merge remote-tracking branch 'mono/master' into xs6
Conflicts:
.gitmodules
main/build/MacOSX/monostub.m
main/external/xwt
version-checks
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2')
3 files changed, 30 insertions, 36 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml index bbbe05df52..29d9fe61f4 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml @@ -196,9 +196,11 @@ <Section id="General" insertbefore="Formatting" _label="General" fill="true" class="MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel" icon="md-prefs-text-editor-general" /> <Section id="Markers" _label="Markers and Rulers" class="MonoDevelop.SourceEditor.OptionPanels.MarkerPanel" icon="md-prefs-markers-rulers" /> <Section id="Behavior" _label="Behavior" class="MonoDevelop.SourceEditor.OptionPanels.BehaviorPanel" icon="md-prefs-text-editor-behavior" /> - <Section id="CompletionBehavior" _label="Completion Behavior" class="MonoDevelop.SourceEditor.OptionPanels.CompletionOptionsPanel" icon="md-prefs-completion-behavior" /> - <!-- <Section id="CompletionCharacters" _label="Completion Characters" class="MonoDevelop.SourceEditor.OptionPanels.CompletionCharactersPanel" /> --> - <Section id="CompletionAppearance" _label="Completion Appearance" class="MonoDevelop.SourceEditor.OptionPanels.CompletionAppearancePanel" icon="md-prefs-completion-appearance" /> + <Section id="CodeCompletion" _label="Code Completion" icon="md-prefs-completion-behavior"> + <Panel id="CompletionBehavior" _label="Behavior" class="MonoDevelop.SourceEditor.OptionPanels.CompletionOptionsPanel" icon="md-prefs-completion-behavior" /> + <!-- <Section id="CompletionCharacters" _label="Completion Characters" class="MonoDevelop.SourceEditor.OptionPanels.CompletionCharactersPanel" /> --> + <Panel id="CompletionAppearance" _label="Appearance" class="MonoDevelop.SourceEditor.OptionPanels.CompletionAppearancePanel" icon="md-prefs-completion-appearance" /> + </Section> <Section id="SyntaxHighlighting" _label="Syntax Highlighting" fill="true" class="MonoDevelop.SourceEditor.OptionPanels.HighlightingPanel" icon="md-prefs-syntax-highlighting" /> </Extension> diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs index 5490283cbc..1e4c3be8c4 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs @@ -88,12 +88,6 @@ namespace MonoDevelop.SourceEditor Initialize (view); } - void HandleParseOperationFinished (object sender, EventArgs e) - { - resolveResult = null; - resolveRegion = DomRegion.Empty; - } - public ExtensibleTextEditor (SourceEditorView view) { base.Options = new StyledSourceEditorOptions (view.Project, null); @@ -118,7 +112,6 @@ namespace MonoDevelop.SourceEditor }; Document.TextReplaced += HandleSkipCharsOnReplace; - TypeSystemService.ParseOperationFinished += HandleParseOperationFinished; UpdateEditMode (); this.DoPopupMenu = ShowPopup; @@ -196,9 +189,7 @@ namespace MonoDevelop.SourceEditor protected override void OnDestroyed () { - TypeSystemService.ParseOperationFinished -= HandleParseOperationFinished; UnregisterAdjustments (); - resolveResult = null; Extension = null; ExtensionContext = null; view = null; @@ -510,28 +501,16 @@ namespace MonoDevelop.SourceEditor } int oldOffset = -1; - ResolveResult resolveResult = null; - DomRegion resolveRegion = DomRegion.Empty; + public ResolveResult GetLanguageItem (int offset, out DomRegion region) { - // we'll cache old results. - if (offset == oldOffset) { - region = this.resolveRegion; - return this.resolveResult; - } - oldOffset = offset; - + region = DomRegion.Empty; + if (textEditorResolverProvider != null) { - this.resolveResult = textEditorResolverProvider.GetLanguageItem (view.WorkbenchWindow.Document, offset, out region); - this.resolveRegion = region; - } else { - region = DomRegion.Empty; - this.resolveResult = null; - this.resolveRegion = region; - } - - return this.resolveResult; + return textEditorResolverProvider.GetLanguageItem (view.WorkbenchWindow.Document, offset, out region); + } + return null; } public CodeTemplateContext GetTemplateContext () @@ -556,12 +535,10 @@ namespace MonoDevelop.SourceEditor oldOffset = offset; if (textEditorResolverProvider != null) { - this.resolveResult = textEditorResolverProvider.GetLanguageItem (view.WorkbenchWindow.Document, offset, expression); - } else { - this.resolveResult = null; + return textEditorResolverProvider.GetLanguageItem (view.WorkbenchWindow.Document, offset, expression); } - return this.resolveResult; + return null; } // public string GetExpression (int offset) diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs index d301d929f5..b4a0af98c7 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs @@ -614,6 +614,11 @@ namespace MonoDevelop.SourceEditor messageBubbleCache = null; } } + + protected virtual string ProcessSaveText (string text) + { + return text; + } public override void Save (string fileName) { @@ -694,7 +699,7 @@ namespace MonoDevelop.SourceEditor try { var writeEncoding = encoding; var writeBom = hadBom; - var writeText = Document.Text; + var writeText = ProcessSaveText (Document.Text); if (writeEncoding == null) { if (this.encoding != null) { writeEncoding = this.encoding; @@ -757,6 +762,7 @@ namespace MonoDevelop.SourceEditor string text = null; if (content != null) { text = Mono.TextEditor.Utils.TextFileUtility.GetText (content, out encoding, out hadBom); + text = ProcessLoadText (text); Document.Text = text; } this.CreateDocumentParsedHandler (); @@ -810,8 +816,11 @@ namespace MonoDevelop.SourceEditor } MonoDevelop.Ide.Gui.Document ownerDocument; + protected MonoDevelop.Ide.Gui.Document OwnerDocument { + get { return ownerDocument; } + } - void HandleDocumentParsed (object sender, EventArgs e) + protected virtual void HandleDocumentParsed (object sender, EventArgs e) { widget.UpdateParsedDocument (ownerDocument.ParsedDocument); } @@ -821,6 +830,11 @@ namespace MonoDevelop.SourceEditor Load (fileName, loadEncoding); } + protected virtual string ProcessLoadText (string text) + { + return text; + } + public void Load (string fileName, Encoding loadEncoding, bool reload = false) { // Handle the "reload" case. @@ -848,6 +862,7 @@ namespace MonoDevelop.SourceEditor encoding = loadEncoding; text = TextFileUtility.ReadAllText (fileName, loadEncoding, out hadBom); } + text = ProcessLoadText (text); if (reload) { Document.Replace (0, Document.TextLength, text); Document.DiffTracker.Reset (); |