You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good Morning,
I'm upgrading from .095 to the latest version of OmniSharp.
Everything was working fine in .095, but after upgrading, and changing my Program.cs file to look like your SampleServer File (for testing), I get the following error.
DryIoc.ContainerException: 'code: Error.UnableToResolveFromRegisteredServices;
message: Unable to resolve Resolution root DocIndex.VsCode.Server.TextDocumentSyncHandler
from container without scope
with Rules with {TrackingDisposableTransients, ResolveIEnumerableAsLazyEnumerable, UseDynamicRegistrationsAsFallbackOnly, SelectLastRegisteredFactory} and without {ThrowOnRegisteringDisposableTransient, VariantGenericTypesInResolvedCollection}
with DefaultReuse=Scoped {Lifespan=100}
with FactorySelector=SelectLastRegisteredFactory
with Made={FactoryMethod=ConstructorWithResolvableArgumentsIncludingNonPublic}
with normal and dynamic registrations:
(DefaultDynamicKey(0), {FactoryID=134, ImplType=DocIndex.VsCode.Server.TextDocumentSyncHandler, Reuse=TransientReuse, HasCondition})'
Source Code
var server = await LanguageServer.From(
options =>
options
.WithInput(Console.OpenStandardInput())
.WithOutput(Console.OpenStandardOutput())
.ConfigureLogging(
x => x
.AddSerilog(Log.Logger)
.AddLanguageProtocolLogging()
.SetMinimumLevel(LogLevel.Debug)
)
.WithHandler<TextDocumentHandler>()
.WithHandler<DidChangeWatchedFilesHandler>()
.WithHandler<FoldingRangeHandler>()
.WithHandler<MyWorkspaceSymbolsHandler>()
.WithHandler<MyDocumentSymbolHandler>()
.WithHandler<SemanticTokensHandler>()
.WithServices(x => x.AddLogging(b => b.SetMinimumLevel(LogLevel.Trace)))
.WithServices(
services => {
services.AddSingleton(
provider => {
var loggerFactory = provider.GetService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger<Foo>();
logger.LogInformation("Configuring");
return new Foo(logger);
}
);
services.AddSingleton(
new ConfigurationItem {
Section = "typescript",
}
).AddSingleton(
new ConfigurationItem {
Section = "terminal",
}
);
}
)
.OnInitialize(
async (server, request, token) => {
var manager = server.WorkDoneManager.For(
request, new WorkDoneProgressBegin {
Title = "Server is starting...",
Percentage = 10,
}
);
workDone = manager;
await Task.Delay(2000).ConfigureAwait(false);
manager.OnNext(
new WorkDoneProgressReport {
Percentage = 20,
Message = "loading in progress"
}
);
}
)
.OnInitialized(
async (server, request, response, token) => {
workDone.OnNext(
new WorkDoneProgressReport {
Percentage = 40,
Message = "loading almost done",
}
);
await Task.Delay(2000).ConfigureAwait(false);
workDone.OnNext(
new WorkDoneProgressReport {
Message = "loading done",
Percentage = 100,
}
);
workDone.OnCompleted();
}
)
.OnStarted(
async (languageServer, token) => {
using var manager = await languageServer.WorkDoneManager.Create(new WorkDoneProgressBegin { Title = "Doing some work..." }).ConfigureAwait(false);
manager.OnNext(new WorkDoneProgressReport { Message = "doing things..." });
await Task.Delay(10000).ConfigureAwait(false);
manager.OnNext(new WorkDoneProgressReport { Message = "doing things... 1234" });
await Task.Delay(10000).ConfigureAwait(false);
manager.OnNext(new WorkDoneProgressReport { Message = "doing things... 56789" });
var logger = languageServer.Services.GetService<ILogger<Foo>>();
var configuration = await languageServer.Configuration.GetConfiguration(
new ConfigurationItem {
Section = "typescript",
}, new ConfigurationItem {
Section = "terminal",
}
).ConfigureAwait(false);
var baseConfig = new JObject();
foreach (var config in languageServer.Configuration.AsEnumerable())
{
baseConfig.Add(config.Key, config.Value);
}
logger.LogInformation("Base Config: {Config}", baseConfig);
var scopedConfig = new JObject();
foreach (var config in configuration.AsEnumerable())
{
scopedConfig.Add(config.Key, config.Value);
}
logger.LogInformation("Scoped Config: {Config}", scopedConfig);
}
)
In your example, I don't see anywhere that you are registering the TextDocumentHandler outside of the .With Statement.
Do you hany any ideas what could be missing here?
The text was updated successfully, but these errors were encountered:
For me, it was caused by #338. I had some handlers with ILanguageServer constructor parameters. Changing these to ILanguageServerFacade fixed the issue.
Good Morning,
I'm upgrading from .095 to the latest version of OmniSharp.
Everything was working fine in .095, but after upgrading, and changing my Program.cs file to look like your SampleServer File (for testing), I get the following error.
Source Code
In your example, I don't see anywhere that you are registering the TextDocumentHandler outside of the .With Statement.
Do you hany any ideas what could be missing here?
The text was updated successfully, but these errors were encountered: