bobbylight / RSyntaxTextArea

A syntax highlighting, code folding text editor for Java Swing applications.
BSD 3-Clause "New" or "Revised" License
1.12k stars 259 forks source link

Automatically insert closing quote for string literals in languages that support it #473

Closed bobbylight closed 1 year ago

bobbylight commented 1 year ago

Describe the solution you'd like When typing aa string literal, RSTA should automatically insert the closing quote. Further, when typing the closing quote, it should be overwritten rather than a duplicate quote inserted. This is a nice quality-of-life feature in many code editors today that helps prevent accidentally creating malformed string literals.

Are there any workarounds? None other than implementing it yourself via Actions and InputMap.

Additional context The only tricky part is deciding whether the current langugae supports quoted strings at the current caret position. In some instances, such as plain text files, we should not insert a closing quote.