Skip to content

Commit

Permalink
Make LatexCommandSignature check for end of string
Browse files Browse the repository at this point in the history
  • Loading branch information
me-johnomar authored and valentjn committed Jul 4, 2021
1 parent 7d9922c commit bba1a70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

## 12.2.1 (upcoming)

- Fix error when checking L<sup>A</sup>T<sub>E</sub>X documents ending with specific commands (fixes [vscode-ltex#341](https://github.com/valentjn/vscode-ltex/issues/341))
- Fix name of Portuguese babel language names, add support for Brazilian Portuguese babel language names (fixes [#72](https://github.com/valentjn/ltex-ls/issues/72))

## 12.2.0 (June 5, 2021)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ public LatexCommandSignature(String commandPrototype, Action action,
}

private static String matchPatternFromPosition(String code, int fromPos, Pattern pattern) {
if (fromPos >= code.length()) return "";
Matcher matcher = pattern.matcher(code.substring(fromPos));
return (matcher.find() ? matcher.group() : "");
}

public static String matchArgumentFromPosition(
String code, int fromPos, ArgumentType argumentType) {
if (fromPos >= code.length()) return "";
int pos = fromPos;
char openChar = '\0';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public void testTextMode() {
"This is a test: Dummy0, Dummy1, Dummy2. "
+ "Dummies shows that this should be plural. "
+ "Dummies proves another error. ");
assertPlainText(
"\\cites{test}",
"Dummies");
assertPlainText(
"This is a test, \\egc an actual test \\eg{} test.\n"
+ "This is a test, \\iec an actual test \\ie{} test.\n",
Expand Down

0 comments on commit bba1a70

Please sign in to comment.