Closed daverosoff closed 5 years ago
Thanks for the pull request!
I'm not opposed to merging it as is since the change certainly doesn't break anything, but I'm wondering whether it would be better to refactor the code a bit, instead.
Instead of looking at the file name of the syntax definition file like we do now, we could instead inspect the scope of the current document. Something like this:
view.scope_name(view.sel()[0].begin())
For example, for a PreTeXt document, that returns text.xml.pretext
, and for XSLT, it returns something like text.xml.xsl meta.tag.preprocessor.xml punctuation.definition.tag.begin.xml
, depending on where the cursor is.
We could just check whether the string that view.scope_name()
returns contains text.xml
and if so, the document would be considered an XML document.
I can look into it when I get the time, but feel free to give it a shot if you get the chance.
I like your idea much better. It is far more elegant and general. I will try to do it tonight or tomorrow if I can grab a few minutes.
I gave this a stab and released v0.3.6. When it appears in Package Control, could you give it a try and let me know if it solves the issue for you?
This seems to work beautifully after a quick test. I'll close this PR. Sorry I ended up forgetting about this issue, but thank you very much for the improvement! Now I can recommend Exalt in the PreTeXt documentation.
No worries! Glad to hear it's working.
Please don't hesitate to let me know if you come across any further issues.
Please feel free to close if this is an unwelcome request. PreTeXt is an XML vocabulary for the generation of scholarly documents that is actively used by a community of one or two hundred authors. Around 50 books have been written in it (that we know of). In addition I wrote [PreTeXtual]() to duplicate some of the functionality of LaTeXtools. It provides a syntax definition that reflects the RELAX-NG schema of PreTeXt. The snippets that give the package much of its utility rely on the scopes that the package provides.
I would like to include instructions for using Exalt to validate PreTeXt in the official documentation, but without the change in this PR, it is either necessary for users to edit the Exalt source themselves or switch syntaxes in Sublime. It would be nice to have it supported natively if this is a change you're willing to make. Thanks for considering it and of course I understand if not. Thanks for your work on Exalt.