VS Code extension installs via a hand-built .vsix (from dev 83e472a94ed3)
Folder copies into ~/.vscode/extensions no longer load in modern VS Code; make_vsix.sh packages the extension (bash + python3 only) and the README installs it with `code --install-extension`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,7 @@ are regenerated on each release — patches cannot be merged directly.
|
|||||||
Report problems (or send patches) to the author; accepted changes are
|
Report problems (or send patches) to the author; accepted changes are
|
||||||
applied to the development tree and appear in a following snapshot.
|
applied to the development tree and appear in a following snapshot.
|
||||||
|
|
||||||
This snapshot was assembled from development commit `eb5baf9cbe59`.
|
This snapshot was assembled from development commit `83e472a96e36`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,21 @@ language's structure, everywhere.
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Copy this `vscode/` directory into your VS Code extensions folder:
|
Package the extension as a `.vsix` and install it (the builder needs only
|
||||||
|
bash and python3; the editing zip from the Klammertext website ships a
|
||||||
|
prebuilt `klammertext.vsix`, so there the first step is already done):
|
||||||
|
|
||||||
cp -R vscode ~/.vscode/extensions/klammertext
|
./make_vsix.sh
|
||||||
|
code --install-extension klammertext.vsix
|
||||||
|
|
||||||
then restart VS Code (or run the **Developer: Reload Window** command). If
|
then restart VS Code (or run the **Developer: Reload Window** command).
|
||||||
you copy the directory out of the Klammertext tree, also copy
|
`make_vsix.sh` vendors the shared core and the language server into the
|
||||||
`shared/klammertext_ls.py` and `shared/klammertext_edit.py` into the copied
|
package automatically, from this folder or from `../shared/`.
|
||||||
folder — or set `klammertext.serverPath`. The editing zip from the
|
|
||||||
Klammertext website ships the vendored copies already in place.
|
Do **not** copy this directory into `~/.vscode/extensions/` by hand:
|
||||||
|
modern VS Code loads only *registered* extensions, so a merely copied
|
||||||
|
folder is silently ignored (and flagged for deletion in that directory's
|
||||||
|
`.obsolete` file). Installing the `.vsix` is what registers it.
|
||||||
|
|
||||||
**Note:** `.kt` is also Kotlin's extension. Stock VS Code has no Kotlin
|
**Note:** `.kt` is also Kotlin's extension. Stock VS Code has no Kotlin
|
||||||
support built in, so there is no conflict out of the box; if you install a
|
support built in, so there is no conflict out of the box; if you install a
|
||||||
|
|||||||
89
doc/edit/vscode/make_vsix.sh
Executable file
89
doc/edit/vscode/make_vsix.sh
Executable file
@@ -0,0 +1,89 @@
|
|||||||
|
#!/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 + python3 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")"
|
||||||
|
|
||||||
|
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=$(python3 -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
|
||||||
|
|
||||||
|
python3 - "$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"
|
||||||
@@ -211,6 +211,28 @@ else
|
|||||||
echo "(no Node runtime — the VS Code extension test is skipped; the language server is still tested)"
|
echo "(no Node runtime — the VS Code extension test is skipped; the language server is still tested)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --- the VS Code .vsix package builds with the full payload ----------------
|
||||||
|
# (the no-marketplace install path; needs only bash + python3)
|
||||||
|
mkdir -p "$OUT/vsix"
|
||||||
|
cp -R "$EDIT_DIR/vscode" "$EDIT_DIR/shared" "$OUT/vsix/"
|
||||||
|
if ( cd "$OUT/vsix/vscode" && ./make_vsix.sh >/dev/null 2>&1 ) && \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 python3 -c "
|
||||||
|
import sys, zipfile
|
||||||
|
names = set(zipfile.ZipFile('$OUT/vsix/vscode/klammertext.vsix').namelist())
|
||||||
|
need = {'extension.vsixmanifest', '[Content_Types].xml',
|
||||||
|
'extension/package.json', 'extension/extension.js',
|
||||||
|
'extension/language-configuration.json', 'extension/README.md',
|
||||||
|
'extension/klammertext_edit.py', 'extension/klammertext_ls.py',
|
||||||
|
'extension/syntaxes/klammertext.tmLanguage.json'}
|
||||||
|
sys.exit(1 if need - names else 0)
|
||||||
|
"; then
|
||||||
|
echo "${green}PASS${reset} vscode .vsix package builds (make_vsix.sh)"
|
||||||
|
PASS=$((PASS + 1))
|
||||||
|
else
|
||||||
|
echo "${red}FAIL${reset} vscode .vsix package builds (make_vsix.sh)"
|
||||||
|
FAIL=$((FAIL + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
# --- compare ---------------------------------------------------------------
|
# --- compare ---------------------------------------------------------------
|
||||||
for f in $INDENT_FIXTURES $ALIGN_FIXTURES; do
|
for f in $INDENT_FIXTURES $ALIGN_FIXTURES; do
|
||||||
check "$f (python)" "$OUT/$f.py.out" "$FIX/${f}_expected.kt"
|
check "$f (python)" "$OUT/$f.py.out" "$FIX/${f}_expected.kt"
|
||||||
|
|||||||
Reference in New Issue
Block a user