rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

AutoCorrect for Power Operator (64 Bit VBA) #4369

Closed Stevefb closed 5 years ago

Stevefb commented 6 years ago

Stumbled across this anomaly in 64 bit VBA: https://stackoverflow.com/a/52360094/3451115

Basically auto-correct for 2^2 becomes 2^; 2 instead of 2 ^ 2 this is a VBA IDE issue (not RD) and is specific to 64 bit.

retailcoder commented 5 years ago

That's the type-hint character for a LongLong literal.

In order to "fix" this (could be part of the "autocorrect" future AC feature), we would have to assume that our users never want to use a type hint, or are willing to explicitly backspace/delete the extra whitespace Rubberduck would be adding before the operator.

Thoughts?

Vogel612 commented 5 years ago

As per chat: While this is something that Rubberduck could fix, it's not clear that the behaviour outlined here is always the desired behaviour. In the end this boils down to the following:

Rubberduck shouldn't be guessing what the user wants, it should know. The currently proposed feature referst to an ambiguity in expressed intention, that can be resolved in two different ways. As such I think this is well-intentioned, but not something that Rubberduck should interfere with

bclothier commented 5 years ago

As a reference, we observe a similar (but not identical) anomaly with syntax like 2&2, which results in a compiler error; it always has been necessary to explicitly type spaces around the & character even though that is not true of say, + character. For that reason, I think users are best served if they are trained to remember to space the ^ just as they do the & as opposed to fighting with the unwanted mutations where they really meant to use it as a typehint or as a power operator.