Skip to content

Commit 1b82b22

Browse files
tomaszgolebiowskiTomasz Gołębiowski
andauthored
Remove link clicks interception (#348)
After implementing `textDocument/show`, there is no need to intercept link clicks in VS. These clicks are handled in the agent. ## Test plan N/A <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> Co-authored-by: Tomasz Gołębiowski <[email protected]>
1 parent 312a92e commit 1b82b22

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed
Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using Cody.Core.Agent.Protocol;
21
using Cody.Core.Infrastructure;
2+
using Cody.Core.Logging;
33
using Newtonsoft.Json.Linq;
44
using System;
5-
using Cody.Core.Logging;
65

76
namespace Cody.Core.Agent
87
{
@@ -12,7 +11,6 @@ public class WebviewMessageHandler
1211
private readonly ILog _logger;
1312

1413
private readonly Action _onOptionsPageShowRequest;
15-
1614

1715
public WebviewMessageHandler(IDocumentService documentService, Action onOptionsPageShowRequest, ILog logger)
1816
{
@@ -31,12 +29,8 @@ public bool HandleMessage(string message)
3129
// or for messages that are intercepted but should still be forwarded to the agent.
3230
switch (json.command?.ToString())
3331
{
34-
case "auth":
35-
return HandleAuthCommand(json);
3632
case "command":
3733
return HandleCommandCommand(json);
38-
case "openFileLink":
39-
return HandleOpenFileLinkCommand(json);
4034
default:
4135
return false;
4236
}
@@ -47,14 +41,6 @@ public bool HandleMessage(string message)
4741
}
4842
}
4943

50-
private bool HandleAuthCommand(dynamic json)
51-
{
52-
// login/logout handled by the agent via accessing secret storage
53-
54-
// Always return false to allow the request to be forwarded to the agent.
55-
return false;
56-
}
57-
5844
private bool HandleCommandCommand(dynamic json)
5945
{
6046
if (json.id == "cody.status-bar.interacted")
@@ -64,25 +50,5 @@ private bool HandleCommandCommand(dynamic json)
6450
}
6551
return false;
6652
}
67-
68-
private bool HandleOpenFileLinkCommand(dynamic json)
69-
{
70-
try
71-
{
72-
var path = json.uri?.path?.ToString();
73-
var range = json.range?.ToObject<Range>();
74-
if (!string.IsNullOrEmpty(path))
75-
{
76-
_documentService.ShowDocument(path.ToWindowsPath(), range);
77-
return true;
78-
}
79-
}
80-
catch (Exception ex)
81-
{
82-
_logger.Error($"Opening file link failed:'{json.ToString()}'", ex);
83-
}
84-
85-
return false;
86-
}
8753
}
8854
}

0 commit comments

Comments
 (0)