Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

Update for Metals v0.6 #81

Merged
merged 2 commits into from
Jun 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/main/scala/servers/Metals.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class HtmlView(title: String) extends js.Object {
object Metals extends ScalaLanguageServer { server =>
val name: String = "metals"
val description: String = "Metals"
val defaultVersion: String = "0.5.2"
val defaultVersion: String = "0.6.1"

def trigger(projectPath: String): Boolean = {
(projectPath / ".metals").isDirectory
Expand Down Expand Up @@ -109,6 +109,21 @@ object Metals extends ScalaLanguageServer { server =>
}
})

// Send windowStateDidChange notification to Metals every time window is in/out of focus
Atom.asInstanceOf[js.Dynamic].getCurrentWindow()
.on("focus", { _: js.Any =>
connection.sendCustomNotification(
"metals/windowStateDidChange",
js.Dynamic.literal("focused" -> true)
)
})
.on("blur", { _: js.Any =>
connection.sendCustomNotification(
"metals/windowStateDidChange",
js.Dynamic.literal("focused" -> false)
)
})

Atom.workspace.onDidChangeActiveTextEditor { editorOrUndef =>
for {
editor <- editorOrUndef
Expand Down