How to add autocomplete schema to NPP distro?
-
There isn’t really a “standard” place for such things. And I doubt the developer would want to bundle that with Notepad++ itself.
But since shared auto-completion files (for UDLs) can go in the UDL Repository, and since I am the primary decision maker for that repo, I think it could probably go there.
In fact, I recently did a bare-bones schema for autocompletion – it doesn’t check everything, but does make sure that it at least looks like an autocompletion file and not something else, so that new submissions will be validated before they are merged into the UDL repo.
If you submit a PR to that schema file, and the tests run and don’t call all the existing UDL auto-completion files “bad”, then I’d accept and merge it, so it could be stored there. And after I tried it out in combination with XMLTools and some of Notepad++'s default auto-completion files, I would probably even add a link from the AutoCompletion part of the User Manual to that file, with the recommendation that auto-completion developers would be well-advised to use XMLTools and that schema when developing their own auto-completion files.
-
@PeterJones Ok, I’ll start the process.
The xsd schema file has taken about two months to develop and not knowing anything from the start how to do it. In fact, I have two variations, but plan only submitting the one that is more documented.Your weblink to this xsd file will also need to specify what has to go into ones autocomplete language xml file to via a few attributes.
As for where to put it, it can be put in NPP’s autocomplete directory with the rest of the autocomplete xml language files, then each autocomplete xml file can point to that directory to be validated when they are modified. However, one can put it in any directory too, but the xml file will need to be modified to know where to look.
Currently it works with the noNamespaceSchemaLocation
I have the entries for schemaLocation commented out until someone knows why it doesn’t work properly.
I realize that autocomplete is unqualified since no prefix is specified, but one should be able to point to a default namespace without a prefix qualifier during validation using this attribute.I have comments in the xsd, and my autocomplete DXL xml file to help others. The DXL file is validated against the noNamespaceSchemaLocation attribute and xsd and works.
This schema was done since I have over 1500 functions and it was a pain to find the errors. Thus the xml was tested by purposely breaking things to find them and determine if the schema was working.
XML tools will get you to the line in error one at a time starting with the first error. Also the enable autovalidation when saving was also tested and works as expected.I do have a prototype DTD too that would validate this xsd schema, but NPP and plugins don’t seem to do DTDs.
As a side note, I used liquid studio trial to help me thru this process along with help on stackoverflow too.
-
@swegmike said in How to add autocomplete schema to NPP distro?:
I have written an NPP autocomplete schema xsd file
Me too! I have:
PS MVINCENT C:\usr\bin\npp64 > ls -alR | grep -E "(\.xsd|\.dtd)" -rw-r----a 1 MVINCENT 586 Jan 5 21:03 langs.model.dtd -rw-r----a 1 MVINCENT 1711 Jan 5 20:59 langs.model.xsd -rw-r----a 1 MVINCENT 1062 Jan 5 21:15 stylers.model.dtd -rw-r----a 1 MVINCENT 3311 Jan 5 21:08 stylers.model.xsd -rw-r----a 1 MVINCENT 865 Jan 5 21:03 autoCompletion.dtd -rw-r----a 1 MVINCENT 2644 Jan 6 07:27 autoCompletion.xsd -rw-r----a 1 MVINCENT 958 Jan 6 14:53 functionList.dtd -rw-r----a 1 MVINCENT 5844 Jan 6 07:30 functionList.xsd -rw-r----a 1 MVINCENT 1456 Jan 10 13:42 userDefineLangs.dtd -rw-r----a 1 MVINCENT 4630 Jan 10 13:42 userDefineLangs.xsd
and a batch file to automate running
xmllint
with these files against all the Notepad++ XML files.Cheers.
-
I have your file open on github, but don’t see a PR button, but only give feedback.
Since my xsd is bigger than yours, since it validatres more, I’d like to respond to your file by just uploading and attaching my xsd files post.
-
@swegmike said in How to add autocomplete schema to NPP distro?:
I have your file open on github, but don’t see a PR button
Did you fork the repo, clone it, create a branch, add, commit, and push to get a link produced that offers to submit a PR against the master?
-
@Michael-Vincent
Great that you have the autocomplete dtd.
It would be interesting to compare with mine.Perhaps they can be uploaded too to github so others can take a look.
Question: for the autocomplete.xsd, did you get schemaLocation to work although autocomplete doesn’t use prefix qualifiers?
-
@swegmike said in How to add autocomplete schema to NPP distro?:
I have your file open on github, but don’t see a PR button, but only give feedback
The file is part of a bigger repository; generally, when submitting a PR, you make a fork of the repo, make the changes, and then start a PR. But if you’d rather, just create a new issue in that repo, and attach the XSD to the issue.
-
@swegmike said in How to add autocomplete schema to NPP distro?:
Question: for the autocomplete.xsd, did you get schemaLocation to work although autocomplete doesn’t use prefix qualifiers?
No. Just pasted an autocomplete file into an XSD generator and then edited the output to account for the corner cases.
Same for the DTD files.
Cheers.
-
@Michael-Vincent You may want to upload your files as issues so others can take a look at them too.
@PeterJones I’ve uploaded my xsd as an issue and specified what has to go into the autocomplete xml file NotePadPlus tag before trying to validate it.
https://github.com/notepad-plus-plus/userDefinedLanguages/issues/154
Note: github didn’t support xsd file extensions, so I had to rename my file as txt for me to be able to drag and drop it.
-
@Michael-Vincent Check my reply to your post, and follow the link, @PeterJones at that links said he’ll take a look at all your xsd and dtd files this weekend if you repond and attach your files. Be aware that you may need to change the file extension to txt and state so in the post since the drag and drop doesn’t recognize some file extensions.
-