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

Bug: AI description generator on comments is not enabling the comment button #288

Closed
1 of 2 tasks
a0m0rajab opened this issue Nov 13, 2023 · 2 comments · Fixed by #285
Closed
1 of 2 tasks

Bug: AI description generator on comments is not enabling the comment button #288

a0m0rajab opened this issue Nov 13, 2023 · 2 comments · Fixed by #285
Labels
🐛 bug Something isn't working 👀 needs triage

Comments

@a0m0rajab
Copy link
Contributor

Describe the bug

This is related to #285 when you use the AI extension to generate description on comments it's not enabling the comment button

Steps to reproduce

  1. enable the extension in Dev
  2. go to a PR
  3. use the extension in the comments of the PR

Browsers

No response

Additional context (Is this in dev or production?)

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@a0m0rajab
Copy link
Contributor Author

To solve this issue, I decided to check the refined-GitHub extension to see if I could learn anything from them and found the next code:

const field = $0 
	// Don't indent <summary> because indentation will not be automatic on multi-line content
	const newContent = `
		<details>
		<summary>Details</summary>

        test 
        
		</details>
	`.replaceAll(/(\n|\b)\t+/g, '$1').trim();

	field.focus();
    document.execCommand('insertText', false, newContent);

	field.setSelectionRange(
		field.value.lastIndexOf('</summary>', field.selectionStart) + '</summary>'.length + 2,
		field.value.lastIndexOf('</details>', field.selectionStart) - 2,
	);
field.blur()

The process was:

@a0m0rajab
Copy link
Contributor Author

Related commit: 9567204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 👀 needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant