Skip to content

Commit 4ac41e0

Browse files
authored
vtsls: init at 0.2.6 (#347284)
2 parents 4f34a3d + 3ff18d4 commit 4ac41e0

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

maintainers/maintainer-list.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11951,6 +11951,13 @@
1195111951
name = "André Kugland";
1195211952
keys = [ { fingerprint = "6A62 5E60 E3FF FCAE B3AA 50DC 1DA9 3817 80CD D833"; } ];
1195311953
};
11954+
kuglimon = {
11955+
name = "Tatu Argillander";
11956+
email = "[email protected]";
11957+
github = "kuglimon";
11958+
githubId = 629430;
11959+
keys = [ { fingerprint = "2843 750C B1AB E256 94BE 40E2 D843 D30B 42CA 0E2D"; } ];
11960+
};
1195411961
kupac = {
1195511962
github = "Kupac";
1195611963
githubId = 8224569;

pkgs/by-name/vt/vtsls/package.nix

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
stdenv,
3+
lib,
4+
fetchFromGitHub,
5+
nodejs_22,
6+
gitMinimal,
7+
pnpm_8,
8+
}:
9+
10+
stdenv.mkDerivation (finalAttrs: {
11+
pname = "vtsls";
12+
version = "0.2.6";
13+
14+
src = fetchFromGitHub {
15+
owner = "yioneko";
16+
repo = "vtsls";
17+
rev = "server-v${finalAttrs.version}";
18+
hash = "sha256-HCi9WLh4IEfhgkQNUVk6IGkQfYagg805Rix78zG6xt0=";
19+
fetchSubmodules = true;
20+
};
21+
22+
nativeBuildInputs = [
23+
nodejs_22
24+
# patches are applied with git during build
25+
gitMinimal
26+
pnpm_8.configHook
27+
];
28+
29+
buildInputs = [ nodejs_22 ];
30+
31+
pnpmWorkspaces = [ "@vtsls/language-server" ];
32+
33+
pnpmDeps = pnpm_8.fetchDeps {
34+
inherit (finalAttrs)
35+
pnpmWorkspaces
36+
pname
37+
src
38+
version
39+
;
40+
hash = "sha256-4XxQ0Z2atTBItrD9iY7q5rJaCmb1EeDBvQ5+L3ceRXI=";
41+
};
42+
43+
# Patches to get submodule sha from file instead of 'git submodule status'
44+
patches = [ ./vtsls-build-patch.patch ];
45+
46+
# Skips manual confirmations during build
47+
CI = true;
48+
49+
buildPhase = ''
50+
runHook preBuild
51+
52+
# During build vtsls needs a working git installation.
53+
git config --global user.name nixbld
54+
git config --global user.email [email protected]
55+
56+
# during build this sha is used as a marker to skip applying patches and
57+
# copying files, which doesn't matter in this case
58+
echo "dummysha" > ./packages/service/HEAD
59+
60+
# Requires a git repository during build
61+
git init packages/service/vscode
62+
63+
# Depends on the @vtsls/language-service workspace
64+
# '--workspace-concurrency=1' helps debug failing builds.
65+
pnpm --filter "@vtsls/language-server..." build
66+
67+
# These trash deterministic builds. During build the whole directory is
68+
# copied to another path.
69+
rm -rf packages/service/vscode/.git
70+
rm -rf packages/service/src/typescript-language-features/.git
71+
72+
runHook postBuild
73+
'';
74+
75+
installPhase = ''
76+
runHook preInstall
77+
78+
mkdir -p $out/{bin,lib/vtsls-language-server}
79+
cp -r {packages,node_modules} $out/lib/vtsls-language-server
80+
ln -s $out/lib/vtsls-language-server/packages/server/bin/vtsls.js $out/bin/vtsls
81+
82+
runHook postInstall
83+
'';
84+
85+
meta = {
86+
description = "LSP wrapper for typescript extension of vscode.";
87+
homepage = "https://github.com/yioneko/vtsls";
88+
license = lib.licenses.mit;
89+
maintainers = with lib.maintainers; [ kuglimon ];
90+
mainProgram = "vtsls";
91+
platforms = lib.platforms.all;
92+
};
93+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/packages/service/scripts/patch.js b/packages/service/scripts/patch.js
2+
index 2d01f3a..f26c216 100644
3+
--- a/packages/service/scripts/patch.js
4+
+++ b/packages/service/scripts/patch.js
5+
@@ -13,11 +13,7 @@ const vscTsExtPath = path.resolve(__dirname, "../vscode/extensions/typescript-la
6+
const tsExtPath = path.resolve(__dirname, "../src/typescript-language-features");
7+
8+
async function getVscodeSha() {
9+
- const { stdout } = await exec("git", ["submodule", "status", "vscode"], {
10+
- cwd: path.resolve(__dirname, "../"),
11+
- });
12+
- const commit = stdout.match(/^\s*([^\s]+)\s/)[1];
13+
- return commit;
14+
+ return await fs.readFile('./HEAD', { encoding: 'utf8' });
15+
}
16+
17+
/**
18+

0 commit comments

Comments
 (0)