Skip to content

Commit 5e5866b

Browse files
committed
fix: don't show backticks in display on repl.
This removes the backticks when you are seeing all the available options, but still includes them in the actual value of the completion.
1 parent a50e7ca commit 5e5866b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

+7-1
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,19 @@ class ReplDriver(settings: Array[String],
196196
state.copy(context = run.runContext)
197197
}
198198

199+
private def stripBackTicks(label: String) =
200+
if label.startsWith("`") && label.endsWith("`") then
201+
label.drop(1).dropRight(1)
202+
else
203+
label
204+
199205
/** Extract possible completions at the index of `cursor` in `expr` */
200206
protected final def completions(cursor: Int, expr: String, state0: State): List[Candidate] = {
201207
def makeCandidate(label: String) = {
202208

203209
new Candidate(
204210
/* value = */ label,
205-
/* displ = */ label, // displayed value
211+
/* displ = */ stripBackTicks(label), // displayed value
206212
/* group = */ null, // can be used to group completions together
207213
/* descr = */ null, // TODO use for documentation?
208214
/* suffix = */ null,

0 commit comments

Comments
 (0)