clutcher / bh

Issue tracker for Better Highlights Intellij IDEA plugin
7 stars 0 forks source link

PyCharm & python code regions: `# Region` does not work #56

Open schittli opened 1 year ago

schittli commented 1 year ago

Good afternoon

I have found another, probably small issue in PyCharm for Python source files:

If a Region is declared with upper case char (# Region Init-Section â€Ļ # Endregion Init-Section), then: ✔ī¸ Better Highlights recognizes the region ❌ PyCharm does not recognize the region and, therefore, does not allow to fold it đŸ˜ĸ

If a Region is declared with lower case char (# region Init-Section â€Ļ # endregion Init-Section), then: ī¸âŒ Better Highlights does not recognize the region ✔ī¸ PyCharm perfectly recognize the region and allows to fold it 😃

I propose that: a) Users can configure if Better Highlights recognizes Region declarations case sensitive / insensitive b) That Better Highlights always recognizes Region declarations case insensitive b) or: that Users can define regular expressions to recognize start and end of regions

Thanks a lot, kind regards, Thomas

clutcher commented 1 year ago

@schittli So if you will add in Better Highlights region tokens in lowercase, then you can achieve desired functionality?

As for proposals:

schittli commented 1 year ago

Hello @clutcher

So if you will add in Better Highlights region tokens in lowercase, then you can achieve desired functionality?

Yes, if I use source code region tokens in lowercase, then PyCharm recognizes the regions and allows to fold them (but Better Highlights does not highlight the regions)

If I use source code region tokens in uppercase, then PyCharm does not recognizes the regions (but Better Highlights highlights them)

I had not seen that we can define the Better Highlights tokens in the settings. Therefore, this bug report was created with this configuration:

image

So I just tested it now and changed the tokens to region and end but Better Highlights was still not able to detect the regions in the Python source code (this might not work because I work in freemium mode, I've got a warning)

ℹī¸ If you want to solve the case-sensitive problem in general, ...

then custom regex would really help, because users work with different file types (html, css, python, etc.) and with a custom Regex they cold configure an expression which works with all their file types 😃

Thanks a lot, kind regards, Thomas

clutcher commented 1 year ago

@schittli Region works same in free and paid version. I'll take a look why it doesn't work with lower case region and end keyword.

clutcher commented 1 year ago

@schittli Just checked and do not see any issues:

Screenshot_20230728_110859

Screenshot_20230728_110745

Screenshot_20230728_110803

clutcher commented 1 year ago

@schittli Can you recheck and confirm if you can use that approach untill I'll put more robust settings?