public DefaultLSPRequestInvoker(
            ILanguageServiceBroker2 languageServiceBroker,
            FallbackCapabilitiesFilterResolver fallbackCapabilitiesFilterResolver)
        {
            if (languageServiceBroker is null)
            {
                throw new ArgumentNullException(nameof(languageServiceBroker));
            }

            if (fallbackCapabilitiesFilterResolver is null)
            {
                throw new ArgumentNullException(nameof(fallbackCapabilitiesFilterResolver));
            }

            _languageServiceBroker = languageServiceBroker;
            _fallbackCapabilitiesFilterResolver = fallbackCapabilitiesFilterResolver;

            // We need these converters so we don't lose information as part of the deserialization.
            _serializer = new JsonSerializer();
            _serializer.Converters.Add(new VSExtensionConverter <ClientCapabilities, VSClientCapabilities>());
            _serializer.Converters.Add(new VSExtensionConverter <CompletionItem, VSCompletionItem>());
            _serializer.Converters.Add(new VSExtensionConverter <SignatureInformation, VSSignatureInformation>());
            _serializer.Converters.Add(new VSExtensionConverter <Hover, VSHover>());
            _serializer.Converters.Add(new VSExtensionConverter <ServerCapabilities, VSServerCapabilities>());
            _serializer.Converters.Add(new VSExtensionConverter <SymbolInformation, VSSymbolInformation>());
            _serializer.Converters.Add(new VSExtensionConverter <CompletionList, VSCompletionList>());
            _serializer.Converters.Add(new VSExtensionConverter <CodeAction, VSCodeAction>());
        }
예제 #2
0
        public DefaultLSPRequestInvoker(
            ILanguageServiceBroker2 languageServiceBroker,
            FallbackCapabilitiesFilterResolver fallbackCapabilitiesFilterResolver)
        {
            if (languageServiceBroker is null)
            {
                throw new ArgumentNullException(nameof(languageServiceBroker));
            }

            if (fallbackCapabilitiesFilterResolver is null)
            {
                throw new ArgumentNullException(nameof(fallbackCapabilitiesFilterResolver));
            }

            _languageServiceBroker = languageServiceBroker;
            _fallbackCapabilitiesFilterResolver = fallbackCapabilitiesFilterResolver;

            // We need these converters so we don't lose information as part of the deserialization.
            _serializer = new JsonSerializer();
            _serializer.AddVSInternalExtensionConverters();
        }