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

javascript select Identifier id tag html # #7961

Open
Sampaioa07 opened this issue Nov 13, 2024 · 6 comments
Open

javascript select Identifier id tag html # #7961

Sampaioa07 opened this issue Nov 13, 2024 · 6 comments
Labels
Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! kind:bug Bug report or fix needs:triage Requires attention from one of the committers

Comments

@Sampaioa07
Copy link

Apache NetBeans version

Apache NetBeans 23

What happened

file_js file_php

Hello, there is a flaw from version 21 to 23 that in version 20, when selecting an identifier id # in the javascript file, it selects all text (name and #)
But if it is javascript in a php file, it only selects the text, not the #.
How can I fix

Language / Project Type / NetBeans Component

No response

How to reproduce

Hello, there is a flaw from version 21 to 23 that in version 20, when selecting an identifier id # in the javascript file, it selects all text (name and #)
But if it is javascript in a php file, it only selects the text, not the #.
How can I fix

Did this work correctly in an earlier version?

No / Don't know

Operating System

windows

JDK

jdk-22

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

Yes

@Sampaioa07 Sampaioa07 added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Nov 13, 2024
@matthiasblaesing
Copy link
Contributor

Do you mean, that you double clicked on the identifier and the automatic selection was different? Because manually selecting the right range will obviously work.

@Sampaioa07
Copy link
Author

In js files it is not working double clicking on "#identifier" is always selecting the text and the # plus if it is ". identifier" only selects the text for other special characters netbens in js files only selects the text plus if it is the # select the text and #.

@Chris2011
Copy link
Contributor

I guess the thing here it is an intended feature. It sounds weird but it make totally sense and yes it should be consistent.

When you have a string like "ed-sheeran" and you set the cursor at the end of sheeran and hit ctrl + left_arrow (Windows) you navigate to the beginning of sheeran, becuase a dash is a delimiter like a space and you can navigate to it. Unfortunately a hastag is not supported in JS, also not an underscore. So when you have #sheeran and you hit ctrl + left_arrow you move the cursor to sheeran, not in front of the hashtag.

This is not a bug, but this is an inconsistency behaviour of different editor supports in NetBeans. Maybe this needs an option for this.

@Sampaioa07
Copy link
Author

Yes, it's not an error, but I think it's an inconsistency or failure. Because from version 20 below in js files, if you double click on a text with # it will only select the text. From version 21 to 23 I stop doing this.
Only happens in js files. If the javascrip script is in a php file, double clicking on #aaaa will only select the text aaaa.
It only happens with the # of o . or other special character double clicking selects only the text not the special character.

And as incredible as it may seem, I always prefer to work on version 20...

@matthiasblaesing
Copy link
Contributor

This is most probably a result of #6741. That PR adds '#' to the valid characters in identifiers in JS to support private properties #prop. There might be an issue hidden here, as this setting should also take hold in other environments.

@matthiasblaesing
Copy link
Contributor

The problem is indeed, that the primary language is used for determining which "rules" to use for finding word boundaries. It is possible to fix this, but my gut feeling is, that it will be hard to find the right location and ensure, there are no bad side effects. Start point for the search is BeginWordAction in BaseKit. The double click is a compound, formed by the "Go to beginning of word" and "Extend selection to end of word" actions. The former needs to be fixed.

@Chris2011 Chris2011 added the Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! kind:bug Bug report or fix needs:triage Requires attention from one of the committers
Projects
None yet
Development

No branches or pull requests

3 participants