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
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Improve line formatter behavior with unmatched close brackets, log warning (#393)
Fixes#388.
Instead of throwing a generic exception, keep track of the unmatched token for later use, and just ignore it. When the line formatting is done, DocumentOnTypeFormatting can check to see if an unmatched token occurred before or in the line being formatted and report to the user a warning about the bad behavior.
I also fixed the comment strings that claimed that the line formatter worked with one-indexed lines, which is no longer true after Alex's changes to this code.
/// next line to the first non-ignored token so that the formatter
74
73
/// can look ahead.
75
74
/// </summary>
76
-
/// <param name="line">One-indexed line number.</param>
75
+
/// <param name="line">Zero-indexed line number.</param>
77
76
/// <param name="includeToken">A function which returns true if the token should be added to the final list. If null, all tokens will be added.</param>
78
77
/// <returns>A non-null list of tokens on that line.</returns>
/// Returns a human-readable message describing the first unmatched
97
+
/// bracket found by the tokenizer at the time this function is called.
98
+
/// </summary>
99
+
/// <param name="line">Zero-indexed line number.</param>
100
+
/// <returns>A string representation of the unmatched token and its zero-indexed line number, or null if none exists or hasn't been scanned yet.</returns>
0 commit comments