Skip to content

Commit

Permalink
add env filter for auto completer
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Dec 20, 2024
1 parent d0a3688 commit 970e88d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/latexeditorview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ bool DefaultInputBinding::keyPressEvent(QKeyEvent *event, QEditor *editor)
else {
EnumsTokenType::TokenType ctx = Parsing::getCompleterContext(editor->cursor().line().handle(), editor->cursor().columnNumber());
if(ctx==EnumsTokenType::def) return true;
// check for environment
const LatexDocument *doc = qobject_cast<LatexDocument *>(editor->document());
StackEnvironment env;
doc->getEnv(editor->cursor().lineNumber(),env);
if(!env.isEmpty() && env.top().name=="%expl3"){
LatexEditorView::completer->setFilter("%expl3");
}

LatexCompleter::CompletionFlags flags= ctx==EnumsTokenType::width ? LatexCompleter::CF_FORCE_LENGTH : LatexCompleter::CompletionFlag(0) ;
LatexEditorView::completer->complete(editor, flags);
}
Expand Down

0 comments on commit 970e88d

Please sign in to comment.