Skip to content

Commit b115f3a

Browse files
Fix empty list of holes not being published (#1027)
1 parent 28d1f68 commit b115f3a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

effekt/jvm/src/main/scala/effekt/Server.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ class Server(config: EffektConfig, compileOnChange: Boolean=false) extends Langu
182182
def publishHoles(source: Source, config: EffektConfig)(implicit C: Context): Unit = {
183183
if (!workspaceService.settingBool("showHoles")) return
184184
val holes = getHoles(source)
185-
if (holes.isEmpty) return
186185
client.publishHoles(EffektPublishHolesParams(source.name, holes.map(EffektHoleInfo.fromHoleInfo)))
187186
}
188187

effekt/jvm/src/test/scala/effekt/LSPTests.scala

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,27 @@ class LSPTests extends FunSuite {
13901390
assertEquals(actualJson, expectedJson)
13911391
}
13921392

1393+
test("Empty holes list is sent when there are no holes") {
1394+
withClientAndServer { (client, server) =>
1395+
val source =
1396+
raw"""
1397+
|def foo(x: Int): Int = x + 1
1398+
|""".textDocument
1399+
1400+
val initializeParams = new InitializeParams()
1401+
val initializationOptions = """{"showHoles": true}"""
1402+
initializeParams.setInitializationOptions(JsonParser.parseString(initializationOptions))
1403+
server.initialize(initializeParams).get()
1404+
1405+
val didOpenParams = new DidOpenTextDocumentParams()
1406+
didOpenParams.setTextDocument(source)
1407+
server.getTextDocumentService().didOpen(didOpenParams)
1408+
1409+
val receivedHoles = client.receivedHoles()
1410+
assertEquals(receivedHoles.length, 1)
1411+
assert(receivedHoles.head.holes.isEmpty)
1412+
}
1413+
}
13931414

13941415
// Text document DSL
13951416
//

0 commit comments

Comments
 (0)