File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -2607,6 +2607,7 @@ pkgconf
26072607pkgdiff
26082608pkgx
26092609pkl
2610+ pkl-lsp
26102611plantuml
26112612planus
26122613platformio
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments