From 4f6507ef6494de5a8af024a3182873d565d96a37 Mon Sep 17 00:00:00 2001 From: John-Bobular Date: Fri, 12 Jun 2026 10:06:06 -0400 Subject: [PATCH] Improve insert text handling in PdeAdapter Refactor insert text logic to handle commas and LSP tabstop identifiers. --- java/src/processing/mode/java/lsp/PdeAdapter.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/src/processing/mode/java/lsp/PdeAdapter.java b/java/src/processing/mode/java/lsp/PdeAdapter.java index 1cd2f6ef3..b2fabe483 100644 --- a/java/src/processing/mode/java/lsp/PdeAdapter.java +++ b/java/src/processing/mode/java/lsp/PdeAdapter.java @@ -318,11 +318,15 @@ CompletionItem convertCompletionCandidate(CompletionCandidate c) { for (char ch : chs) { if (ch == ',') { n += 1; - //insert += ",$" + n; - newInsert.append(",$").append(n); + /* + Append the comma and the LSP tabstop identifier, + then skip appending the duplicate 'ch' character + */ + newInsert.append(", $").append(n); + } else { + //Only append the original character if it wasn't a comma + newInsert.append(ch); } - //insert += ch; - newInsert.append(ch); } insert = newInsert.toString(); }