Beispiel #1
0
        private static LSP.DocumentSymbol CreateDocumentSymbol(
            LSP.SymbolKind kind,
            string name,
            string detail,
            LSP.Location location,
            LSP.Location selection,
            LSP.DocumentSymbol parent = null
            )
        {
            var documentSymbol = new LSP.DocumentSymbol()
            {
                Kind           = kind,
                Name           = name,
                Range          = location.Range,
                Children       = new LSP.DocumentSymbol[0],
                Detail         = detail,
                Deprecated     = false,
                SelectionRange = selection.Range
            };

            if (parent != null)
            {
                var children = parent.Children.ToList();
                children.Add(documentSymbol);
                parent.Children = children.ToArray();
            }

            return(documentSymbol);
        }
Beispiel #2
0
        internal static LSP.SymbolInformation CreateSymbolInformation(LSP.SymbolKind kind, string name, LSP.Location location, Glyph glyph, string?containerName = null)
        {
            var info = new LSP.VSSymbolInformation()
            {
                Kind     = kind,
                Name     = name,
                Location = location,
                Icon     = new ImageElement(glyph.GetImageId()),
            };

            if (containerName != null)
            {
                info.ContainerName = containerName;
            }

            return(info);
        }
        internal static LSP.SymbolInformation CreateSymbolInformation(LSP.SymbolKind kind, string name, LSP.Location location, Glyph glyph, string?containerName = null)
        {
            var info = new LSP.VSSymbolInformation()
            {
                Kind     = kind,
                Name     = name,
                Location = location,
                Icon     = VSLspExtensionConversions.GetImageIdFromGlyph(glyph)
            };

            if (containerName != null)
            {
                info.ContainerName = containerName;
            }

            return(info);
        }
Beispiel #4
0
        public static Glyph SymbolKindToGlyph(LSP.SymbolKind kind)
        {
            switch (kind)
            {
            case LSP.SymbolKind.File:
                return(Glyph.CSharpFile);

            case LSP.SymbolKind.Module:
                return(Glyph.ModulePublic);

            case LSP.SymbolKind.Namespace:
                return(Glyph.Namespace);

            case LSP.SymbolKind.Package:
                return(Glyph.Assembly);

            case LSP.SymbolKind.Class:
                return(Glyph.ClassPublic);

            case LSP.SymbolKind.Method:
                return(Glyph.MethodPublic);

            case LSP.SymbolKind.Property:
                return(Glyph.PropertyPublic);

            case LSP.SymbolKind.Field:
                return(Glyph.FieldPublic);

            case LSP.SymbolKind.Constructor:
                return(Glyph.MethodPublic);

            case LSP.SymbolKind.Enum:
                return(Glyph.EnumPublic);

            case LSP.SymbolKind.Interface:
                return(Glyph.InterfacePublic);

            case LSP.SymbolKind.Function:
                return(Glyph.DelegatePublic);

            case LSP.SymbolKind.Variable:
                return(Glyph.Local);

            case LSP.SymbolKind.Constant:
            case LSP.SymbolKind.Number:
                return(Glyph.ConstantPublic);

            case LSP.SymbolKind.String:
            case LSP.SymbolKind.Boolean:
            case LSP.SymbolKind.Array:
            case LSP.SymbolKind.Object:
            case LSP.SymbolKind.Key:
            case LSP.SymbolKind.Null:
                return(Glyph.Local);

            case LSP.SymbolKind.EnumMember:
                return(Glyph.EnumMemberPublic);

            case LSP.SymbolKind.Struct:
                return(Glyph.StructurePublic);

            case LSP.SymbolKind.Event:
                return(Glyph.EventPublic);

            case LSP.SymbolKind.Operator:
                return(Glyph.Operator);

            case LSP.SymbolKind.TypeParameter:
                return(Glyph.TypeParameter);

            default:
                return(Glyph.None);
            }
        }