firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.21k stars 198 forks source link

Code generator should default to chosen language #2002

Closed cyclopticnerve closed 1 year ago

cyclopticnerve commented 1 year ago

Code Generator Language

Python

Code Snippet

// Generator code.

When opening the code generator, it always defaults to AutoIt (the first language in the list). I suggest to open the code generator to the language being used in the editor at the time the code generator is opened.

working-name commented 1 year ago

Hi @cyclopticnerve,

What is this setting in your browser?

this-setting

cyclopticnerve commented 1 year ago

It's set to automatic. If I set it to python, it works as expected. But that's not what the hint says. The hint implies it should follow what the editor settings are when set to automatic. Also note that capitalization of names in lists between these two settings are different (sorry but I'm a UI dev lol)

On Fri, Feb 17, 2023, 6:51 PM Alan @.***> wrote:

Hi @cyclopticnerve https://github.com/cyclopticnerve,

What is this setting in your browser?

[image: this-setting] https://user-images.githubusercontent.com/16505052/219817900-968a3b9e-f4a1-4b93-ad78-4dfed544a3ee.jpg

— Reply to this email directly, view it on GitHub https://github.com/firasdib/Regex101/issues/2002#issuecomment-1435402350, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDMSB25RUH4XCXAY6KBS6DWYAFHFANCNFSM6AAAAAAU77LGX4 . You are receiving this because you were mentioned.Message ID: @.***>

working-name commented 1 year ago

Interesting. I'm trying to reproduce it but so far in 3 browsers it behaves normally. There's obviously no AutoIt "flavor" so that is never actually selected in any of my tests. Switched to all flavors as well.

Can you help me out with your OS and browser? Are you logged in or not? Maybe there's a unique bug somewhere.

cyclopticnerve commented 1 year ago

Maybe I am not understanding how this is supposed to work, but I think if I select "Automatic" for the code generator setting, and I select "Python" in the left pane of the editor (NOT settings), the code generator should open with "Python" selected. If I close the code generator, then change the flavor in the left column (NOT settings) to "PHP", the code generator should open with "PHP" selected. Please let me know if I'm wrong.

If I'm right, read on:

Browser/OS: Firefox 109.0.1 on Ubuntu 22.10. I do not have an account, so not logged in. Just using the site as a regular visitor. But any settings I change are saved between visits, so cookies work :).

I have attached a screenshot of the settings page showing AutoIt as a flavor for the code generator, as well as the code generator dialog which also has AutoIt as a language choice.

The settings page shows that Python is selected as the default "flavor" for the editor, and that the code generator language is set to "Automatic". The image of the code generator shows that, while Python is selected as the current flavor (far left, dimmed as it is behind the dialog), the code generator dialog defaults to AutoIt for the displayed code. Being that it is the first item in the list of generator languages, my guess would be that the selected flavor from the editor is not being passed to the code generator dialog, and it is just defaulting to the first item in the list, which happens to be AutoIt.

Also note that setting the code generator language to anything other than "Automatic" in the settings page works fine. i.e: I can set the code generator language to Ruby in settings, and any time I open the code generator dialog, it defaults to Ruby. It is only the "Automatic" settings that does not work, leading me again to believe that the code generator dialog is not reading the currently selected language from the editor.

I can send you a video (.webm) if that would make it more clear.

P.S. This is a great site and has helped me a great deal in learning about regex, please keep up the great work and thank you for being so responsive to issues!

On Fri, Feb 17, 2023 at 7:28 PM Alan @.***> wrote:

Interesting. I'm trying to reproduce it but so far in 3 browsers it behaves normally. There's obviously no AutoIt "flavor" so that is never actually selected in any of my tests. Switched to all flavors as well.

Can you help me out with your OS and browser? Are you logged in or not? Maybe there's a unique bug somewhere.

— Reply to this email directly, view it on GitHub https://github.com/firasdib/Regex101/issues/2002#issuecomment-1435421066, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDMSB5T45QEJQP7DT2KU3LWYAJS7ANCNFSM6AAAAAAU77LGX4 . You are receiving this because you were mentioned.Message ID: @.***>

working-name commented 1 year ago

Hello again,

I'm sorry but I cannot reproduce the behavior. I've installed 22.04, and pulled 109.0.1 from their FTP. This might mean it's one of the addons interfering.

Can you try starting firefox with a blank profile to test it out?

Thanks!

firasdib commented 1 year ago

Hi, thank you for the report. I was able to reproduce it and will fix it soon.