Exemplo n.º 1
0
        public Task HandleNotificationAsync(string methodName, JToken methodParam, Func <JToken, Task> sendNotification)
        {
            try {
                // intercept any "temp" file paths that contain codestream-diff info
                // and do not send them along to the agent
                if (methodParam != null && methodParam["textDocument"] != null &&
                    methodParam["textDocument"]["uri"] != null &&
                    CodeStreamDiffUri.IsTempFile(methodParam["textDocument"]["uri"].Value <string>()))
                {
                    return(Task.CompletedTask);
                }
#if DEBUG
                Log.Verbose(methodName + " " + methodParam.ToString());
#endif
            }
            catch (Exception ex) {
                Log.Error(ex, nameof(HandleNotificationAsync));
            }

            return(sendNotification(methodParam));
        }
Exemplo n.º 2
0
 public void TryParseFileNameTest(string filePathPart, string fileName, bool expected)
 {
     Assert.AreEqual(expected, CodeStreamDiffUri.TryParse(filePathPart, out CodeStreamDiffUri result));
     Assert.AreEqual(fileName, result.FileName);
 }
Exemplo n.º 3
0
 public void IsTempFileTest(string filePathPart, bool expected)
 {
     Assert.AreEqual(expected, CodeStreamDiffUri.IsTempFile(filePathPart));
 }