Skip to content

Stop XML word selection at punctuation and camel case - #9706

Open
mvanhorn wants to merge 1 commit into
apache:masterfrom
mvanhorn:fix/9664-xml-word-selection
Open

mvanhorn wants to merge 1 commit into
apache:masterfrom
mvanhorn:fix/9664-xml-word-selection

Conversation

@mvanhorn

Copy link
Copy Markdown

LLMs, Commit messages and PR description:

xmlIdentifierAcceptor now accepts only characters for which Character.isJavaIdentifierPart is true, which keeps letters, digits, and underscore in the word and excludes punctuation. XmlCamelCaseInterceptor is registered for text/xml and, when the useCamelCaseStyleNavigation preference is on, sets the next or previous offset to an uppercase boundary inside a TAG, ARGUMENT, TEXT, VALUE, PI_TARGET, PI_CONTENT, or CDATA_SECTION token, and only while the run up to that boundary is still an identifier. A disabled preference, a non-text token such as a comment, or a rejected character before the hump leaves the offset unset so the default word scan runs. XmlCamelCaseInterceptorTest covers the acceptor and those forward, backward, punctuation, markup, and comment offsets.

In an XML buffer such as a Maven POM, Ctrl-Shift-Left and Ctrl-Shift-Right extend the selection across a whole element name or value. Movement does not stop at punctuation in values such as org.apache.maven or maven-compiler-plugin, or at camel-case boundaries in names such as artifactId. The XML identifier acceptor treated every character as part of a word except whitespace and the markup characters <, >, &, quotes, slash, and backslash, so dots and hyphens stayed inside the word. text/xml had no CamelCaseInterceptor, so a run of identifier characters was never split where a lowercase sequence meets an uppercase letter.

Fixes #9664

PR approval and merge checklist:

  1. Was this PR correctly labeled, did the right tests run? When did they run?
  2. Is this PR squashed?
  3. Are author name / email address correct? Are co-authors correctly listed? Do the commit messages need updates?
  4. Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?

If this PR targets the delivery branch: don't merge. (full wiki article)

AI was used for assistance.

xmlIdentifierAcceptor now accepts only characters for which
Character.isJavaIdentifierPart is true, which keeps letters, digits, and
underscore in the word and excludes punctuation. XmlCamelCaseInterceptor
is registered for text/xml and, when the useCamelCaseStyleNavigation
preference is on, sets the next or previous offset to an uppercase
boundary inside a TAG, ARGUMENT, TEXT, VALUE, PI_TARGET, PI_CONTENT, or
CDATA_SECTION token, and only while the run up to that boundary is still
an identifier. A disabled preference, a non-text token such as a
comment, or a rejected character before the hump leaves the offset unset
so the default word scan runs. XmlCamelCaseInterceptorTest covers the
acceptor and those forward, backward, punctuation, markup, and comment
offsets.

Fixes apache#9664

Assisted-by: AI
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.

Ctrl-Shift-Left/Right selection in POM.xml does not stop at punctuation marks or camel casing

1 participant