klesun / deep-assoc-completion

A phpstorm plugin for associative array key typing and completion
Other
267 stars 17 forks source link

End brace and semicolon inserted, but not quote #187

Closed chuckadams closed 3 years ago

chuckadams commented 3 years ago

In other words, I type $foo['ba<CTRL-SPACE> and get completions for 'bar' and 'baz'. I select bar, hit enter, and get $foo['bar];, without the closing quote. Sometimes it doesn't add the ]; but adds a newline instead. If I hit tab, it always adds the newline, and in fact after expanding once with tab, hitting enter expands the same way too.

If I'm already inside a pair of quotes, it behaves with enter, at least until I tab-expand once, at which point it adds a newline after the end quote for both tab and enter.

klesun commented 3 years ago

Thanks, was just about to reply to your comment in the marketplace asking to file this issue =-D I will take a look. What phpstorm version are you using?

klesun commented 3 years ago

Oh, you don't have auto-end-quotes enabled, now I get it, I never tried using the plugin without it. Will try to post a small fix soon.

klesun commented 3 years ago

Yeah, it behaves pretty nasty with "Insert pair quote" disabled ;c

chuckadams commented 3 years ago

I'm on IDEA Ultimate 2021.1.3. But as you can see, it's more about the quotes: It does misbehave the same way if I have pair quotes enabled and delete the end quote.

klesun commented 3 years ago

Released the fix in 2021.07.18.002

image

Hopefully now it behaves correctly in every possible case. It should not jump to new line anymore, should automatically close unterminated quote and always be placed after the ] if ] is present, otherwise after the closing quote. If it's an edit in the middle of the line with existing code, and it is not possible to unambiguously determine whether what AST resolves as closing quote is actually a closing quote, or rather it's an opening quote of the next string literal, caret will just stay after the completed word.