Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proto migrations, ide name fix #116

Merged
merged 11 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CodeiumVS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B37F2AE5-CDEC-45B3-944D-8EF912810A12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B37F2AE5-CDEC-45B3-944D-8EF912810A12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B37F2AE5-CDEC-45B3-944D-8EF912810A12}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{B37F2AE5-CDEC-45B3-944D-8EF912810A12}.Debug|Any CPU.Build.0 = Release|Any CPU
{B37F2AE5-CDEC-45B3-944D-8EF912810A12}.Debug|arm64.ActiveCfg = Debug|arm64
{B37F2AE5-CDEC-45B3-944D-8EF912810A12}.Debug|arm64.Build.0 = Debug|arm64
{B37F2AE5-CDEC-45B3-944D-8EF912810A12}.Debug|x86.ActiveCfg = Debug|x86
Expand Down
4 changes: 3 additions & 1 deletion CodeiumVS/LanguageServer/LanguageServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public async Task InitializeAsync()
await PrepareAsync();

_metadata.request_id = 0;
_metadata.ide_name = "visual_studio";
// TODO: Change name
_metadata.ide_name = "vscode";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a TODO to change back

_metadata.ide_version = ideVersion;
_metadata.extension_name = Vsix.Name;
_metadata.extension_version = _languageServerVersion;
Expand Down Expand Up @@ -781,6 +782,7 @@ public async Task<IList<CompletionItem>?>
cursor_offset = (ulong)cursorPosition,
line_ending = lineEnding,
absolute_path = absolutePath,
absolute_path_migrate_me_to_uri = absolutePath,
relative_path = Path.GetFileName(absolutePath) },
editor_options = new() {
tab_size = (ulong)tabSize,
Expand Down
12 changes: 10 additions & 2 deletions CodeiumVS/LanguageServer/LanguageServerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ void OnMessage(object sender, MessageEventArgs msg)

if (request.ShouldSerializeopen_file_pointer())
{

var data = request.open_file_pointer;
OpenSelection(
data.file_path, data.start_line, data.start_col, data.end_line, data.end_col);
data.file_path_migrate_me_to_uri.IsNullOrEmpty() ? data.file_path : data.file_path_migrate_me_to_uri, data.start_line, data.start_col, data.end_line, data.end_col);
}
else if (request.ShouldSerializeinsert_at_cursor())
{
Expand All @@ -64,7 +65,7 @@ void OnMessage(object sender, MessageEventArgs msg)
}
}

ApplyDiff(data.file_path, data.diff.start_line, data.diff.end_line, replacement);
ApplyDiff(data.file_path_migrate_me_to_uri.IsNullOrEmpty() ? data.file_path : data.file_path_migrate_me_to_uri, data.diff.start_line, data.diff.end_line, replacement);
}
}

Expand Down Expand Up @@ -185,6 +186,7 @@ public async Task ExplainCodeBlockAsync(string filePath, Language language,
new() { explain_code_block = new() {
code_block_info = codeBlockInfo,
file_path = filePath,
file_path_migrate_me_to_uri = filePath,
language = language,
} };

Expand All @@ -200,6 +202,7 @@ public async Task ExplainFunctionAsync(string filePath, FunctionInfo functionInf
new() { explain_function = new() {
function_info = functionInfo,
file_path = filePath,
file_path_migrate_me_to_uri = filePath,
language = functionInfo.Language,
} };

Expand All @@ -216,6 +219,7 @@ public async Task GenerateFunctionUnitTestAsync(string instructions, string file
new() { function_unit_tests = new() {
function_info = functionInfo,
file_path = filePath,
file_path_migrate_me_to_uri = filePath,
language = functionInfo.Language,
instructions = instructions,
} };
Expand All @@ -232,6 +236,7 @@ public async Task GenerateFunctionDocstringAsync(string filePath, FunctionInfo f
new() { function_docstring = new() {
function_info = functionInfo,
file_path = filePath,
file_path_migrate_me_to_uri = filePath,
language = functionInfo.Language,
} };

Expand All @@ -247,6 +252,7 @@ public async Task RefactorCodeBlockAsync(string prompt, string filePath, Languag
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 @@ -262,6 +268,7 @@ public async Task RefactorFunctionAsync(string prompt, string filePath,
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 } };

Expand Down Expand Up @@ -299,6 +306,7 @@ public async Task ExplainProblemAsync(string problemMessage, SnapshotSpan span)
surroundingLineStart.Start, surroundingLineEnd.End - surroundingLineStart.Start),
language = Languages.Mapper.GetLanguage(span.Snapshot.TextBuffer.ContentType).Type,
file_path = span.Snapshot.TextBuffer.GetFileName(),
file_path_migrate_me_to_uri = span.Snapshot.TextBuffer.GetFileName(),
line_number = problemLineStart.LineNumber + 1,
} };

Expand Down
Loading
Loading