Skip to content

Commit

Permalink
Fix for insertion adding space before comma even if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikDoom committed Jul 8, 2023
1 parent 8523d7e commit 737b697
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions javascript/tagAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,11 @@ async function insertTextAtCursor(textArea, result, tagword, tabCompletedWithout
let noCommaTypes = [ResultType.wildcardFile, ResultType.yamlWildcard].concat(extraNetworkTypes);
if (!noCommaTypes.includes(tagType)) {
// Append comma if enabled and not already present
let beforeComma = surrounding.match(new RegExp(`${escapeRegExp(tagword)}[,:]`, "i")) !== null;
if (TAC_CFG.appendComma)
optionalSeparator = surrounding.match(new RegExp(`${escapeRegExp(tagword)}[,:]`, "i")) !== null ? "" : ",";
optionalSeparator = beforeComma ? "" : ",";
// Add space if enabled
if (TAC_CFG.appendSpace)
if (TAC_CFG.appendSpace && !beforeComma)
optionalSeparator += " ";
// If at end of prompt and enabled, override the normal setting if not already added
if (!TAC_CFG.appendSpace && TAC_CFG.alwaysSpaceAtEnd)
Expand Down

0 comments on commit 737b697

Please sign in to comment.