Skip to content

Commit

Permalink
Fix other cases
Browse files Browse the repository at this point in the history
  • Loading branch information
RblSb committed Jul 29, 2024
1 parent 0953f88 commit a6822d2
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,16 @@ class PostfixCompletion {
if (expr.startsWith("(") && expr.endsWith(")")) {
expr = expr.substring(1, expr.length - 1);
}
// `;` char in `foo.;` completion cases
final afterExprRange:Range = {
start: subject.range.end.translate(0, 1),
end: subject.range.end.translate(0, 2)
}
final afterExprChar = data.doc.getText(afterExprRange);

var replaceRange = data.replaceRange;
if (replaceRange == null) {
replaceRange = data.params.position.toRange();
}
final removeRange:Range = {start: subject.range.start, end: replaceRange.start};

// `;` char in `foo.;` completion cases
final afterExprChar = data.doc.characterAt(replaceRange.end);

final result:Array<CompletionItem> = [];
function add(item:PostfixCompletionItem) {
result.push(createPostfixCompletionItem(item, data.doc, removeRange, replaceRange));
Expand Down Expand Up @@ -147,7 +144,7 @@ class PostfixCompletion {
}

function createTraceItem(expr:String, afterExprChar:String, add:PostfixCompletionItem->Void):Void {
final endChar = afterExprChar == "\n" ? ";" : "";
final endChar = (afterExprChar == ";" || afterExprChar == ")") ? "" : ";";
add({
label: "trace",
detail: 'trace(expr)$endChar',
Expand Down

0 comments on commit a6822d2

Please sign in to comment.