using System; using System.Threading.Tasks; using LanguageServer.VsCode.Contracts; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Upsilon.Text; namespace UpsilonLanguageServer { public static class Utility { public static readonly JsonSerializer CamelCaseJsonSerializer = new JsonSerializer { ContractResolver = new CamelCasePropertyNamesContractResolver() }; public static string GetTimeStamp() { return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); } public static async Task WaitForDocumentBound(this SessionDocument doc) { while (doc.IsChanging) { await Task.Delay(20); } } public static Range ToRange(this TextSpan span) { return new Range(span.StartLine, span.StartPosition, span.EndLine, span.EndPosition); } } }