Closed FelixBenning closed 1 year ago
Try this. In vs code's settings (ctrl+,) search for xml validation
. Make sure that Xml > Validation > XInclude: Enabled
is checked. This should allow the schema checker to follow xi:include
calls.
Im not sure that it will fix the problem, I suspect that it is a problem with the rng schema
Try this. In vs code's settings (ctrl+,) search for
xml validation
. Make sure thatXml > Validation > XInclude: Enabled
is checked. This should allow the schema checker to followxi:include
calls.
It is checked. It also says: "Default Value overridden by PreTeXt tools" on hover. So it looks like this works as expected.
@FelixBenning can you share your XML file please.
sure (as I said they are the result of pretext new article
, but here are the files
<!-- main.ptx -->
<?xml version='1.0' encoding='utf-8'?>
<pretext xml:lang="en-US" xmlns:xi="http://www.w3.org/2001/XInclude">
<docinfo>
<macros>\newcommand{\foo}{b^{ar}}</macros>
<latex-image-preamble>\usepackage{tikz}</latex-image-preamble>
</docinfo>
<article xml:id="my-great-article">
<title>My Great Article</title>
<xi:include href="./section-1.ptx" />
<xi:include href="./section-2.ptx" />
</article>
</pretext>
<!-- section-1.ptx -->
<?xml version='1.0' encoding='utf-8'?>
<section xml:id="section-1" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>My First Section</title>
<introduction>
<p>Some words</p>
</introduction>
<p>foo</p>
<figure>
<caption>A frog</caption>
<image source="frog.jpg" width="50%">
<description>A nice-looking frog with a longish
description.</description>
</image>
</figure>
<p>Bar:
<m>\foo</m></p>
</section>
<!-- section-2.ptx -->
<?xml version='1.0' encoding='utf-8'?>
<section xml:id="section-2" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>My Additional Section</title>
<introduction>
<p>Other words</p>
</introduction>
<p>foo</p>
<figure xml:id="figure-tikz-example-diagram">
<caption>The graph <m>C_5</m> made by TikZ</caption>
<image xml:id="tikz-example-diagram" width="20%">
<description>A 5-cycle</description>
<latex-image>
\begin{tikzpicture}
\coordinate (A) at (90+360/5:1);
\coordinate (B) at (90+2*360/5:1);
\coordinate (C) at (90+3*360/5:1);
\coordinate (D) at (90+4*360/5:1);
\coordinate (E) at (90:1);
\draw (A) -- (B) -- (C) -- (D) -- (E) -- (A);
\foreach \x in {(A), (B), (C), (D), (E)}{
\fill \x circle (2pt);
}
\end{tikzpicture}
</latex-image>
</image>
</figure>
<p>bar</p>
</section>
sure (as I said they are the result of pretext new article, but here are the files
I'm one of the author of vscode-xml and I have never used pretex. Thanks for sharing your files.
@oscarlevin was right, you need to configure XInclude. See https://github.com/redhat-developer/vscode-xml/blob/main/docs/Features/XIncludeFeatures.md
See following demo here:
as I said it is already enabled. The default is set to true by pretext-tools
Which pretext.rng file are you using?
What is a pretext.rng
file?
I am not able to reproduce this error. Two things to check:
pretext-tools
are you using? There was a bug someone pointed out in 0.11.2, which was fixed in 0.11.3..rng
file you use. (You can see this inside the .vscode/settings.json
file)pretext-tools
is v0.11.3. I just tried pretext for the first time so this was a new installation. It was on stable but experimental does not work either.
With the .vscode/settings.json
do you mean the user settings JSON? because I couldn't find any reference to an .rng
file in there. If I click on "copy settings as JSON" in the ui I get
"pretext-tools.schemaVersion": "Stable"
Inside your project folder, there should be a .vscode
folder that contains a file settings.json
. The contents of that file, for me, is
{
"xml.fileAssociations": [
{
"pattern": "**/source/**.ptx",
"systemId": "/home/oscar/.ptx/schema/pretext-dev.rng"
}
]
}
The only other thing I can think of is that there is something strange going on with your settings between User and Workspace (in the settings window, you should see both of these at the top; I think the idea is that a particular project can have different settings from your global (i.e., user) settings.)
ah, right found it:
{
"xml.fileAssociations": [
{
"pattern": "**/source/**.ptx",
"systemId": "/Users/fbenning/.ptx/schema/pretext.rng"
}
]
}
I also checked that the file is there. It also switches to pretext-dev.rng
when I set the setting to experimental and reload.
@FelixBenning to know which schema you are using in your ptx file, I suggest that you enable codelens on XML side https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#code-lens
After that you will see with file association
codelens that you click on it to open the schema:
Found the "with file association setting"
I pasted the entire schema into the collapsible below.
So I get the same behaviour on my windows PC at home and my work mac laptop. So I am really confused that you can not reproduce. If you want to hop on a call for debugging, I can probably make time.
Ok I think you are using vscode-xml in binary mode (I think you have not Java which is installed, so it use binary mode) and after testing vscode-xml in binary mode, I noticed the same problem than you.
I created the issue https://github.com/redhat-developer/vscode-xml/issues/922 and start a quick fix.
I indeed did not have java installed. I just installed it - but after restarting vscode I still have the same error.
I think you are using binary again. You need to configure Java home, see https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#java-home
and check xml.server.preferBinary
is not set to true https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#server-binary-mode
setting the path indeed fixed the issue ✔️
@FelixBenning the fix for binary has been merged. Could you tomorrow (when the vscode-xml prerelease will be available) try:
xml.server.preferBinary
to true
to be sure that you are using binaryThanks!
unfortunately it seems to still be an issue
(maybe I was too early)
(maybe I was too early)
Yes I think so, the version should be v0.26.2023072504, in your case you have installed "v0.26.2023072004"
Could you retry to install it please.
it does work now 👍
Great! Thanks for your patience.
What patience 😄 just two weeks turn around time is fantastic for a free open source project. Thank you for your help!
Glad you enjoy with pretext-tools / vscode-xml. We are happy that @oscarlevin decided to be based on vscode-xml.
For your information if you are working on xref / @xml:id, the pretext tools configure vscode-xml to enable it, you should benefit with completion, validation,hyperlink, rename, etc, see https://github.com/redhat-developer/vscode-xml/blob/main/docs/Features/XMLReferencesFeatures.md#attribute-node-references-fooattr
Reproduction: Creating a new pretext project with
immediately results in the error
I am assuming that the schema is incomplete