Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzlu committed Sep 19, 2024
1 parent db2a5d8 commit 1f323af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 125 deletions.
7 changes: 0 additions & 7 deletions CodeiumVS/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ protected override void BeforeQueryStatus(EventArgs e)

protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await CodeiumVSPackage.Instance.LogAsync("IN WINDOW DILAOG");
// get the caret screen position and create the dialog at that position
TextBounds caretLine = docView.TextView.TextViewLines.GetCharacterBounds(
docView.TextView.Caret.Position.BufferPosition);
Expand All @@ -319,7 +318,6 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
// highlight the selected codeblock
TextHighlighter? highlighter = TextHighlighter.GetInstance(docView.TextView);
highlighter?.AddHighlight(start_position, end_position - start_position);
await CodeiumVSPackage.Instance.LogAsync("IN WINDOW DILAOG1");
var dialog = RefactorCodeDialogWindow.GetOrCreate();
string? prompt =
await dialog.ShowAndGetPromptAsync(languageInfo, caretScreenPos.X, caretScreenPos.Y);
Expand All @@ -331,24 +329,19 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)

LanguageServerController controller =
(Package as CodeiumVSPackage).LanguageServer.Controller;
CodeiumVSPackage.Instance.Log("CALLING refactor");
if (is_function)
{
CodeiumVSPackage.Instance.Log("CALLING FUNC");
FunctionInfo? functionInfo = await GetFunctionInfoAsync();

if (functionInfo != null)
{
CodeiumVSPackage.Instance.Log("CALLING FUNC");
await controller.RefactorFunctionAsync(
prompt, docView.Document.FilePath, functionInfo);
}
}
else
{
CodeiumVSPackage.Instance.Log("CALLING NOIN FUNC");
CodeBlockInfo codeBlockInfo = GetCodeBlockInfo();
CodeiumVSPackage.Instance.Log("CALLING NOIN FUNC2");
await controller.RefactorCodeBlockAsync(
prompt, docView.Document.FilePath, languageInfo.Type, codeBlockInfo);
}
Expand Down
6 changes: 0 additions & 6 deletions CodeiumVS/LanguageServer/LanguageServerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,10 @@ await Package.ShowToolWindowAsync(
public async Task RefactorCodeBlockAsync(string prompt, string filePath, Language language,
CodeBlockInfo codeBlockInfo)
{
CodeiumVSPackage.Instance.Log("Calling refactor code block.");
var request = WebChatServer.NewRequest();
request.get_chat_message_request.chat_messages[0].intent =
new() { code_block_refactor = new() { code_block_info = codeBlockInfo,
file_path = filePath,
//file_path_migrate_me_to_uri = filePath,
language = language,
refactor_description = prompt } };

Expand All @@ -263,19 +261,15 @@ await Package.ShowToolWindowAsync(
public async Task RefactorFunctionAsync(string prompt, string filePath,
FunctionInfo functionInfo)
{
CodeiumVSPackage.Instance.Log("Calling refactor function.");
var request = WebChatServer.NewRequest();
request.get_chat_message_request.chat_messages[0].intent =
new() { function_refactor = new() { function_info = functionInfo,
file_path = filePath,
//file_path_migrate_me_to_uri = filePath,
language = functionInfo.Language,
refactor_description = prompt } };
CodeiumVSPackage.Instance.Log("Calling refactor function1.");
if (request.Send(ws))
await Package.ShowToolWindowAsync(
typeof(ChatToolWindow), 0, create: true, Package.DisposalToken);
CodeiumVSPackage.Instance.Log("Calling refactor function2.");
}

public async Task ExplainProblemAsync(string problemMessage, SnapshotSpan span)
Expand Down
116 changes: 4 additions & 112 deletions CodeiumVS/LanguageServer/Packets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,10 @@ public partial class Document : global::ProtoBuf.IExtensible
[global::System.ComponentModel.DefaultValue("")]
public string absolute_path { get; set; } = "";

//[global::ProtoBuf.ProtoMember(1)]
//[global::System.ComponentModel.DefaultValue("")]
//public string absolute_path_migrate_me_to_uri { get; set; } = "";

[global::ProtoBuf.ProtoMember(12)]
[global::System.ComponentModel.DefaultValue("")]
public string absolute_uri { get; set; } = "";

//[global::ProtoBuf.ProtoMember(2)]
//[global::System.ComponentModel.DefaultValue("")]
//public string relative_path_migrate_me_to_workspace_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(2)]
[global::System.ComponentModel.DefaultValue("")]
public string relative_path
Expand Down Expand Up @@ -426,10 +415,6 @@ public partial class CodeContextItem : global::ProtoBuf.IExtensible
[global::System.ComponentModel.DefaultValue("")]
public string absolute_path { get; set; } = "";

//[global::ProtoBuf.ProtoMember(1)]
//[global::System.ComponentModel.DefaultValue("")]
//public string absolute_path_migrate_me_to_uri { get; set; } = "";

[global::ProtoBuf.ProtoMember(16)]
[global::System.ComponentModel.DefaultValue("")]
public string absolute_uri { get; set; } = "";
Expand Down Expand Up @@ -510,10 +495,6 @@ public partial class WorkspacePath : global::ProtoBuf.IExtensible
[global::System.ComponentModel.DefaultValue("")]
public string workspace { get; set; } = "";

//[global::ProtoBuf.ProtoMember(1)]
//[global::System.ComponentModel.DefaultValue("")]
//public string workspace_migrate_me_to_uri { get; set; } = "";

[global::ProtoBuf.ProtoMember(3)]
[global::System.ComponentModel.DefaultValue("")]
public string workspace_uri { get; set; } = "";
Expand Down Expand Up @@ -1351,12 +1332,6 @@ public Document active_document {
get;
} = new global::System.Collections.Generic.List<string>();

//[global::ProtoBuf.ProtoMember(6)]
//public global::System.Collections.Generic.List<string> open_document_paths_migrate_me_to_uris
//{
// get;
//} = new global::System.Collections.Generic.List<string>();

[global::ProtoBuf.ProtoMember(12)]
public global::System.Collections.Generic.List<string> open_document_uris {
get;
Expand All @@ -1368,12 +1343,6 @@ public Document active_document {
get;
} = new global::System.Collections.Generic.List<string>();

//[global::ProtoBuf.ProtoMember(7)]
//public global::System.Collections.Generic.List<string> workspace_paths_migrate_me_to_uris
//{
// get;
//} = new global::System.Collections.Generic.List<string>();

[global::ProtoBuf.ProtoMember(13)]
public global::System.Collections.Generic.List<string> workspace_uris {
get;
Expand Down Expand Up @@ -1602,13 +1571,6 @@ public Language language {
get; set;
}

//[global::ProtoBuf.ProtoMember(3)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(3)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path
Expand Down Expand Up @@ -1698,13 +1660,6 @@ public string file_path
get; set;
} = "";

//[global::ProtoBuf.ProtoMember(3)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(4)]
[global::System.ComponentModel.DefaultValue("")]
public string uri {
Expand Down Expand Up @@ -1771,13 +1726,6 @@ public Language language {
get; set;
}

//[global::ProtoBuf.ProtoMember(3)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(3)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path
Expand Down Expand Up @@ -1841,13 +1789,6 @@ public Language language {
get; set;
}

//[global::ProtoBuf.ProtoMember(3)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(3)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path
Expand Down Expand Up @@ -1884,13 +1825,6 @@ public Language language {
get; set;
}

//[global::ProtoBuf.ProtoMember(3)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(3)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path {
Expand Down Expand Up @@ -1938,13 +1872,6 @@ public Language language {
get; set;
}

//[global::ProtoBuf.ProtoMember(5)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(5)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path
Expand Down Expand Up @@ -1981,13 +1908,6 @@ public Language language {
get; set;
}

//[global::ProtoBuf.ProtoMember(3)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(3)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path
Expand Down Expand Up @@ -2023,13 +1943,6 @@ public Language language {
get; set;
}

//[global::ProtoBuf.ProtoMember(3)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(3)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path
Expand Down Expand Up @@ -2156,15 +2069,8 @@ public partial class ChatMessageActionEdit : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension
global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) =>
global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);

//[global::ProtoBuf.ProtoMember(1)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";
global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) =>
global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);

[global::ProtoBuf.ProtoMember(1)]
[global::System.ComponentModel.DefaultValue("")]
Expand Down Expand Up @@ -2365,15 +2271,8 @@ public partial class OpenFilePointer : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension
global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) =>
global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);

//[global::ProtoBuf.ProtoMember(1)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";
global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) =>
global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);

[global::ProtoBuf.ProtoMember(1)]
[global::System.ComponentModel.DefaultValue("")]
Expand Down Expand Up @@ -2447,13 +2346,6 @@ public partial class ApplyDiff : global::ProtoBuf.IExtensible
[global::System.ComponentModel.DefaultValue("")]
public string message_id { get; set; } = "";

//[global::ProtoBuf.ProtoMember(2)]
//[global::System.ComponentModel.DefaultValue("")]
//public string file_path_migrate_me_to_uri
//{
// get; set;
//} = "";

[global::ProtoBuf.ProtoMember(2)]
[global::System.ComponentModel.DefaultValue("")]
public string file_path
Expand Down

0 comments on commit 1f323af

Please sign in to comment.