You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) |
|
|
|
using System; |
|
using System.Collections.Generic; |
|
using ICSharpCode.NRefactory; |
|
using ICSharpCode.NRefactory.Completion; |
|
using ICSharpCode.SharpDevelop; |
|
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
|
|
|
namespace CSharpBinding.Completion |
|
{ |
|
class CompletionData : ICompletionData, ICompletionItem, IFancyCompletionItem |
|
{ |
|
public CompletionData(string text = "") |
|
{ |
|
this.DisplayText = text; |
|
this.CompletionText = text; |
|
} |
|
|
|
public CompletionCategory CompletionCategory { get; set; } |
|
public string DisplayText { get; set; } |
|
public string Description { get; set; } |
|
public string CompletionText { get; set; } |
|
|
|
DisplayFlags displayFlags; |
|
DisplayFlags ICompletionData.DisplayFlags { |
|
get { return displayFlags; } |
|
set { displayFlags = value; } |
|
} |
|
|
|
public virtual bool HasOverloads { get { return false; } } |
|
|
|
public virtual IEnumerable<ICompletionData> OverloadedData { |
|
get { return EmptyList<ICompletionData>.Instance; } |
|
} |
|
|
|
public virtual void AddOverload(ICompletionData data) |
|
{ |
|
throw new InvalidOperationException(); |
|
} |
|
|
|
string ICompletionItem.Text { |
|
get { return this.CompletionText; } |
|
} |
|
|
|
public IImage Image { get; set; } |
|
|
|
public virtual double Priority { |
|
get { return 0; } |
|
} |
|
|
|
public virtual void Complete(CompletionContext context) |
|
{ |
|
context.Editor.Document.Replace(context.StartOffset, context.Length, this.CompletionText); |
|
context.EndOffset = context.StartOffset + this.CompletionText.Length; |
|
} |
|
|
|
object IFancyCompletionItem.Content { |
|
get { return this.DisplayText; } |
|
} |
|
|
|
object IFancyCompletionItem.Description { |
|
get { return this.Description; } |
|
} |
|
} |
|
}
|
|
|