...
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using NubLang.Ast;
|
||||
using NubLang.Generation;
|
||||
using NubLang.Syntax;
|
||||
using OmniSharp.Extensions.LanguageServer.Protocol;
|
||||
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
|
||||
|
||||
namespace NubLang.LSP;
|
||||
|
||||
public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher)
|
||||
public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher, ILanguageServerFacade server)
|
||||
{
|
||||
private readonly Dictionary<DocumentUri, SyntaxTree> _syntaxTrees = new();
|
||||
private readonly Dictionary<DocumentUri, CompilationUnit> _compilationUnits = new();
|
||||
@@ -39,6 +41,15 @@ public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher)
|
||||
var result = typeChecker.Check();
|
||||
diagnosticsPublisher.Publish(path, typeChecker.Diagnostics);
|
||||
_compilationUnits[path] = result;
|
||||
|
||||
var generator = new Generator(result);
|
||||
var c = generator.Emit();
|
||||
|
||||
server.SendNotification("nub/output", new
|
||||
{
|
||||
content = c,
|
||||
uri = path
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user