public async Task <MediatR.Unit> Handle(InitializedParams @params, CancellationToken token) { if (_clientVersion == ClientVersion.Lsp3) { _initializeComplete.OnNext(ServerSettings); _initializeComplete.OnCompleted(); } return(MediatR.Unit.Value); }
public async Task <Unit> Handle(InitializedParams @params, CancellationToken token) { if (_clientVersion == ClientVersion.Lsp3) { // Small delay to let client respond await Task.Delay(100, token); _initializeComplete.OnNext(ServerSettings); _initializeComplete.OnCompleted(); } return(Unit.Value); }
public static void Initialized(this ILanguageClient mediator, InitializedParams @params) { mediator.SendNotification(GeneralNames.Initialized, @params); }
public override Task <Unit> Handle(InitializedParams request, CancellationToken cancellationToken) => _handler.Invoke(request);
public abstract Task <Unit> Handle(InitializedParams request, CancellationToken cancellationToken);
public virtual Task Initialized(InitializedParams @params, CancellationToken cancellationToken) => Task.CompletedTask;
void InitializedClient() { var param = new InitializedParams(); client_.Send.Initialized(param); }
public virtual Task Initialized(InitializedParams @params) => Task.CompletedTask;
public async Task InitializedAsync(InitializedParams @params, CancellationToken cancellationToken = default, IReadOnlyList <string> userConfiguredPaths = null) { var initializationOptions = _initParams?.initializationOptions; _services.AddService(new DiagnosticsService(_services)); _analyzer = new PythonAnalyzer(_services); _services.AddService(_analyzer); _analyzer.AnalysisComplete += OnAnalysisComplete; _disposableBag.Add(() => _analyzer.AnalysisComplete -= OnAnalysisComplete); _services.AddService(new RunningDocumentTable(_services)); _rdt = _services.GetService <IRunningDocumentTable>(); var interpeterPath = initializationOptions?.interpreter.properties?.InterpreterPath; Version version = null; if (!string.IsNullOrWhiteSpace(interpeterPath)) { Version.TryParse(initializationOptions?.interpreter.properties?.Version, out version); } else { var fs = _services.GetService <IFileSystem>(); var exePath = PathUtils.LookPath(fs, "python"); if (exePath != null && TryGetPythonVersion(exePath, out version)) { _log?.Log(TraceEventType.Information, Resources.UsingPythonFromPATH); interpeterPath = exePath; } else { interpeterPath = null; } } var configuration = new InterpreterConfiguration( interpreterPath: interpeterPath, version: version ); //_services.AddService(new ModuleDatabase(_services)); var typeshedPath = initializationOptions?.typeStubSearchPaths.FirstOrDefault(); userConfiguredPaths = userConfiguredPaths ?? initializationOptions?.searchPaths; _interpreter = await PythonInterpreter.CreateAsync(configuration, Root, _services, typeshedPath, userConfiguredPaths.ToImmutableArray(), cancellationToken); _log?.Log(TraceEventType.Information, string.IsNullOrEmpty(_interpreter.Configuration.InterpreterPath) ? Resources.InitializingForGenericInterpreter : Resources.InitializingForPythonInterpreter.FormatInvariant(_interpreter.Configuration.InterpreterPath)); var fileSystem = _services.GetService <IFileSystem>(); _indexManager = new IndexManager(fileSystem, _interpreter.LanguageVersion, Root, initializationOptions?.includeFiles, initializationOptions?.excludeFiles, _services.GetService <IIdleTimeService>()); _indexManager.IndexWorkspace().DoNotWait(); _analyzer.AnalysisComplete += IndexLibraries; _disposableBag.Add(() => _analyzer.AnalysisComplete -= IndexLibraries); _services.AddService(_indexManager); _disposableBag.Add(_indexManager); var textDocCaps = _initParams?.capabilities?.textDocument; _completionSource = new CompletionSource( ChooseDocumentationSource(textDocCaps?.completion?.completionItem?.documentationFormat), Settings.completion, Services ); _hoverSource = new HoverSource( ChooseDocumentationSource(textDocCaps?.hover?.contentFormat) ); var sigInfo = textDocCaps?.signatureHelp?.signatureInformation; _signatureSource = new SignatureSource( ChooseDocumentationSource(sigInfo?.documentationFormat), sigInfo?.parameterInformation?.labelOffsetSupport == true ); _initialized = true; }
public async Task InitializedAsync(InitializedParams @params, CancellationToken cancellationToken = default, IReadOnlyList <string> userConfiguredPaths = null) { var initializationOptions = _initParams?.initializationOptions; _services.AddService(new DiagnosticsService(_services)); var cacheFolderPath = initializationOptions?.cacheFolderPath; var fs = _services.GetService <IFileSystem>(); if (cacheFolderPath != null && !fs.DirectoryExists(cacheFolderPath)) { _log?.Log(TraceEventType.Warning, Resources.Error_InvalidCachePath); cacheFolderPath = null; } var analyzer = new PythonAnalyzer(_services, cacheFolderPath); _services.AddService(analyzer); analyzer.AnalysisComplete += OnAnalysisComplete; _disposableBag.Add(() => analyzer.AnalysisComplete -= OnAnalysisComplete); _services.AddService(new RunningDocumentTable(_services)); _rdt = _services.GetService <IRunningDocumentTable>(); Version.TryParse(initializationOptions?.interpreter.properties?.Version, out var version); var configuration = new InterpreterConfiguration(null, null, interpreterPath: initializationOptions?.interpreter.properties?.InterpreterPath, version: version ); var typeshedPath = initializationOptions?.typeStubSearchPaths.FirstOrDefault(); userConfiguredPaths = userConfiguredPaths ?? initializationOptions?.searchPaths; _interpreter = await PythonInterpreter.CreateAsync(configuration, Root, _services, typeshedPath, userConfiguredPaths.ToImmutableArray(), cancellationToken); _services.AddService(_interpreter); _log?.Log(TraceEventType.Information, string.IsNullOrEmpty(_interpreter.Configuration.InterpreterPath) ? Resources.InitializingForGenericInterpreter : Resources.InitializingForPythonInterpreter.FormatInvariant(_interpreter.Configuration.InterpreterPath)); var fileSystem = _services.GetService <IFileSystem>(); _indexManager = new IndexManager(fileSystem, _interpreter.LanguageVersion, Root, initializationOptions?.includeFiles, initializationOptions?.excludeFiles, _services.GetService <IIdleTimeService>()); _indexManager.IndexWorkspace().DoNotWait(); _services.AddService(_indexManager); _disposableBag.Add(_indexManager); var textDocCaps = _initParams?.capabilities?.textDocument; _completionSource = new CompletionSource( ChooseDocumentationSource(textDocCaps?.completion?.completionItem?.documentationFormat), Settings.completion ); _hoverSource = new HoverSource( ChooseDocumentationSource(textDocCaps?.hover?.contentFormat) ); var sigInfo = textDocCaps?.signatureHelp?.signatureInformation; _signatureSource = new SignatureSource( ChooseDocumentationSource(sigInfo?.documentationFormat), sigInfo?.parameterInformation?.labelOffsetSupport == true ); }
public virtual async Task Initialized(InitializedParams @params) { }
internal virtual void InitializedClient(LSP.Implementation.LanguageClient client) { var param = new InitializedParams(); client.Send.Initialized(param); }