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

OnEnterRules broken for indentOutdent? #718

Closed
ahmedneilhussain opened this issue Feb 21, 2024 · 1 comment
Closed

OnEnterRules broken for indentOutdent? #718

ahmedneilhussain opened this issue Feb 21, 2024 · 1 comment

Comments

@ahmedneilhussain
Copy link

ahmedneilhussain commented Feb 21, 2024

Hi @sebthom I think 2e1769f might have broken the indentOutdent behaviour for on enter.

I've just been reevaluating tm4e (my company uses lsp4e for our language, but we have been using our own customisations to the generic editor for syntax highlighting and auto-edit, and we'd like to jettison this handwritten code if possible!). I tried the very latest version with our code and found the auto-indentation behaviour was a bit unexpected, which I initially thought was down to my misconfiguring it, then I dug a bit further using wild web developer's typescript support as a test case.

With typescript and a slightly older tm4e, given a snippet

  if (true) {}

and the cursor between the two braces, I get

  if (true) {
    <-- cursor here
  }

as I'd like. With the latest tm4e I get

  if (true) {
    <-- correctly indented to here
  } <-- but cursor just to left of the parenthesis

I think when you rewrote the switch at https://github.com/eclipse/tm4e/blob/093cd523f301609f916c34bc9392a771eec29412/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/LanguageConfigurationAutoEditStrategy.java#L224 to use java-17 style yield you might have inadvertently changed the logic for determining the new caret position. It now assumes the caret should go after the inserted text in all cases, but that's not how it was before for indentOutdent as you can see here: https://github.com/eclipse/tm4e/blob/222653b2210649c4752f72967d57c72bbc964178/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/LanguageConfigurationAutoEditStrategy.java#L213

It'd be the gentlemanly thing to just submit a patch, but I've only been asked to spend a day or so reinvestigating the plugin so I haven't really had much of a look at the code let alone the testing/coding standards - apologies...!

Cheers,
Ahmed

@sebthom
Copy link
Member

sebthom commented Feb 21, 2024

Fixed in 0.10.2. Thanks for reporting!

@sebthom sebthom closed this as completed Feb 21, 2024
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

No branches or pull requests

2 participants