Thom1729 / Sublime-JS-Custom

Customizable JavaScript syntax highlighting for Sublime Text.
MIT License
137 stars 9 forks source link

`xml.parsers.expat.ExpatError` after install #103

Closed malthejorgensen closed 3 years ago

malthejorgensen commented 3 years ago

After installing JSCustom via Package Control I immediately get the following error (included package install as well for context):

reloading plugin JSCustom.plugin
JS Custom: New installation. Building all syntaxes.
reloading settings Packages/JSCustom/sublime/JS Custom.sublime-settings
generating syntax summary
generating meta info summary
JS Custom: Configuration changed. Rebuilding some syntaxes.
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1050, in run_
    return self.run(**args)
  File "/Users/malthe/Library/Application Support/Sublime Text 3/Installed Packages/JSCustom.sublime-package/src/commands/build_syntaxes.py", line 51, in run
  File "/Users/malthe/Library/Application Support/Sublime Text 3/Packages/sublime_lib/st3/sublime_lib/syntax.py", line 96, in get_syntax_for_scope
    for syntax in reversed(list_syntaxes())
  File "/Users/malthe/Library/Application Support/Sublime Text 3/Packages/sublime_lib/st3/sublime_lib/syntax.py", line 83, in list_syntaxes
    for path in syntax_definition_paths
  File "/Users/malthe/Library/Application Support/Sublime Text 3/Packages/sublime_lib/st3/sublime_lib/syntax.py", line 86, in <listcomp>
    and path.with_suffix('.sublime-syntax') in syntax_definition_paths
  File "/Users/malthe/Library/Application Support/Sublime Text 3/Packages/sublime_lib/st3/sublime_lib/syntax.py", line 55, in get_syntax_metadata
    **SYNTAX_TYPES[path.suffix](path)
  File "/Users/malthe/Library/Application Support/Sublime Text 3/Packages/sublime_lib/st3/sublime_lib/syntax.py", line 36, in get_hidden_tmlanguage_metadata
    tree = plistlib.readPlistFromBytes(path.read_bytes())
  File "./python3.3/plistlib.py", line 104, in readPlistFromBytes
  File "./python3.3/plistlib.py", line 76, in readPlist
  File "./python3.3/plistlib.py", line 378, in parse
xml.parsers.expat.ExpatError: XML or text declaration not at start of entity: line 7, column 0

Also, when I open up the JSCustom preferences and try to save I get the message:

Unable to save ~/Library/Application Support/Sublime Text 3/Packages/JSCustom/sublime/JS Custom.sublime-settings
Error: No such file or directory

~ is /Users/malthe. ~/Library/Application Support/Sublime Text 3/Packages/JSCustom/ doesn't exist. ~/Library/Application Support/Sublime Text 3/Packages/User/JS Custom/Syntaxes/ exists but is empty.

malthejorgensen commented 3 years ago

The first part was caused by the package AutoDocstring, specifically Packages/AutoDocstring/ADMagicPython.hidden-tmLanguage. Removing the AutoDocstring-package fixed the issue.

malthejorgensen commented 3 years ago

Second part with the "unsaveable" settings seems intended. Closing issue.

Thom1729 commented 3 years ago

Were you editing the default settings (on the left) rather than the user settings (on the right)? It sounds like you've worked it out either way.

malthejorgensen commented 3 years ago

Yes, exactly that. I was desperately trying to get it to work, but didn't know it was all caused by the first error with AutoDocstring at the time šŸ˜…

malthejorgensen commented 3 years ago

Not sure if this is deserving of a new issue (or we should rather wait for Sublime Text 4 to land) but I'm having some issues with syntax highlighting. Seems to be caused by the multiline generic args to reduxForm:

Screen Shot 2021-03-27 at 00 42 42
Thom1729 commented 3 years ago

Is that Flow or TypeScript?

TypeScript support in 2.4 is experimental and not super great. Version 3.0 offers much better TypeScript support (developed in concert with the new core TypeScript syntax) but relies on ST4 features. If you're on the ST4 beta, you can get the latest JS Custom 3.0 alpha by adding "install_prereleases": ["JSCustom"] to your Package Control config.

If that's Flow, then honestly the Flow extension is going to need an almost complete rewrite for 3.0, which I haven't begun. The 3.0 TypeScript extension might actually provide better highlighting for Flow at this point.

The problem in this case is that the 2.4 extensions don't know about generic type parameters to functions. This is very difficult to do without the new ST4 syntax features and I doubt that I'll ever make them work for a ST3-compatible release.

malthejorgensen commented 3 years ago

This is TypeScript ā€“ sounds good ā€“ I was planning to upgrade to the beta of Sublime Text 4 anyways, so will do that in the coming days :)