Open bclothier opened 5 years ago
Thinking this should be fixed by block completion rather than self-closing pairs - SCP doesn't handle the Enter key. Block completion OTOH will have to handle Enter, and deal with Sub
and Function
and Property
blocks.
Adding another issue here since this likely needs another unit test to handle this.
In vanilla VBE, if we type:
Public Sub Init()|
and type arrow-up, we get:
Public Sub Init()
|
End Sub
With feature auto-completion enabled, the behavior changes, and we end up with this:
|
Public Sub Init()
Missing the End Sub
altogether. Curiously, this does not manifest if we do any further typing (e.g. editing the name). For example:
Public Function Init() As Boolean|
Typing arrow-up yields the same behavior as the vanilla VBE.
Mind, I'm not suggesting that we want the vanilla behavior; at minimum I'd expect the End {procedure}
to be inserted, even if I had went up.
@bclothier on one hand I'm thinking this needs to be handled by block completion.. On the other it's something that's really a consequence of SCP handling the parens completion here - the line being validated/prettified through SCP is preventing the vanilla-VBE block completion.
Feels like special-casing parameterless procedure blocks in SCP would be an overreach of SCP, and yet while putting that concern with block completion would make sense, it would also leave vanilla completion broken when SCP is enabled without block completion being activated...
...so I'm not sure what the best course of action would be here. Treating it as a SCP edge-case bug and having SCP restore the vanilla block completion seems more and more like the best solution, however tricky that might be to address (block completion will be hijacking this case either way, but SCP can't assume block completion is enabled).
Splitting into its own issue -- apparently if VBE gets to insert the ()s before we can complete the line, it can mess up the AC.
typing Enter yields:
_Originally posted by @bclothier in https://github.com/rubberduck-vba/Rubberduck/issue_comments#issuecomment-450202389_