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

Fix code marks trimming for different ides #200

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

francescoopiccoli
Copy link
Contributor

@francescoopiccoli francescoopiccoli commented Dec 9, 2024

Problem

in our example mynah-ui we mark codeblock with ~~~~~~~~~~, different ides use ``` instead. This causes a small ui issue when navigating through prompts as the code blocks attached to previous prompts might not be trimmed correctly. More importantly, in this PR we make sure to remove the code marks ONLY if they appear at the very start of the codeAttachment, not the first occurrence. This issue could have potentially modified the user prompt if it contained an occurrence of ~~~~~~~~~~ while the code block was marked via the ``` marks. In that case navigating through prompts would have caused an input like:

void main() {
  print("~~~~~~~~~~");
  print("Hello World");
  print("Hello World");
}

to be transformed to

void main() {
  print("");
  print("Hello World");
  print("Hello World");
}

Solution

Tests

  • I have tested this change on VSCode
  • I have tested this change on JetBrains

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@francescoopiccoli francescoopiccoli marked this pull request as ready for review December 9, 2024 15:59
@francescoopiccoli francescoopiccoli requested a review from a team as a code owner December 9, 2024 15:59
@Jurredr Jurredr linked an issue Dec 9, 2024 that may be closed by this pull request
4 tasks
Jurredr
Jurredr previously approved these changes Dec 9, 2024
@Jurredr Jurredr merged commit 93aca00 into main Dec 10, 2024
2 checks passed
@Jurredr Jurredr deleted the frapicc/fix-code-trimming-ides branch December 10, 2024 09:38
Copy link
Collaborator

@dogusata dogusata left a comment

Choose a reason for hiding this comment

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

Please do not make a release with this one merged.

src/components/chat-item/chat-prompt-input.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Up/down prompt history navigation causes extra ``` in code attachments
3 participants