Exemplo n.º 1
0
        public RazorDiagnosticsPublisher(
            ForegroundDispatcher foregroundDispatcher,
            ITextDocumentLanguageServer languageServer,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (languageServer == null)
            {
                throw new ArgumentNullException(nameof(languageServer));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _languageServer       = languageServer;
            _publishedDiagnostics = new Dictionary <string, IReadOnlyList <RazorDiagnostic> >(FilePathComparer.Instance);
            _work   = new Dictionary <string, DocumentSnapshot>(FilePathComparer.Instance);
            _logger = loggerFactory.CreateLogger <RazorDiagnosticsPublisher>();
        }
        internal LanguageServer(
            Connection connection,
            IResponseRouter responseRouter,
            IOptions <LanguageServerOptions> options,
            ILanguageServerConfiguration configuration,
            ServerInfo serverInfo,
            ILspServerReceiver receiver,
            ISerializer serializer,
            IServiceProvider serviceProvider,
            ISupportedCapabilities supportedCapabilities,
            TextDocumentIdentifiers textDocumentIdentifiers,
            IEnumerable <OnLanguageServerInitializeDelegate> initializeDelegates,
            IEnumerable <OnLanguageServerInitializedDelegate> initializedDelegates,
            IEnumerable <OnLanguageServerStartedDelegate> startedDelegates,
            IEnumerable <IOnLanguageServerStarted> startedHandlers,
            IServerWorkDoneManager serverWorkDoneManager,
            ITextDocumentLanguageServer textDocumentLanguageServer,
            IClientLanguageServer clientLanguageServer,
            IGeneralLanguageServer generalLanguageServer,
            IWindowLanguageServer windowLanguageServer,
            IWorkspaceLanguageServer workspaceLanguageServer,
            LanguageProtocolSettingsBag languageProtocolSettingsBag,
            SharedHandlerCollection handlerCollection,
            IProgressManager progressManager,
            ILanguageServerWorkspaceFolderManager workspaceFolderManager, IEnumerable <IOnLanguageServerInitialize> initializeHandlers,
            IEnumerable <IOnLanguageServerInitialized> initializedHandlers
            ) : base(handlerCollection, responseRouter)
        {
            Configuration = configuration;

            _connection              = connection;
            _serverInfo              = serverInfo;
            _serverReceiver          = receiver;
            _serializer              = serializer;
            _supportedCapabilities   = supportedCapabilities;
            _textDocumentIdentifiers = textDocumentIdentifiers;
            _initializeDelegates     = initializeDelegates;
            _initializedDelegates    = initializedDelegates;
            _startedDelegates        = startedDelegates;
            _startedHandlers         = startedHandlers;
            WorkDoneManager          = serverWorkDoneManager;
            _settingsBag             = languageProtocolSettingsBag;
            Services    = serviceProvider;
            _collection = handlerCollection;

            // We need to at least create Window here in case any handler does logging in their constructor
            TextDocument           = textDocumentLanguageServer;
            Client                 = clientLanguageServer;
            General                = generalLanguageServer;
            Window                 = windowLanguageServer;
            Workspace              = workspaceLanguageServer;
            ProgressManager        = progressManager;
            WorkspaceFolderManager = workspaceFolderManager;
            _initializeHandlers    = initializeHandlers;
            _initializedHandlers   = initializedHandlers;
            _concurrency           = options.Value.Concurrency;

            _disposable.Add(_collection.Add(this));
        }
 public TestRazorDiagnosticsPublisher(
     ForegroundDispatcher foregroundDispatcher,
     ITextDocumentLanguageServer languageServer,
     ILoggerFactory loggerFactory) : base(foregroundDispatcher, languageServer, loggerFactory)
 {
     // The diagnostics publisher by default will wait 2 seconds until publishing diagnostics. For testing purposes we redcuce
     // the amount of time we wait for diagnostic publishing because we have more concrete control of the timer and its lifecycle.
     _publishDelay = TimeSpan.FromMilliseconds(1);
 }
 public CompilationStatusNotificationPublisher(ITextDocumentLanguageServer languageServer)
 {
     this.languageServer = languageServer;
 }
        internal LanguageServer(
            Connection connection,
            IResponseRouter responseRouter,
            IOptions <LanguageServerOptions> options,
            ILanguageServerConfiguration configuration,
            ServerInfo serverInfo,
            ILspServerReceiver receiver,
            ISerializer serializer,
            IResolverContext resolverContext,
            ISupportedCapabilities supportedCapabilities,
            TextDocumentIdentifiers textDocumentIdentifiers,
            IEnumerable <OnLanguageServerInitializeDelegate> initializeDelegates,
            IEnumerable <OnLanguageServerInitializedDelegate> initializedDelegates,
            IEnumerable <OnLanguageServerStartedDelegate> startedDelegates,
            IEnumerable <IOnLanguageServerStarted> startedHandlers,
            IServerWorkDoneManager serverWorkDoneManager,
            ITextDocumentLanguageServer textDocumentLanguageServer,
            IClientLanguageServer clientLanguageServer,
            IGeneralLanguageServer generalLanguageServer,
            IWindowLanguageServer windowLanguageServer,
            IWorkspaceLanguageServer workspaceLanguageServer,
            LanguageProtocolSettingsBag languageProtocolSettingsBag,
            SharedHandlerCollection handlerCollection,
            IProgressManager progressManager,
            ILanguageServerWorkspaceFolderManager workspaceFolderManager, IEnumerable <IOnLanguageServerInitialize> initializeHandlers,
            IEnumerable <IOnLanguageServerInitialized> initializedHandlers,
            IEnumerable <IRegistrationOptionsConverter> registrationOptionsConverters,
            InstanceHasStarted instanceHasStarted
            ) : base(handlerCollection, responseRouter)
        {
            Configuration = configuration;

            _connection              = connection;
            _serverInfo              = serverInfo;
            _serverReceiver          = receiver;
            _serializer              = serializer;
            _supportedCapabilities   = supportedCapabilities;
            _textDocumentIdentifiers = textDocumentIdentifiers;
            _initializeDelegates     = initializeDelegates;
            _initializedDelegates    = initializedDelegates;
            _startedDelegates        = startedDelegates;
            _startedHandlers         = startedHandlers;
            WorkDoneManager          = serverWorkDoneManager;
            _settingsBag             = languageProtocolSettingsBag;
            Services    = _resolverContext = resolverContext;
            _collection = handlerCollection;

            // We need to at least create Window here in case any handler does logging in their constructor
            TextDocument                   = textDocumentLanguageServer;
            Client                         = clientLanguageServer;
            General                        = generalLanguageServer;
            Window                         = windowLanguageServer;
            Workspace                      = workspaceLanguageServer;
            ProgressManager                = progressManager;
            WorkspaceFolderManager         = workspaceFolderManager;
            _initializeHandlers            = initializeHandlers;
            _initializedHandlers           = initializedHandlers;
            _registrationOptionsConverters = registrationOptionsConverters;
            _instanceHasStarted            = instanceHasStarted;
            _concurrency                   = options.Value.Concurrency;

            _capabilityTypes = options
                               .Value.Assemblies
                               .SelectMany(z => z.ExportedTypes)
                               .Where(z => z.IsClass && !z.IsAbstract)
                               .Where(z => typeof(ICapability).IsAssignableFrom(z))
                               .Where(z => z.GetCustomAttributes <CapabilityKeyAttribute>().Any())
                               .ToLookup(z => string.Join(".", z.GetCustomAttribute <CapabilityKeyAttribute>().Keys));

            _disposable.Add(_collection.Add(this));
        }
Exemplo n.º 6
0
 public VerificationNotificationPublisher(ITextDocumentLanguageServer languageServer)
 {
     _languageServer = languageServer;
 }