aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/MethodCompletionItem.cs
blob: d2ee4092012f203180327cedc49d115c02e22acb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;

namespace Tango.Scripting.Editors.Intellisense
{
    public class MethodCompletionItem : CompletionItem
    {
        private static BitmapSource image = GetImage("method.png");

        public override string Text => Name;
        public override CompletionItemPopupControl PopupControl => new MethodCompletionItemPopup();
        public override BitmapSource Image => image;

        public String Class { get; set; }
        public String Name { get; set; }
        public String ReturnType { get; set; }

        public int Overloads { get; set; }

        public bool HasOverloads
        {
            get { return Overloads > 0; }
        }

        public List<KnownTypeMethodParameter> Parameters { get; set; }

        public override void Complete(ScriptEditor editor)
        {
            base.Complete(editor);

            if (Text.Contains("<T>"))
            {
                editor.CaretOffset -= 2;
                editor.Select(editor.CaretOffset, 1);
            }
        }

        public MethodCompletionItem()
        {
            Parameters = new List<KnownTypeMethodParameter>();
        }
    }
}