Skip to content

Commit 7219512

Browse files
timsueberkruebmarvinborner
authored andcommitted
Standalone language server (effekt-lang#885)
Free the language server from Kiama and implement a test suite. Found some bugs while reimplementing, and I've confirmed all of them also exist in the old server. It should be on-par with the old implementation in terms of features and bugs. Depends on effekt-lang/kiama#9. **Differences to the old Server:** * Added unit test suite * New server runs single threaded and sequentially * Compile on `didChange`, by default * No Monto anymore, added a custom `$/effekt/publishIR` notification instead. **Implementation status:** * [x] `initialize` * [x] `shutdown` - not covered by unit tests - they cannot handle the process exit * [x] `exit` - not covered by unit tests - they cannot handle the process exit * [x] setTrace * [x] Diagnostics `afterCompilation` * [x] `didChange` * [x] `didOpen` * [x] `didSave` * [x] `didClose` * [ ] `hover` * [x] for symbols * [ ] 🐛 for holes: effekt-lang#549 * [ ] `documentSymbol` * [x] impl & test * [ ] 🐛 Fix spurious symbols at `(0, 0)`: effekt-lang#895 * [ ] `references` * [x] impl & test * [ ] 🐛 Fix not all references being returned (see test case): effekt-lang#896 * [x] `inlayHint` * [x] impl & test * [x] 🐛 inlayHints and hoverInfo sometimes return null (as in old implementation): * [x] inlayHints: effekt-lang#876 (fixed in effekt-lang#894) * [x] hoverInfo: effekt-lang#366 (**can't reproduce**) Note that the timing issue should be gone as we now run on `newSingleThreadExecutor` (which claims "Tasks are guaranteed to execute sequentially"), the caching issues have been fixed in effekt-lang#894. * [ ] `getCodeActions` * [x] port impl from old server * [ ] 🐛 impl doesn't even work in old server: effekt-lang#897 * [x] `definition` * [ ] `notebookDocument/*` * not implemented, student works on another branch * [ ] publish IR (`$/effekt/publishIR`), replacing Monto * [x] impl server and test (this PR) * [x] impl client (effekt-lang/effekt-vscode#63) * [ ] 🐛 many options (e.g. `target`) don't work because the server only runs the compiler frontend - same issue with old server Important questions to reviewers: * [x] `effekt/jvm/src/main/scala/effekt/KiamaUtils.scala` is MPL-licensed code from Kiama - what do we do with this? * I decided to move it to Kiama to be safe. --------- Co-authored-by: Marvin Borner <[email protected]>
1 parent 9195bbe commit 7219512

File tree

4 files changed

+1165
-108
lines changed

4 files changed

+1165
-108
lines changed

effekt/jvm/src/main/scala/effekt/Main.scala

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ object Main {
1717
parseArgs(args)
1818
} catch {
1919
case e: ScallopException =>
20-
System.err.println(e.getMessage())
20+
System.err.println(e.getMessage)
2121
return
2222
}
2323

2424
if (config.server()) {
25-
Server.launch(config)
25+
val serverConfig = ServerConfig(
26+
debug = config.debug(),
27+
debugPort = config.debugPort()
28+
)
29+
val server = new Server(config)
30+
server.launch(serverConfig)
2631
} else if (config.repl()) {
27-
new Repl(Server).run(config)
32+
new Repl(new Driver {}).run(config)
2833
} else {
2934
compileFiles(config)
3035
}
@@ -43,8 +48,9 @@ object Main {
4348
* Compile files specified in the configuration.
4449
*/
4550
private def compileFiles(config: EffektConfig): Unit = {
51+
val driver = new Driver {}
4652
for (filename <- config.filenames()) {
47-
Server.compileFile(filename, config)
53+
driver.compileFile(filename, config)
4854
}
4955
}
5056
}

0 commit comments

Comments
 (0)