Files
klammertext/doc/edit/vscode/make_vsix.sh
T
ack 32aa47d41c Windows is installed through WSL; the native Windows build is withdrawn (from dev a9756dac74c6)
Klammertext on Windows is the Linux build inside WSL 2, or the prebuilt
containers through Docker Desktop. The native build from source (MSYS2) is
no longer offered:

- doc/install/windows_source_install.md and the bundled shell under win/
  are removed.
- doc/install/windows_wsl_install.md is the Windows page. It says there is
  no native build, and its editor section says what holds for each editor:
  Emacs, Vim and Visual Studio Code (through its WSL extension) as on
  Linux; Sublime Text and Notepad++ on the Windows side, with their
  self-contained packages, on files opened through \\wsl.localhost.
- The README lists six install guides; the Notepad++ and VS Code READMEs
  no longer refer to the MSYS2 shell.

No change to the language, the Standard Klammer Set or the commands.
2026-10-04 20:07:20 +02:00

96 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
# make_vsix.sh — package the Klammertext VS Code extension as klammertext.vsix.
#
# Modern VS Code loads only REGISTERED extensions: a folder merely copied
# into ~/.vscode/extensions/ is ignored (and flagged in its .obsolete file),
# so the extension must be installed as a .vsix:
#
# ./make_vsix.sh
# code --install-extension klammertext.vsix
#
# A .vsix is a zip holding a two-file manifest plus the extension payload
# under extension/. This script builds it with bash + Python only — no
# npm, no vsce — matching the extension's no-dependency design. The shared
# core and language server are vendored into the payload: from this folder
# if present (the editing-zip layout), else from ../shared (the repository
# layout).
set -e
cd "$(dirname "$0")"
# The interpreter: $PYTHON if the environment names one (env/runtime.env
# does), else python3, else python -- the only name python.org installs on
# Windows, should this run in a bash there.
PYTHON="${PYTHON:-$(command -v python3 || command -v python)}"
[ -n "$PYTHON" ] || { echo "make_vsix.sh: no python3 or python on PATH" >&2; exit 1; }
OUT="$PWD/klammertext.vsix"
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
mkdir -p "$STAGE/extension/syntaxes"
cp package.json extension.js language-configuration.json README.md "$STAGE/extension/"
cp syntaxes/klammertext.tmLanguage.json "$STAGE/extension/syntaxes/"
for f in klammertext_edit.py klammertext_ls.py; do
if [ -f "$f" ]; then
cp "$f" "$STAGE/extension/"
elif [ -f "../shared/$f" ]; then
cp "../shared/$f" "$STAGE/extension/"
else
echo "make_vsix.sh: cannot find $f (looked here and in ../shared)" >&2
exit 1
fi
done
VERSION=$("$PYTHON" -c "import json; print(json.load(open('package.json'))['version'])")
cat > "$STAGE/[Content_Types].xml" <<'EOF'
<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="json" ContentType="application/json"/>
<Default Extension="js" ContentType="application/javascript"/>
<Default Extension="md" ContentType="text/markdown"/>
<Default Extension="py" ContentType="text/x-python"/>
<Default Extension="vsixmanifest" ContentType="text/xml"/>
</Types>
EOF
cat > "$STAGE/extension.vsixmanifest" <<EOF
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011">
<Metadata>
<Identity Language="en-US" Id="klammertext" Version="$VERSION" Publisher="klammertext"/>
<DisplayName>Klammertext</DisplayName>
<Description xml:space="preserve">Klammertext language support: syntax highlighting, delimiter matching, structural reindentation, table alignment, and delimiter diagnostics.</Description>
<Categories>Programming Languages</Categories>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.75.0"/>
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value=""/>
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value=""/>
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value=""/>
</Properties>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true"/>
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true"/>
</Assets>
</PackageManifest>
EOF
"$PYTHON" - "$STAGE" "$OUT" <<'EOF'
import os, sys, zipfile
stage, out = sys.argv[1], sys.argv[2]
with zipfile.ZipFile(out, 'w', zipfile.ZIP_DEFLATED) as z:
for root, _dirs, files in os.walk(stage):
for f in sorted(files):
full = os.path.join(root, f)
z.write(full, os.path.relpath(full, stage))
EOF
echo "Created $OUT"
echo "Install with: code --install-extension $OUT"