Skip to content

Commit 183e734

Browse files
committed
pkl-lsp 0.1.2 (new formula)
Signed-off-by: Rui Chen <[email protected]>
1 parent 2b580f1 commit 183e734

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/autobump.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,6 +2604,7 @@ pkgconf
26042604
pkgdiff
26052605
pkgx
26062606
pkl
2607+
pkl-lsp
26072608
plantuml
26082609
planus
26092610
platformio

Formula/p/pkl-lsp.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
class PklLsp < Formula
2+
desc "Language server for Pkl"
3+
homepage "https://pkl-lang.org/lsp/current/index.html"
4+
url "https://github.com/apple/pkl-lsp/releases/download/0.1.2/pkl-lsp-0.1.2.jar"
5+
sha256 "7f9b96be74a3abcec2b770d69ca2b215d8684c311d79b414b59f84784cb4b6a5"
6+
license "Apache-2.0"
7+
8+
livecheck do
9+
url :stable
10+
strategy :github_latest
11+
end
12+
13+
depends_on "openjdk"
14+
15+
def install
16+
libexec.install "pkl-lsp-#{version}.jar" => "pkl-lsp.jar"
17+
bin.write_jar_script libexec/"pkl-lsp.jar", "pkl-lsp"
18+
end
19+
20+
test do
21+
assert_match version.to_s, shell_output("#{bin}/pkl-lsp --version")
22+
23+
require "open3"
24+
25+
json = <<~JSON
26+
{
27+
"jsonrpc": "2.0",
28+
"id": 1,
29+
"method": "initialize",
30+
"params": {
31+
"rootUri": null,
32+
"capabilities": {}
33+
}
34+
}
35+
JSON
36+
37+
Open3.popen3(bin/"pkl-lsp") do |stdin, stdout, _, w|
38+
stdin.write "Content-Length: #{json.size}\r\n\r\n#{json}"
39+
stdin.close
40+
sleep 1
41+
sleep 2 if OS.mac? && Hardware::CPU.intel?
42+
Process.kill("TERM", w.pid)
43+
assert_match(/^Content-Length: \d+/i, stdout.readline)
44+
end
45+
end
46+
end

0 commit comments

Comments
 (0)