rescript-language-server: init at 1.62.0 (#379703)

This commit is contained in:
Gaétan Lepage
2025-03-14 00:11:30 +01:00
committed by GitHub
5 changed files with 106 additions and 20 deletions
+6
View File
@@ -20495,6 +20495,12 @@
githubId = 19699320;
keys = [ { fingerprint = "FD5D F7A8 85BB 378A 0157 5356 B09C 4220 3566 9AF8"; } ];
};
RossSmyth = {
name = "Ross Smyth";
matrix = "@rosssmyth:matrix.org";
github = "RossSmyth";
githubId = 18294397;
};
rostan-t = {
name = "Rostan Tabet";
email = "rostan.tabet@gmail.com";
@@ -5,8 +5,16 @@
callPackage,
}:
let
version = "1.62.0";
rescript-editor-analysis = callPackage ./rescript-editor-analysis.nix { inherit version; };
extVersion = "1.62.0";
rescript-editor-analysis = callPackage ./rescript-editor-analysis.nix { };
# Ensure the versions match
version =
if rescript-editor-analysis.version == extVersion then
rescript-editor-analysis.version
else
throw "analysis and extension versions must match";
arch =
if stdenv.hostPlatform.isLinux then
"linux"
@@ -16,13 +24,19 @@ let
throw "Unsupported system: ${stdenv.system}";
analysisDir = "server/analysis_binaries/${arch}";
in
vscode-utils.buildVscodeMarketplaceExtension rec {
vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
name = "rescript-vscode";
publisher = "chenglou92";
inherit version;
hash = "sha256-yUAhysTM9FXo9ZAzrto+tnjnofIUEQAGBg3tjIainrY=";
};
# For rescript-language-server
passthru.rescript-editor-analysis = rescript-editor-analysis;
strictDeps = true;
postPatch = ''
rm -r ${analysisDir}
ln -s ${rescript-editor-analysis}/bin ${analysisDir}
@@ -35,6 +49,7 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
lib.maintainers.dlip
lib.maintainers.jayesh-bhoot
];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
license = lib.licenses.mit;
};
}
@@ -1,16 +1,14 @@
{
lib,
stdenv,
fetchFromGitHub,
ocaml,
ocamlPackages,
dune_3,
version,
}:
stdenv.mkDerivation {
pname = "rescript-editor-analysis";
inherit version;
ocamlPackages.buildDunePackage rec {
pname = "analysis";
version = "1.62.0";
minimalOCamlVersion = "4.10";
src = fetchFromGitHub {
owner = "rescript-lang";
@@ -19,20 +17,11 @@ stdenv.mkDerivation {
hash = "sha256-v+qCVge57wvA97mtzbxAX9Fvi7ruo6ZyIC14O8uWl9Y=";
};
strictDeps = true;
nativeBuildInputs = [
ocaml
dune_3
ocamlPackages.cppo
];
buildPhase = ''
dune build -p analysis
'';
installPhase = ''
install -D -m0555 _build/default/analysis/bin/main.exe $out/bin/rescript-editor-analysis.exe
'';
meta = {
description = "Analysis binary for the ReScript VSCode plugin";
homepage = "https://github.com/rescript-lang/rescript-vscode";
@@ -41,5 +30,6 @@ stdenv.mkDerivation {
lib.maintainers.jayesh-bhoot
];
license = lib.licenses.mit;
mainProgram = "rescript-editor-analysis";
};
}
@@ -0,0 +1,71 @@
{
lib,
stdenv,
buildNpmPackage,
fetchFromGitHub,
esbuild,
nix-update-script,
versionCheckHook,
rescript-editor-analysis,
}:
let
version = "1.62.0";
platformDir =
if stdenv.hostPlatform.isLinux then
"linux"
else if stdenv.hostPlatform.isDarwin then
"darwin"
else
throw "Unsupported system: ${stdenv.system}";
in
buildNpmPackage rec {
pname = "rescript-language-server";
inherit version;
src = fetchFromGitHub {
owner = "rescript-lang";
repo = "rescript-vscode";
tag = version;
hash = "sha256-Tox5Qq0Kpqikac90sQww2cGr9RHlXnVy7GMnRA18CoA=";
};
sourceRoot = "${src.name}/server";
npmDepsHash = "sha256-Qi41qDJ0WR0QWw7guhuz1imT51SqI7mORGjNbmZWnio=";
strictDeps = true;
nativeBuildInputs = [ esbuild ];
# Tries to do funny things (install all packages for the entire repo) if you don't override it. This is just a copy paste
# from the package.json.
buildPhase = ''
runHook preBuild
# https://github.com/rescript-lang/rescript-vscode/blob/1.62.0/.github/workflows/ci.yml#L182-L183
mkdir analysis_binaries/${platformDir}
cp ${lib.getExe rescript-editor-analysis} analysis_binaries/${platformDir}/
# https://github.com/rescript-lang/rescript-vscode/blob/1.62.0/package.json#L252
esbuild src/cli.ts --bundle --sourcemap --outfile=out/cli.js --format=cjs --platform=node --loader:.node=file --minify
runHook postBuild
'';
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = [ "--version" ];
doInstallCheck = true;
passthru.updateScript = nix-update-script { };
meta = {
description = "ReScript Language Server";
homepage = "https://github.com/rescript-lang/rescript-vscode/tree/${version}/server";
changelog = "https://github.com/rescript-lang/rescript-vscode/releases/tag/${version}";
mainProgram = "rescript-language-server";
license = lib.licenses.mit;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
maintainers = [ lib.maintainers.RossSmyth ];
};
}
+4
View File
@@ -8153,6 +8153,10 @@ with pkgs;
inherit (callPackage ../development/tools/replay-io { })
replay-io replay-node-cli;
rescript-language-server = callPackage ../by-name/re/rescript-language-server/package.nix {
rescript-editor-analysis = vscode-extensions.chenglou92.rescript-vscode.rescript-editor-analysis;
};
rnginline = with python3Packages; toPythonApplication rnginline;
rr = callPackage ../development/tools/analysis/rr { };