public static SemanticTokensOptions Of(ISemanticTokensOptions options,
                                               IEnumerable <IHandlerDescriptor> descriptors)
        {
            var result = new SemanticTokensOptions()
            {
                WorkDoneProgress = options.WorkDoneProgress,
                Legend           = options.Legend ?? new SemanticTokensLegend(),
                DocumentProvider = options.DocumentProvider,
                RangeProvider    = options.RangeProvider
            };

            if (result.DocumentProvider != null && result.DocumentProvider.Edits != true)
            {
                var edits = descriptors.Any(z => z.HandlerType == typeof(ISemanticTokensEditsHandler));
                if (edits)
                {
                    result.DocumentProvider = new Supports <SemanticTokensDocumentProviderOptions>(true,
                                                                                                   new SemanticTokensDocumentProviderOptions()
                    {
                        Edits = true
                    });
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static SemanticTokensOptions Of(ISemanticTokensOptions options, IEnumerable <IHandlerDescriptor> descriptors)
        {
            var result = new SemanticTokensOptions()
            {
                WorkDoneProgress = options.WorkDoneProgress,
                Legend           = options.Legend ?? new SemanticTokensLegend(),
                Full             = options.Full,
                Range            = options.Range
            };

            if (result.Full != null && result.Full?.Value.Delta != true)
            {
                var edits = descriptors.Any(z => z.HandlerType == typeof(ISemanticTokensDeltaHandler));
                if (edits)
                {
                    result.Full = new BooleanOr <SemanticTokensCapabilityRequestFull>(new SemanticTokensCapabilityRequestFull()
                    {
                        Delta = true
                    });
                }
            }

            return(result);
        }