-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LSP: Beginning a language server (#511)
Right now all it does is listen to stdin, and write the messages it receives to a log file. But, quite a few standard library functions needed to be added to get to this point.
- Loading branch information
Showing
5 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
log.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import "process" as process | ||
import "fs" as fs | ||
|
||
val cwd = fs.getCurrentWorkingDirectory() | ||
val logFilePath = "$cwd/log.txt" | ||
val logFile = match fs.createFile(logFilePath, fs.AccessMode.WriteOnly) { | ||
Ok(v) => v | ||
Err(e) => { | ||
println(e) | ||
process.exit(1) | ||
} | ||
} | ||
|
||
val stdin = process.stdin() | ||
|
||
while stdin.readAsString() |str| { | ||
logFile.writeln(str) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters