Skip to content

Commit 7347c5a

Browse files
authored
Show type of region-allocated variables on hover (#1000)
Resolves #924 Before (screenshot from #924): ![image](https://github.com/user-attachments/assets/c1d4fb9d-bc5e-40b9-8ac1-68d6148aff40) After this PR: <img width="804" alt="Screenshot 2025-05-18 at 15 51 00" src="https://github.com/user-attachments/assets/208e317e-8c7a-4b79-9bcd-678defae2ffe" /> More complicated example (Scheduler case study): <img width="844" alt="Screenshot 2025-05-18 at 15 53 32" src="https://github.com/user-attachments/assets/731f8abe-6cd6-4cff-98d0-489d3b5d679c" /> I haven't really changed the text, but we can do so if needed. --- EDIT: 🥳 🎉 #1000!
1 parent bd14a6d commit 7347c5a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

effekt/shared/src/main/scala/effekt/Intelligence.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,15 @@ trait Intelligence {
292292
SymbolInfo(c, "Mutable variable binder", signature, Some(ex))
293293

294294
case s: RegBinder =>
295+
val signature = C.blockTypeOption(s).map(TState.extractType).orElse(s.tpe).map { tpe => pp"${s.name}: ${tpe}" }
295296

296297
val ex =
297-
pp"""|The region a variable is allocated into (${s.region}) not only affects its lifetime, but
298-
|also its backtracking behavior in combination with continuation capture and
299-
|resumption.
300-
|""".stripMargin
298+
s"""|The region `${s.region.name}` the variable `${s.name}` is allocated into
299+
|not only affects its lifetime, but also its backtracking behavior
300+
|in combination with continuation capture and resumption.
301+
|""".stripMargin
301302

302-
SymbolInfo(s, "Variable in region", None, Some(ex))
303+
SymbolInfo(s, "Variable in region", signature, Some(ex))
303304

304305
case c: ValueParam =>
305306
val signature = C.valueTypeOption(c).orElse(c.tpe).map { tpe => pp"${c.name}: ${tpe}" }

0 commit comments

Comments
 (0)