Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExpansionField.cs « Snippet « Intellisense « Def « Language « Editor « src - github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9bdef926f2fe83d4ec0e355c967cfd4132417461 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//  Licensed under the MIT License. See License.txt in the project root for license information.
//

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace Microsoft.VisualStudio.Text.Editor.Expansion
{
    public class ExpansionField
    {
        public string ID { get; set; }
        public string ToolTip { get; set; }
        public string Default { get; set; }
        public string Function { get; set; }

        private List<int> offsets = new List<int>();

        public int GetOffsetCount()
        {
            return offsets.Count;
        }

        public void AddOffset(int offset)
        {
            offsets.Add(offset);
        }

        public int GetOffset(int index)
        {
            return offsets[index];
        }

        public string GetDefault()
        {
            return Default;
        }

        public int GetLength()
        {
            return Default.Length;
        }

        public bool IsEditable()
        {
            return Editable;
        }

        public XElement GetFunctionXML()
        {
            return new XElement(XName.Get("ExpansionField"))
            {
                Value = Function
            };
        }

        public bool UsesFunction()
        {
            return Function != null;
        }

        public bool IsDefault { get; set; }
        public bool Editable { get; set; }

        public string GetName()
        {
            return ID;
        }
    }
}