Skip to content

Commit 14ebbc4

Browse files
authored
Merge pull request Homebrew#208355 from Homebrew/pkl-lsp
pkl-lsp 0.1.2 (new formula)
2 parents c8d9611 + 62b2e3b commit 14ebbc4

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/autobump.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,6 +2607,7 @@ pkgconf
26072607
pkgdiff
26082608
pkgx
26092609
pkl
2610+
pkl-lsp
26102611
plantuml
26112612
planus
26122613
platformio

Formula/p/pkl-lsp.rb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
bottle do
14+
sha256 cellar: :any_skip_relocation, all: "909fbb43ab9445b1b8b31a1846e55d4ad105cf0912f3a21e3c19dabb654a991b"
15+
end
16+
17+
depends_on "openjdk"
18+
19+
def install
20+
libexec.install "pkl-lsp-#{version}.jar" => "pkl-lsp.jar"
21+
bin.write_jar_script libexec/"pkl-lsp.jar", "pkl-lsp"
22+
end
23+
24+
test do
25+
assert_match version.to_s, shell_output("#{bin}/pkl-lsp --version")
26+
27+
require "open3"
28+
29+
json = <<~JSON
30+
{
31+
"jsonrpc": "2.0",
32+
"id": 1,
33+
"method": "initialize",
34+
"params": {
35+
"rootUri": null,
36+
"capabilities": {}
37+
}
38+
}
39+
JSON
40+
41+
Open3.popen3(bin/"pkl-lsp") do |stdin, stdout, _, w|
42+
stdin.write "Content-Length: #{json.size}\r\n\r\n#{json}"
43+
stdin.close
44+
sleep 1
45+
sleep 2 if OS.mac? && Hardware::CPU.intel?
46+
Process.kill("TERM", w.pid)
47+
assert_match(/^Content-Length: \d+/i, stdout.readline)
48+
end
49+
end
50+
end

0 commit comments

Comments
 (0)