Open vogella opened 1 year ago
@vogella: Sorry I didn't get it. What is a "text element" and was is the "selected work"?
Type WORD in an editor Double-click on WORD to select it Now type "(" -> WORD gets deleted in Eclipse
Do the same in code, the result is: -> (WORD)
Note that since we already have in most editors some strategy to auto-insert a closing brackets, this request is most likely just an extension of the existing strategies to tweak the handling of insertion with a non-empty selection. For the generic editor (and TM4E that already provide all the matching bracket smartness for a given language), it's mostly a matter of updating the org.eclipse.tm4e.languageconfiguration.internal.LanguageConfigurationAutoEditStrategy
, for JDT it looks like it's a matter of changing CompilationUnitEditor.verifyKey() to add the overridden content between buffer.append(character)
and buffer.append(closingCharacter)
.
FWIW, this just got implemented in TM4E (so it would serve many editors already, but not default JDT one): https://github.com/eclipse/tm4e/commit/501ede88852ec05ac9f0414c75783effa33cb1e9
If I select an text element and type an opening bracket, e.g. "(" VScode the selected work is surrounded by brackets, if I do the same in Eclipse the work is deleted.
I think the VScode behavior is much nicer and noticed this difference while testing @mickaelistria LS-JDT integration for Eclipse.
Would be also adjust the behavior in Eclipse? If yes, which editor would be good to implement this? Text editor or generic editor?