diff options
Diffstat (limited to 'main/src/addins/CSharpBinding/AspNet')
4 files changed, 109 insertions, 88 deletions
diff --git a/main/src/addins/CSharpBinding/AspNet/ASPNetReferenceFinder.cs b/main/src/addins/CSharpBinding/AspNet/ASPNetReferenceFinder.cs index ec6553f68a..72e11efbc1 100644 --- a/main/src/addins/CSharpBinding/AspNet/ASPNetReferenceFinder.cs +++ b/main/src/addins/CSharpBinding/AspNet/ASPNetReferenceFinder.cs @@ -23,12 +23,14 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +/* using System.Collections.Generic; using MonoDevelop.Core; using MonoDevelop.Ide.FindInFiles; using ICSharpCode.NRefactory.TypeSystem; using MonoDevelop.Ide.TypeSystem; +using MonoDevelop.Ide.Editor; using MonoDevelop.AspNet.WebForms; namespace MonoDevelop.CSharp.Refactoring @@ -40,7 +42,7 @@ namespace MonoDevelop.CSharp.Refactoring IncludeDocumentation = true; } - IEnumerable<DomRegion> SearchMember (IEntity member, ITypeResolveContext dom, FilePath fileName, Mono.TextEditor.TextEditorData editor, Mono.TextEditor.TextDocument buildDocument, List<LocalDocumentInfo.OffsetInfo> offsetInfos, ParsedDocument parsedDocument) + IEnumerable<DomRegion> SearchMember (IEntity member, ITypeResolveContext dom, FilePath fileName, TextEditor editor, ITextDocument buildDocument, List<LocalDocumentInfo.OffsetInfo> offsetInfos, ParsedDocument parsedDocument) { // TODO: Type system conversion. yield break; // var resolver = new NRefactoryResolver (dom, parsedDocument.CompilationUnit, ICSharpCode.OldNRefactory.SupportedLanguage.CSharp, editor, fileName); @@ -93,3 +95,4 @@ namespace MonoDevelop.CSharp.Refactoring } } +*/
\ No newline at end of file diff --git a/main/src/addins/CSharpBinding/AspNet/AspLanguageBuilder.cs b/main/src/addins/CSharpBinding/AspNet/AspLanguageBuilder.cs index 4e1fc93617..e6e4eaf509 100644 --- a/main/src/addins/CSharpBinding/AspNet/AspLanguageBuilder.cs +++ b/main/src/addins/CSharpBinding/AspNet/AspLanguageBuilder.cs @@ -23,17 +23,25 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. - +/* using System; using System.Collections.Generic; using System.IO; using System.Text; -using Mono.TextEditor; using MonoDevelop.AspNet.WebForms; using MonoDevelop.AspNet.WebForms.Dom; using MonoDevelop.Ide.CodeCompletion; using MonoDevelop.Ide.Gui; using MonoDevelop.Ide.TypeSystem; +using ICSharpCode.NRefactory.TypeSystem; +using MonoDevelop.CSharp.Parser; +using System.IO; +using ICSharpCode.NRefactory.Completion; +using MonoDevelop.AspNet.StateEngine; +using MonoDevelop.Xml.StateEngine; +using ICSharpCode.NRefactory6.CSharp.Completion; +using MonoDevelop.Ide.Editor; +using MonoDevelop.Core.Text; namespace MonoDevelop.CSharp.Completion { @@ -67,9 +75,8 @@ namespace MonoDevelop.CSharp.Completion builder.Append (" : "); builder.AppendLine (info.BaseType); } - - public LocalDocumentInfo BuildLocalDocument (DocumentInfo info, TextEditorData data, - string expressionText, string textAfterCaret, bool isExpression) + + LocalDocumentInfo ILanguageCompletionBuilder.BuildLocalDocument (DocumentInfo info, MonoDevelop.Ide.Editor.TextEditor data, string expressionText, string textAfterCaret, bool isExpression) { var sb = new StringBuilder (); @@ -84,12 +91,12 @@ namespace MonoDevelop.CSharp.Completion foreach (var node in info.XExpressions) { bool isBlock = node is WebFormsRenderBlock; - if (node.Region.Begin.Line > data.Caret.Line || node.Region.Begin.Line == data.Caret.Line && node.Region.Begin.Column > data.Caret.Column - 5) + if (node.Region.Begin.Line > data.CaretLine || node.Region.Begin.Line == data.CaretLine && node.Region.Begin.Column > data.CaretColumn - 5) continue; //Console.WriteLine ("take xprt:" + expressions.Key.BeginLine +"/" +expressions.Key.BeginColumn); - var start = data.Document.LocationToOffset (node.Region.Begin.Line, node.Region.Begin.Column) + 2; - var end = data.Document.LocationToOffset (node.Region.End.Line, node.Region.End.Column) - 2; + var start = data.LocationToOffset (node.Region.Begin.Line, node.Region.Begin.Column) + 2; + var end = data.LocationToOffset (node.Region.End.Line, node.Region.End.Column) - 2; if (!isBlock) { sb.Append ("WriteLine ("); @@ -114,53 +121,52 @@ namespace MonoDevelop.CSharp.Completion result.LocalDocument = sb.ToString (); result.CaretPosition = caretPosition; - result.OriginalCaretPosition = data.Caret.Offset; + result.OriginalCaretPosition = data.CaretOffset; result.ParsedLocalDocument = Parse (info.AspNetDocument.FileName, sb.ToString ()); return result; } - public ICompletionDataList HandlePopupCompletion (Document realDocument, DocumentInfo info, LocalDocumentInfo localInfo) + public ICompletionDataList HandlePopupCompletion (TextEditor realEditor, DocumentContext realContext, DocumentInfo info, LocalDocumentInfo localInfo) { CodeCompletionContext codeCompletionContext; - using (var completion = CreateCompletion (realDocument, info, localInfo, out codeCompletionContext)) { + using (var completion = CreateCompletion (realEditor, realContext, info, localInfo, out codeCompletionContext)) { return completion.CodeCompletionCommand (codeCompletionContext); } } - public ICompletionDataList HandleCompletion (Document realDocument, CodeCompletionContext completionContext, DocumentInfo info, LocalDocumentInfo localInfo, char currentChar, ref int triggerWordLength) + public ICompletionDataList HandleCompletion (TextEditor realEditor, DocumentContext realContext, CodeCompletionContext completionContext, DocumentInfo info, LocalDocumentInfo localInfo, char currentChar, ref int triggerWordLength) { CodeCompletionContext ccc; - using (var completion = CreateCompletion (realDocument, info, localInfo, out ccc)) { - return completion.HandleCodeCompletion (completionContext, currentChar, ref triggerWordLength); + using (var completion = CreateCompletion (realEditor, realContext, info, localInfo, out ccc)) { + return completion.HandleCodeCompletionAsync (completionContext, currentChar, ref triggerWordLength); } } - public ParameterDataProvider HandleParameterCompletion (Document realDocument, CodeCompletionContext completionContext, DocumentInfo info, LocalDocumentInfo localInfo, char completionChar) + public ParameterHintingResult HandleParameterCompletion (TextEditor realEditor, DocumentContext realContext, CodeCompletionContext completionContext, DocumentInfo info, LocalDocumentInfo localInfo, char completionChar) { CodeCompletionContext ccc; - using (var completion = CreateCompletion (realDocument, info, localInfo, out ccc)) { - return completion.HandleParameterCompletion (completionContext, completionChar); + using (var completion = CreateCompletion (realEditor, realContext, info, localInfo, out ccc)) { + return completion.HandleParameterCompletionAsync (completionContext, completionChar); } } - public bool GetParameterCompletionCommandOffset (Document realDocument, DocumentInfo info, LocalDocumentInfo localInfo, out int cpos) + public bool GetParameterCompletionCommandOffset (TextEditor realEditor, DocumentContext realContext, DocumentInfo info, LocalDocumentInfo localInfo, out int cpos) { CodeCompletionContext codeCompletionContext; - using (var completion = CreateCompletion (realDocument, info, localInfo, out codeCompletionContext)) { - return completion.GetParameterCompletionCommandOffset (out cpos); + using (var completion = CreateCompletion (realEditor, realContext, info, localInfo, out codeCompletionContext)) { + int wlen; + return completion.GetCompletionCommandOffset (out cpos, out wlen); } } - public ICompletionWidget CreateCompletionWidget (Document realDocument, LocalDocumentInfo localInfo) + public ICompletionWidget CreateCompletionWidget (TextEditor realEditor, DocumentContext realContext, LocalDocumentInfo localInfo) { - return new AspCompletionWidget (realDocument, localInfo); + return new AspCompletionWidget (realEditor, localInfo); } - CSharpCompletionTextEditorExtension CreateCompletion (Document realDocument, DocumentInfo info, LocalDocumentInfo localInfo, out CodeCompletionContext codeCompletionContext) + CSharpCompletionTextEditorExtension CreateCompletion (TextEditor realEditor, DocumentContext realContext, DocumentInfo info, LocalDocumentInfo localInfo, out CodeCompletionContext codeCompletionContext) { - var doc = new TextDocument () { - Text = localInfo.LocalDocument, - }; + var doc = TextEditorFactory.CreateNewDocument (new StringTextSource (localInfo.LocalDocument), realEditor.FileName + ".cs"); var documentLocation = doc.OffsetToLocation (localInfo.CaretPosition); codeCompletionContext = new CodeCompletionContext () { @@ -170,16 +176,16 @@ namespace MonoDevelop.CSharp.Completion }; return new CSharpCompletionTextEditorExtension (localInfo.HiddenDocument) { - CompletionWidget = CreateCompletionWidget (realDocument, localInfo) + CompletionWidget = CreateCompletionWidget (realEditor, realContext, localInfo) }; } class AspCompletionWidget : ICompletionWidget { - Document realDocument; + TextEditor realDocument; LocalDocumentInfo localInfo; - public AspCompletionWidget (Document realDocument, LocalDocumentInfo localInfo) + public AspCompletionWidget (TextEditor realDocument, LocalDocumentInfo localInfo) { this.realDocument = realDocument; this.localInfo = localInfo; @@ -188,7 +194,7 @@ namespace MonoDevelop.CSharp.Completion #region ICompletionWidget implementation public CodeCompletionContext CurrentCodeCompletionContext { get { - int delta = realDocument.Editor.Caret.Offset - localInfo.OriginalCaretPosition; + int delta = realDocument.CaretOffset - localInfo.OriginalCaretPosition; return CreateCodeCompletionContext (localInfo.CaretPosition + delta); } } @@ -217,10 +223,10 @@ namespace MonoDevelop.CSharp.Completion public CodeCompletionContext CreateCodeCompletionContext (int triggerOffset) { - var savedCtx = realDocument.GetContent<ICompletionWidget> ().CreateCodeCompletionContext (realDocument.Editor.Caret.Offset + triggerOffset - localInfo.CaretPosition); + var savedCtx = realDocument.GetContent<ICompletionWidget> ().CreateCodeCompletionContext (realDocument.CaretOffset + triggerOffset - localInfo.CaretPosition); CodeCompletionContext result = new CodeCompletionContext (); result.TriggerOffset = triggerOffset; - DocumentLocation loc = localInfo.HiddenDocument.Editor.Document.OffsetToLocation (triggerOffset); + var loc = localInfo.HiddenDocument.Editor.OffsetToLocation (triggerOffset); result.TriggerLine = loc.Line; result.TriggerLineOffset = loc.Column - 1; @@ -234,9 +240,9 @@ namespace MonoDevelop.CSharp.Completion { if (ctx == null) return null; - int min = Math.Min (ctx.TriggerOffset, localInfo.HiddenDocument.Editor.Caret.Offset); - int max = Math.Max (ctx.TriggerOffset, localInfo.HiddenDocument.Editor.Caret.Offset); - return localInfo.HiddenDocument.Editor.Document.GetTextBetween (min, max); + int min = Math.Min (ctx.TriggerOffset, localInfo.HiddenDocument.Editor.CaretOffset); + int max = Math.Max (ctx.TriggerOffset, localInfo.HiddenDocument.Editor.CaretOffset); + return localInfo.HiddenDocument.Editor.GetTextBetween (min, max); } public void SetCompletionText (CodeCompletionContext ctx, string partial_word, string complete_word) @@ -249,7 +255,7 @@ namespace MonoDevelop.CSharp.Completion CodeCompletionContext translatedCtx = new CodeCompletionContext (); int offset = localInfo.OriginalCaretPosition + ctx.TriggerOffset - localInfo.CaretPosition; translatedCtx.TriggerOffset = offset; - DocumentLocation loc = localInfo.HiddenDocument.Editor.Document.OffsetToLocation (offset); + var loc = localInfo.HiddenDocument.Editor.OffsetToLocation (offset); translatedCtx.TriggerLine = loc.Line; translatedCtx.TriggerLineOffset = loc.Column - 1; translatedCtx.TriggerWordLength = ctx.TriggerWordLength; @@ -258,13 +264,16 @@ namespace MonoDevelop.CSharp.Completion public int CaretOffset { get { - return localInfo.HiddenDocument.Editor.Caret.Offset; + return localInfo.HiddenDocument.Editor.CaretOffset; + } + set { + localInfo.HiddenDocument.Editor.CaretOffset = value; } } public int TextLength { get { - return localInfo.HiddenDocument.Editor.Document.TextLength; + return localInfo.HiddenDocument.Editor.Length; } } @@ -279,28 +288,33 @@ namespace MonoDevelop.CSharp.Completion return Gtk.Widget.DefaultStyle; } } + + void ICompletionWidget.AddSkipChar (int cursorPosition, char c) + { + // ignore + } #endregion } - - public ParsedDocument BuildDocument (DocumentInfo info, TextEditorData data) + + ParsedDocument ILanguageCompletionBuilder.BuildDocument (DocumentInfo info, MonoDevelop.Ide.Editor.TextEditor data) { var docStr = BuildDocumentString (info, data); return Parse (info.AspNetDocument.FileName, docStr); } - public string BuildDocumentString (DocumentInfo info, TextEditorData data, List<LocalDocumentInfo.OffsetInfo> offsetInfos = null, bool buildExpressions = false) + public string BuildDocumentString (DocumentInfo info, MonoDevelop.Ide.Editor.TextEditor data, List<LocalDocumentInfo.OffsetInfo> offsetInfos = null, bool buildExpressions = false) { var document = new StringBuilder (); WriteUsings (info.Imports, document); foreach (var node in info.XScriptBlocks) { - var start = data.Document.LocationToOffset (node.Region.Begin.Line, node.Region.Begin.Column) + 2; - var end = data.Document.LocationToOffset (node.Region.End.Line, node.Region.End.Column) - 2; + var start = data.LocationToOffset (node.Region.Begin.Line, node.Region.Begin.Column) + 2; + var end = data.LocationToOffset (node.Region.End.Line, node.Region.End.Column) - 2; if (offsetInfos != null) offsetInfos.Add (new LocalDocumentInfo.OffsetInfo (start, document.Length, end - start)); - document.AppendLine (data.Document.GetTextBetween (start, end)); + document.AppendLine (data.GetTextBetween (start, end)); } if (buildExpressions) { WriteClassDeclaration (info, document); @@ -312,8 +326,8 @@ namespace MonoDevelop.CSharp.Completion foreach (var node in info.XExpressions) { bool isBlock = node is WebFormsRenderBlock; - var start = data.Document.LocationToOffset (node.Region.Begin.Line, node.Region.Begin.Column) + 2; - var end = data.Document.LocationToOffset (node.Region.End.Line, node.Region.End.Column) - 2; + var start = data.LocationToOffset (node.Region.Begin.Line, node.Region.Begin.Column) + 2; + var end = data.LocationToOffset (node.Region.End.Line, node.Region.End.Column) - 2; if (!isBlock) { document.Append ("WriteLine ("); @@ -335,3 +349,4 @@ namespace MonoDevelop.CSharp.Completion } } } +*/
\ No newline at end of file diff --git a/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj b/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj index 5c7536b6d6..8813be65c6 100644 --- a/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj +++ b/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj @@ -70,11 +70,6 @@ <Name>MonoDevelop.DesignerSupport</Name> <Private>False</Private> </ProjectReference> - <ProjectReference Include="..\..\..\core\Mono.Texteditor\Mono.TextEditor.csproj"> - <Project>{A2329308-3751-4DBD-9A75-5F7B8B024625}</Project> - <Name>Mono.TextEditor</Name> - <Private>False</Private> - </ProjectReference> <ProjectReference Include="..\..\MonoDevelop.Refactoring\MonoDevelop.Refactoring.csproj"> <Project>{100568FC-F4E8-439B-94AD-41D11724E45B}</Project> <Name>MonoDevelop.Refactoring</Name> @@ -95,11 +90,6 @@ <Name>MonoDevelop.Deployment</Name> <Private>False</Private> </ProjectReference> - <ProjectReference Include="..\..\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor.csproj"> - <Project>{F8F92AA4-A376-4679-A9D4-60E7B7FBF477}</Project> - <Name>MonoDevelop.SourceEditor</Name> - <Private>False</Private> - </ProjectReference> <ProjectReference Include="..\..\MonoDevelop.Debugger\MonoDevelop.Debugger.csproj"> <Project>{2357AABD-08C7-4808-A495-8FF2D3CDFDB0}</Project> <Name>MonoDevelop.Debugger</Name> diff --git a/main/src/addins/CSharpBinding/AspNet/RazorCSharpCompletionBuilder.cs b/main/src/addins/CSharpBinding/AspNet/RazorCSharpCompletionBuilder.cs index 974f8ba511..d3f1159dd7 100644 --- a/main/src/addins/CSharpBinding/AspNet/RazorCSharpCompletionBuilder.cs +++ b/main/src/addins/CSharpBinding/AspNet/RazorCSharpCompletionBuilder.cs @@ -23,13 +23,14 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-
+/*
using System;
using MonoDevelop.CSharp.Completion;
using MonoDevelop.Ide.CodeCompletion;
-using Mono.TextEditor;
using MonoDevelop.Ide.Gui;
+using ICSharpCode.NRefactory6.CSharp.Completion;
using MonoDevelop.AspNet.Razor;
+using MonoDevelop.Ide.Editor;
namespace MonoDevelop.CSharp.Completion
{
@@ -42,7 +43,7 @@ namespace MonoDevelop.CSharp.Completion return language == "C#";
}
- CSharpCompletionTextEditorExtension CreateCompletion (Document realDocument, UnderlyingDocumentInfo docInfo,
+ CSharpCompletionTextEditorExtension CreateCompletion (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo,
out CodeCompletionContext codeCompletionContext)
{
var documentLocation = docInfo.UnderlyingDocument.Editor.OffsetToLocation (docInfo.CaretPosition);
@@ -54,69 +55,73 @@ namespace MonoDevelop.CSharp.Completion };
return new CSharpCompletionTextEditorExtension (docInfo.UnderlyingDocument) {
- CompletionWidget = CreateCompletionWidget (realDocument, docInfo)
+ CompletionWidget = CreateCompletionWidget (editor, context, docInfo)
};
}
- CSharpCompletionTextEditorExtension CreateCompletionAndUpdate (Document realDocument, UnderlyingDocumentInfo docInfo,
+ CSharpCompletionTextEditorExtension CreateCompletionAndUpdate (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo,
out CodeCompletionContext codeCompletionContext)
{
- var completion = CreateCompletion (realDocument, docInfo, out codeCompletionContext);
+ var completion = CreateCompletion (editor, context, docInfo, out codeCompletionContext);
completion.UpdateParsedDocument ();
return completion;
}
- public ICompletionWidget CreateCompletionWidget (Document realDocument, UnderlyingDocumentInfo docInfo)
+ public ICompletionWidget CreateCompletionWidget (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo)
{
- return new RazorCompletionWidget (realDocument, docInfo);
+ return new RazorCompletionWidget (editor, context, docInfo);
}
- public ICompletionDataList HandlePopupCompletion (Document realDocument, UnderlyingDocumentInfo docInfo)
+ public ICompletionDataList HandlePopupCompletion (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo)
{
CodeCompletionContext ccc;
- var completion = CreateCompletionAndUpdate (realDocument, docInfo, out ccc);
+ var completion = CreateCompletionAndUpdate (editor, context, docInfo, out ccc);
return completion.CodeCompletionCommand (ccc);
}
- public ICompletionDataList HandleCompletion (Document realDocument, CodeCompletionContext completionContext,
+ public ICompletionDataList HandleCompletion (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, CodeCompletionContext completionContext,
UnderlyingDocumentInfo docInfo, char currentChar, ref int triggerWordLength)
{
CodeCompletionContext ccc;
- var completion = CreateCompletionAndUpdate (realDocument, docInfo, out ccc);
- return completion.HandleCodeCompletion (completionContext, currentChar, ref triggerWordLength);
+ var completion = CreateCompletionAndUpdate (editor, context, docInfo, out ccc);
+ return completion.HandleCodeCompletionAsync (completionContext, currentChar, ref triggerWordLength);
}
- public ParameterDataProvider HandleParameterCompletion (Document realDocument, CodeCompletionContext completionContext,
+ public ParameterDataProvider HandleParameterCompletion (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, CodeCompletionContext completionContext,
UnderlyingDocumentInfo docInfo, char completionChar)
{
CodeCompletionContext ccc;
- var completion = CreateCompletionAndUpdate (realDocument, docInfo, out ccc);
- return completion.HandleParameterCompletion (completionContext, completionChar);
+ var completion = CreateCompletionAndUpdate (editor, context, docInfo, out ccc);
+ return completion.HandleParameterCompletionAsync (completionContext, completionChar);
}
- public bool GetParameterCompletionCommandOffset (Document realDocument, UnderlyingDocumentInfo docInfo, out int cpos)
+ public bool GetParameterCompletionCommandOffset (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo, out int cpos)
{
CodeCompletionContext ccc;
- var completion = CreateCompletionAndUpdate (realDocument, docInfo, out ccc);
+ var completion = CreateCompletionAndUpdate (editor, context, docInfo, out ccc);
return completion.GetParameterCompletionCommandOffset (out cpos);
}
- public int GetCurrentParameterIndex (Document realDocument, UnderlyingDocumentInfo docInfo, int startOffset)
+ public int GetCurrentParameterIndex (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo, int startOffset)
{
CodeCompletionContext ccc;
- var completion = CreateCompletionAndUpdate (realDocument, docInfo, out ccc);
+ var completion = CreateCompletionAndUpdate (editor, context, docInfo, out ccc);
return completion.GetCurrentParameterIndex (startOffset);
}
}
class RazorCompletionWidget : ICompletionWidget
{
- Document realDocument;
+ DocumentContext realDocumentContext;
+
+ MonoDevelop.Ide.Editor.TextEditor realEditor;
+
UnderlyingDocumentInfo docInfo;
- public RazorCompletionWidget (Document realDocument, UnderlyingDocumentInfo docInfo)
+ public RazorCompletionWidget (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo)
{
- this.realDocument = realDocument;
+ this.realEditor = editor;
+ this.realDocumentContext = context;
this.docInfo = docInfo;
}
@@ -156,11 +161,11 @@ namespace MonoDevelop.CSharp.Completion public CodeCompletionContext CreateCodeCompletionContext (int triggerOffset)
{
- var savedCtx = realDocument.GetContent<ICompletionWidget> ().CreateCodeCompletionContext (
- realDocument.Editor.Caret.Offset + triggerOffset - docInfo.CaretPosition);
+ var savedCtx = realDocumentContext.GetContent<ICompletionWidget> ().CreateCodeCompletionContext (
+ realEditor.CaretOffset + triggerOffset - docInfo.CaretPosition);
var result = new CodeCompletionContext ();
result.TriggerOffset = triggerOffset;
- var loc = docInfo.UnderlyingDocument.Editor.Document.OffsetToLocation (triggerOffset);
+ var loc = docInfo.UnderlyingDocument.Editor.OffsetToLocation (triggerOffset);
result.TriggerLine = loc.Line;
result.TriggerLineOffset = loc.Column - 1;
@@ -177,7 +182,7 @@ namespace MonoDevelop.CSharp.Completion return null;
int min = Math.Min (ctx.TriggerOffset, CaretOffset);
int max = Math.Max (ctx.TriggerOffset, CaretOffset);
- return docInfo.UnderlyingDocument.Editor.Document.GetTextBetween (min, max);
+ return docInfo.UnderlyingDocument.Editor.GetTextBetween (min, max);
}
public void SetCompletionText (CodeCompletionContext ctx, string partial_word, string complete_word)
@@ -193,25 +198,28 @@ namespace MonoDevelop.CSharp.Completion var translatedCtx = new CodeCompletionContext ();
translatedCtx.TriggerOffset = offset;
- var loc = docInfo.UnderlyingDocument.Editor.Document.OffsetToLocation (offset);
+ var loc = docInfo.UnderlyingDocument.Editor.OffsetToLocation (offset);
translatedCtx.TriggerLine = loc.Line;
translatedCtx.TriggerLineOffset = loc.Column - 1;
translatedCtx.TriggerWordLength = ctx.TriggerWordLength;
- realDocument.GetContent<ICompletionWidget> ().SetCompletionText (
+ realDocumentContext.GetContent<ICompletionWidget> ().SetCompletionText (
translatedCtx, partial_word, complete_word, wordOffset);
}
public int CaretOffset
{
get {
- return docInfo.UnderlyingDocument.Editor.Caret.Offset;
+ return docInfo.UnderlyingDocument.Editor.CaretOffset;
+ }
+ set {
+ docInfo.UnderlyingDocument.Editor.CaretOffset = value;
}
}
public int TextLength
{
get {
- return docInfo.UnderlyingDocument.Editor.Document.TextLength;
+ return docInfo.UnderlyingDocument.Editor.Length;
}
}
@@ -229,6 +237,11 @@ namespace MonoDevelop.CSharp.Completion }
}
+ void ICompletionWidget.AddSkipChar (int cursorPosition, char c)
+ {
+ // ignore
+ }
#endregion
}
}
+*/
\ No newline at end of file |