Skip to content

Commit

Permalink
Fix \todo could not be ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
me-johnomar authored and valentjn committed Jun 23, 2020
1 parent cacdcc0 commit 9b5c75f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public List<CodeFragment> fragmentize(String code) {
List<Pair<Integer, Integer>> arguments = null;

for (LatexCommandSignature extraCommandSignature : extraCommandSignatures) {
if (commentFragment.getSettings().getIgnoreCommandPrototypes().contains(
extraCommandSignature.getCommandPrototype())) {
continue;
}

arguments = extraCommandSignature.matchArgumentsFromPosition(code, fromPos);
if (arguments != null) break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.bsplines.ltexls.parsing.latex;

import java.util.Arrays;
import java.util.List;
import org.bsplines.ltexls.Settings;
import org.bsplines.ltexls.parsing.CodeFragment;
Expand Down Expand Up @@ -48,6 +49,17 @@ private static void testCodeLanguage(String codeLanguageId) {
@Test
public void testLatex() {
testCodeLanguage("latex");

{
Settings settings = new Settings();
settings.setIgnoreCommandPrototypes(Arrays.asList(new String[]{"\\todo{}"}));
CodeFragmentizer fragmentizer = CodeFragmentizer.create("latex", settings);
List<CodeFragment> codeFragments = fragmentizer.fragmentize(
"Sentence\\footnote[abc]{Footnote} 1\n"
+ "\t\t %\t ltex: language=de-DE\nSentence 2\\todo{Todo note}\n"
+ "%ltex:\tlanguage=en-US\n\nSentence 3\n");
Assertions.assertEquals(4, codeFragments.size());
}
}

@Test
Expand Down

0 comments on commit 9b5c75f

Please sign in to comment.