-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- implemented the agent protocols for autocompletions - inline text changes that can be accepted with the `Tab` keyboard press (`lalt+,` for rotating suggestions if there is more than one) - explicitly trigger completion suggestions (`lalt+.`) - user option to enable/disable Autocompletions - telemetry to compute CAR - tests ## Test plan - Create a new solution - Start adding code - Check if 'grey code' with suggestions appears - Accept the suggestions by pressing `Tab` - Reject the suggestion by pressing `Esc` <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> --------- Co-authored-by: Tomasz Gołębiowski <[email protected]>
- Loading branch information
1 parent
b52b944
commit 3cb8d9d
Showing
40 changed files
with
908 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
vscode-v1.54.x | ||
vscode-v1.54.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class AutocompleteItem | ||
{ | ||
public string Id { get; set; } | ||
public string InsertText { get; set; } | ||
public Range Range { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class AutocompleteParams | ||
{ | ||
public string Uri { get; set; } | ||
public string FilePath { get; set; } | ||
|
||
public Position Position { get; set; } | ||
|
||
public TriggerKind? TriggerKind { get; set; } | ||
|
||
public SelectedCompletionInfo SelectedCompletionInfo { get; set; } | ||
} | ||
|
||
public enum TriggerKind | ||
{ | ||
[EnumMember(Value = nameof(Automatic))] //overwrites default camelCase naming convention | ||
Automatic, | ||
|
||
[EnumMember(Value = nameof(Invoke))] | ||
Invoke | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class AutocompleteResult | ||
{ | ||
public AutocompleteItem[] Items { get; set; } | ||
|
||
public CompletionBookkeepingEvent CompletionEvent { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class CompletionBookkeepingEvent | ||
{ | ||
public CompletionItemInfo[] Items { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class CompletionItemInfo | ||
{ | ||
public int LineCount { get; set; } | ||
public int CharCount { get; set; } | ||
|
||
public string InsertText { get; set; } | ||
|
||
public string StopReason { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class CompletionItemParams | ||
{ | ||
public string CompletionID { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class GetDocumentsParams | ||
{ | ||
public string[] Uris { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class GetDocumentsResult | ||
{ | ||
public ProtocolTextDocument[] Documents { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Cody.Core.Agent.Protocol | ||
{ | ||
public class SelectedCompletionInfo | ||
{ | ||
public Range Range { get; set; } | ||
|
||
public string Text { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Cody.Core.Common | ||
{ | ||
public static class StringExtensions | ||
{ | ||
public static string ToUri(this string path) | ||
{ | ||
var uri = new Uri(path).AbsoluteUri; | ||
return Regex.Replace(uri, "(file:///)(\\D+)(:)", m => m.Groups[1].Value + m.Groups[2].Value.ToLower() + "%3A"); | ||
} | ||
|
||
public static string ConvertLineBreaks(this string text, string lineBrakeChars) | ||
{ | ||
return Regex.Replace(text, @"\r\n?|\n", lineBrakeChars); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.