File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -2604,6 +2604,7 @@ pkgconf
26042604pkgdiff
26052605pkgx
26062606pkl
2607+ pkl-lsp
26072608plantuml
26082609planus
26092610platformio
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+ 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
You can’t perform that action at this time.
0 commit comments