Skip to content

Commit 4f6507e

Browse files
authored
Improve insert text handling in PdeAdapter
Refactor insert text logic to handle commas and LSP tabstop identifiers.
1 parent 6bfbf86 commit 4f6507e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

java/src/processing/mode/java/lsp/PdeAdapter.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,15 @@ CompletionItem convertCompletionCandidate(CompletionCandidate c) {
318318
for (char ch : chs) {
319319
if (ch == ',') {
320320
n += 1;
321-
//insert += ",$" + n;
322-
newInsert.append(",$").append(n);
321+
/*
322+
Append the comma and the LSP tabstop identifier,
323+
then skip appending the duplicate 'ch' character
324+
*/
325+
newInsert.append(", $").append(n);
326+
} else {
327+
//Only append the original character if it wasn't a comma
328+
newInsert.append(ch);
323329
}
324-
//insert += ch;
325-
newInsert.append(ch);
326330
}
327331
insert = newInsert.toString();
328332
}

0 commit comments

Comments
 (0)