ziglang / sublime-zig-language

Zig language support for Sublime Text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error after installing via Package Control

rudedogg opened this issue · comments

I keep getting this error popup after installing the plugin via package control:

error loading meta info from Packages/Zig Language/Preferences/Comments.tmPreferences: Error parsing plist xml: expected < in file Packages/Zig Language/Preferences/Comments.tmPreferences on line: 1

The error seems to happen when I interact with Package Control (add/remove packages). Syntax highlighting still works, so it's not a big deal.

I'm using the master branch of Package Control, and the beta version of macOS 11 – so this could definitely be an issue on my end and I just need to wait. Is anyone else having this happen?

I have the same error dialog in Linux amd64.
image

Same here on Windows.

Did some investigating, Preferences/Comments.tmPreferences looks like this from a fresh install.
Was there an error when packaging ?
zig-comments-preference

EDIT:
Seems that a workaround is to replace the content of Preferences/Comments.tmPreferences with the content of Support/Comments.tmPreferences in Installed Packages/Zig Language.sublime-package

commented

I just got this error on Sublime Text after a fresh install of this via package control.

I can confirm that the workaround (from #46 (comment) ) does seems to work. I was able to do it by modifying the zipped up .config/sublime-text-3/Installed Packages/Zig Language.sublime-package

Workaround worked for me as well. Unzip, change the file, rezip as .zip

EDIT: Looks to be same issue as #34

Maybe the Package Control package just needs to be updated? Latest is 1.4.5 (both on GitHub and Package Control), but the issue was fixed after the latest version.

I do not encounter the problem when cloning the repo into ~\AppData\Roaming\Sublime Text 3\Packages\ on windows. So yea, seems like the version uploaded to package control is outdated.

For anyone wondering: Sublime packages are zip archives, as you’ll find by running file "$HOME/Application Support/Sublime Text 3/Installed Packages/Zig Language.sublime-package". As such, fixing the issue can involve a bit of tedious decompressing and recompressing. The following script applies @brodeuralexis’s fix and should suffice as a temporary fix for an individual installation (it prints stuff verbosely so you know what’s going on, and exits on the first error):

#!/usr/bin/env -S bash -euET -o pipefail
shopt -s inherit_errexit 2>/dev/null || true

ZIP_DEST="$(mktemp -d)"
ZIP_SRC="$HOME/Library/Application Support/Sublime Text 3/Installed Packages/Zig Language.sublime-package"

SRC_FILE=Support/Comments.tmPreferences
DEST_FILE=Preferences/Comments.tmPreferences

printf 'Unarchiving "%s"\n' "$(basename "$ZIP_SRC")"
unzip "$ZIP_SRC" {Preferences,Support}/Comments.tmPreferences -d "$ZIP_DEST"
printf '\nOverwriting "%s" with the contents of "%s"\n' "$DEST_FILE" "$SRC_FILE"
ln -fv "$ZIP_DEST/$SRC_FILE" "$ZIP_DEST/$DEST_FILE"

printf '\nRe-zipping "%s" with the new "%s"\n' "$(basename "$ZIP_SRC")" "$DEST_FILE"
pushd "$ZIP_DEST"
zip -Tv -b "$ZIP_DEST" "$ZIP_SRC" Preferences/Comments.tmPreferences
popd

printf '\nRemoving temporary files\n'
rm -fRv "$ZIP_DEST"

I've released a new version, 1.5.0, that is semver compatible. It's now available in Package Control. It resolves this issue.

Enjoy!