Skip to content

Counterintuitive language management #67

@jsotuyod

Description

@jsotuyod

Language controls in the toolbar only sets the language used to parse / syntax color the editor:

image

But the XPath autocomplete / actual rule language is managed separately down here:

image

it's fixed upon creation. So if I change the language in the toolbar, the editor will immediately respond, but the XPath editor will continue working on the previous language until I manually click on the "+" to create a new rule for the current language.

This is particularly bad considering that the XPath expression will match against the current code regardless of the target language, so I can write an expression, have it work, but then upon exporting it, have it published for a separate language.

I think the most intuitive thing would be to drop the language from the xpath editor, and have it bound to always match the language set in the code editor.

To Reproduce
Steps to reproduce the behavior:

  1. Launch the designer from pmd designer
  2. Notice the current language. If Java switch to XML. If not Java, switch to Java.
  3. Notice the editor automatically matches the new language.
  4. Notice the rule tab says "java/NewRule" or "xml/NewRule", and this is a mismatch to the current editor language.
  5. Click "+" to add a new rule tab, which should now be "java/NewRule" or "xml/NewRule", this time matching the current editor language.
  6. In the "java/NewRule" editor, notice it suggests to autocomplete with Java AST nodes.
  7. Write any valid expression for the current editor language into both rules. Notice they match regardless of current language.
  8. Try and export both "working" rules for the current editor language. Notice them being exported for either "java" or "xml" accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions