You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 2.5.9.6316
OS: Microsoft Windows NT 10.0.22631.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.17531.20152
Host Executable: EXCEL.EXE
Description
Problem when using indenter at any level (Proj, Mod, or Proc) on a statement with multiple continuation lines (terminated with space-underscore " _").
In SOME, BUT NOT ALL circumstances, a continuation line will be indented MUCH farther to the right than the preceding continuation line.
When this strangeness occurs for a statement with multiple continuation lines, each subsequent continuation line steps farther and farther to the right and eventually falls off the right side of the window. Scrolling right shows they are still there. Just out of the window.
Somewhat strangely, in at least one example, the last two continuation lines reverted left to the indent level of the first continuation line. (see attached Clip).
Indenter Settings
Indent alignment options:
I have "Align Continuations" checked.
Does not seem to matter if I check or un-check "Ignore Operators".
To Reproduce
Create a REALLY LONG text string in something like an EXCEL MsgBox statement or assign this long text thing to a string variable.
Then use suitably placed double quotes ("), ampersands (&), and the space-underscore line continuation indicator ( _) to break it into pieces sized to keep all of the pieces within the window,
Use any method of convenience to invoke the indenter: Hot Key combination, or use the command bar RubberDuck dropdown.
Use any choice of indenter scope: Project, Module, or Procedure.
Inspect Code
See error
Expected behavior
I would prefer to have indenter pick an indent distance for the FIRST continuation line of a statement based on the rules selected by the currently specified Indent Options.
I would like subsequent continuation lines for the statement to generally align at that same indent distance.
Screenshots
Logfile
I will generate a trace log if you think it would be useful.
The text was updated successfully, but these errors were encountered:
Looks like the indenter gets confused on line continuations of strings on lines with double qutes and komma.
I created some tests cases
SubTests()MsgBox"Fails,"_&"With ""Qutes"", and Comma"_&vbCrLfMsgBox"Fails,"_&"With """"many Qutes"", "", and Comma"&_vbCrLfMsgBox"Fails,"_&"With ""Qutes"" and, late Comma"_&vbCrLf' Some working casesMsgBox"Works,"_&"With """"many Qutes"""", and Comma"_&vbCrLfMsgBox"Works,"_&"With ""Qutes"" and no Comma"_&vbCrLfMsgBox"Works,"_&"Without Quotes, and Komma"_&vbCrLfMsgBox"Works,"_&"Without Komma, and ""Quotes"""_&vbCrLfMsgBox"","",_"Works"_&vbCrLfEndSub
Thanks for the additional information and test cases! The 2.x indenter is essentially a (refactored to death / beyond recognition) port of the original Smart Indenter VB6 source code, which basically treats code as strings... which makes it limited in such edge cases. Makes me wonder how/whether the original indenter even deals with these (we've already patched quite a few holes from the original code)...
Anyway the 3.x indenter is slated to become a "format code" command that is going to work off hierarchical symbol trees, which don't get confused with line continuations and escaped quotes; solving it in 2.x is probably not impossible, but working with strings makes it much harder than it should be.
Rubberduck version information
Version 2.5.9.6316
OS: Microsoft Windows NT 10.0.22631.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.17531.20152
Host Executable: EXCEL.EXE
Description
Problem when using indenter at any level (Proj, Mod, or Proc) on a statement with multiple continuation lines (terminated with space-underscore " _").
In SOME, BUT NOT ALL circumstances, a continuation line will be indented MUCH farther to the right than the preceding continuation line.
When this strangeness occurs for a statement with multiple continuation lines, each subsequent continuation line steps farther and farther to the right and eventually falls off the right side of the window. Scrolling right shows they are still there. Just out of the window.
Somewhat strangely, in at least one example, the last two continuation lines reverted left to the indent level of the first continuation line. (see attached Clip).
Indenter Settings
Indent alignment options:
I have "Align Continuations" checked.
Does not seem to matter if I check or un-check "Ignore Operators".
To Reproduce
Expected behavior
I would prefer to have indenter pick an indent distance for the FIRST continuation line of a statement based on the rules selected by the currently specified Indent Options.
I would like subsequent continuation lines for the statement to generally align at that same indent distance.
Screenshots
Logfile
I will generate a trace log if you think it would be useful.
The text was updated successfully, but these errors were encountered: