using NubLang.Syntax; using OmniSharp.Extensions.LanguageServer.Protocol; namespace NubLang.LSP; public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher) { private readonly Dictionary _files = new(); public void UpdateFile(DocumentUri path) { var text = File.ReadAllText(path.GetFileSystemPath()); var tokenizer = new Tokenizer(path.GetFileSystemPath(), text); tokenizer.Tokenize(); diagnosticsPublisher.Publish(path, tokenizer.Diagnostics); var parser = new Parser(); var result = parser.Parse(tokenizer.Tokens); diagnosticsPublisher.Publish(path, parser.Diagnostics); _files[path] = result; } public void RemoveFile(Uri path) { _files.Remove(path); } }