Skip to content

Commit

Permalink
remove redundant special commands placement in completer
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Nov 4, 2023
1 parent 7c2782d commit 685f167
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/texstudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7808,7 +7808,6 @@ void Texstudio::updateCompleter(LatexEditorView *edView)
words.unite(userList);
if(mCompleterCommandsNeedsUpdate){
mCompleterWords.unite(doc->additionalCommandsList(loadedFiles));
ltxCommands.append(doc->ltxCommands);
}
}
mCompleterWords.unite(words);
Expand Down Expand Up @@ -7857,23 +7856,20 @@ void Texstudio::updateCompleter(LatexEditorView *edView)
completer->setAdditionalWords(mCompleterWords, CT_COMMANDS);
if(mCompleterCommandsNeedsUpdate){
// add keyval completion, add special lists
foreach (const QString &elem, ltxCommands.possibleCommands.keys()) {
foreach (const QString &elem, edView->document->lp->possibleCommands.keys()) {
if (elem.startsWith("key%")) {
QString name = elem.mid(4);
if (name.endsWith("#c"))
name.chop(2);
if (!name.isEmpty()) {
completer->setKeyValWords(name, ltxCommands.possibleCommands[elem]);
completer->setKeyValWords(name, edView->document->lp->possibleCommands[elem]);
}
}
if (elem == "%color" || (elem.startsWith("%") && latexParser.mapSpecialArgs.values().contains(elem))) {
completer->setKeyValWords(elem, ltxCommands.possibleCommands[elem]);
}
}
// add context completion
if (config) {
foreach (const QString &elem, config->specialCompletionKeys) {
completer->setContextWords(ltxCommands.possibleCommands[elem], elem);
completer->setContextWords(edView->document->lp->possibleCommands[elem], elem);
}
}
}
Expand Down

0 comments on commit 685f167

Please sign in to comment.