Example #1
0
        public Task <Unit> Handle(DidChangeTextDocumentParams request, CancellationToken cancellationToken)
        {
            if (request?.TextDocument == null)
            {
                return(Unit.Task);
            }

            if (null == request.TextDocument.Uri)
            {
                return(Unit.Task);
            }

            string documentPath = request.TextDocument.Uri.ToString();

            if (null == request.ContentChanges)
            {
                return(Unit.Task);
            }

            if (null == request.ContentChanges.FirstOrDefault())
            {
                return(Unit.Task);
            }

            string text = request.ContentChanges.FirstOrDefault()?.Text;

            m_bufferManager.UpdateBuffer(documentPath, new SimpleDocumentBuffer(text));
            m_router.Window.LogInfo(
                LocalizableTexts.ResourceManager.GetString("GameConstantsFileDocumentSyncHandler_Handle_LogInfo") +
                ": " + documentPath + "\n" + text);
            return(Unit.Task);
        }