コード例 #1
0
        /// <summary>
        /// Creates a <see cref="TranslationStrategyBase"/>.
        /// </summary>
        /// <param name="configurationSource">Source for the configuration that should be used.</param>
        /// <param name="templatingEngine">Engine to use for loading templates.</param>
        /// <param name="documentationSource">Source for looking up documentation comments for members.</param>
        /// <param name="logger">Logger to use for writing log messages.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="templatingEngine"/> or <paramref name="documentationSource"/> or <paramref name="logger"/> is null.</exception>
        protected TranslationStrategyBase(IConfigurationSource configurationSource, ITemplatingEngine templatingEngine, IDocumentationSource documentationSource, ILogger logger)
        {
            if (configurationSource == null)
            {
                throw new ArgumentNullException(nameof(configurationSource));
            }

            _templatingEngine    = templatingEngine ?? throw new ArgumentNullException(nameof(templatingEngine));
            _documentationSource = documentationSource ?? throw new ArgumentNullException(nameof(documentationSource));

            Logger = logger ?? throw new ArgumentNullException(nameof(logger));
            TypeReferenceTranslator = new DefaultTypeReferenceTranslator(configurationSource, logger);
            DecoratorTranslator     = new DecoratorTranslator(configurationSource);
            Configuration           = configurationSource.GetSection <TranspilationConfiguration>()
                                      ?? TranspilationConfiguration.Default;
        }
コード例 #2
0
 public CompletionSource(IDocumentationSource docSource, ServerSettings.PythonCompletionOptions completionSettings, IServiceContainer services)
 {
     _itemSource = new CompletionItemSource(docSource, completionSettings);
     _services   = services;
 }
コード例 #3
0
 public HoverSource(IDocumentationSource docSource)
 {
     _docSource = docSource;
 }
コード例 #4
0
 /// <summary>
 /// Creates a <see cref="EnumDefinitionTranslator"/>.
 /// </summary>
 /// <param name="configurationSource">Source for the configuration that should be used.</param>
 /// <param name="templatingEngine">Engine to use for loading templates.</param>
 /// <param name="documentationSource">Source for looking up documentation comments for members.</param>
 /// <param name="logger">Logger to use for writing log messages.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="templatingEngine"/> or <paramref name="documentationSource"/> or <paramref name="logger"/> is null.</exception>
 public EnumDefinitionTranslationStrategy(IConfigurationSource configurationSource, ITemplatingEngine templatingEngine, IDocumentationSource documentationSource, ILogger logger)
     : base(configurationSource, templatingEngine, documentationSource, logger)
 {
 }
コード例 #5
0
        /// <summary>
        /// Creates a <see cref="DefaultTypeDefinitionTranslator"/>.
        /// </summary>
        /// <param name="configurationSource">Source for the configuration that should be used.</param>
        /// <param name="templatingEngine">Engine to use for loading templates.</param>
        /// <param name="documentationSource">Source for looking up documentation comments for members.</param>
        /// <param name="logger">Logger to use for writing log messages.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="templatingEngine"/> or <paramref name="documentationSource"/> or <paramref name="logger"/> is null.</exception>
        public DefaultTypeDefinitionTranslator(IConfigurationSource configurationSource, ITemplatingEngine templatingEngine, IDocumentationSource documentationSource, ILogger logger)
        {
            if (configurationSource == null)
            {
                throw new ArgumentNullException(nameof(configurationSource));
            }
            if (templatingEngine == null)
            {
                throw new ArgumentNullException(nameof(templatingEngine));
            }
            if (documentationSource == null)
            {
                throw new ArgumentNullException(nameof(documentationSource));
            }

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _strategies = new ITypeDefinitionTranslationStrategy[]
            {
                new ClassDefinitionTranslationStrategy(configurationSource, templatingEngine, documentationSource, logger),
                new InterfaceDefinitionTranslationStrategy(configurationSource, templatingEngine, documentationSource, logger),
                new EnumDefinitionTranslationStrategy(configurationSource, templatingEngine, documentationSource, logger)
            };
        }
コード例 #6
0
 /// <summary>
 /// Creates a <see cref="ClassDefinitionTranslationStrategy"/>.
 /// </summary>
 /// <param name="configurationSource">Source for the configuration that should be used.</param>
 /// <param name="templatingEngine">Engine to use for loading templates.</param>
 /// <param name="documentationSource">Source for looking up documentation comments for members.</param>
 /// <param name="logger">Logger to use for writing log messages.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="templatingEngine"/> or <paramref name="documentationSource"/> or <paramref name="logger"/> is null.</exception>
 public ClassDefinitionTranslationStrategy(IConfigurationSource configurationSource, ITemplatingEngine templatingEngine, IDocumentationSource documentationSource, ILogger logger)
     : base(configurationSource, templatingEngine, documentationSource, logger)
 {
     _defaultValueProvider = new DefaultValueProvider(configurationSource, logger, TypeReferenceTranslator);
 }
コード例 #7
0
 public CompletionSource(IDocumentationSource docSource, ServerSettings.PythonCompletionOptions completionSettings)
 {
     _itemSource = new CompletionItemSource(docSource, completionSettings);
 }
コード例 #8
0
 public CompletionItemSource(IDocumentationSource docSource, ServerSettings.PythonCompletionOptions options)
 {
     _docSource = docSource;
     Options    = options;
 }
コード例 #9
0
 public SignatureSource(IDocumentationSource docSource, bool labelOffsetSupport = true)
 {
     _docSource = docSource;
     // TODO: deprecate eventually.
     _labelOffsetSupport = labelOffsetSupport; // LSP 3.14.0+
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new <see cref="ModelDocumentationUpdater"/>.
 /// </summary>
 /// <param name="documentationSource">The documentation source</param>
 public ModelDocumentationUpdater(IDocumentationSource documentationSource)
 {
     _documentationSource = documentationSource;
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new <see cref="ModelDocumentationUpdater"/>.
 /// </summary>
 /// <param name="documentationSource">The documentation source</param>
 public ModelDocumentationUpdater(IDocumentationSource documentationSource)
 {
     _documentationSource = documentationSource;
 }
コード例 #12
0
 public SignatureSource(IDocumentationSource docSource)
 {
     _docSource = docSource;
 }