Closed LoganDark closed 3 years ago
Texstudio probably should not strive to recognize all macros of all packages.
Then why does it have to mark them wrong?
They are just marked as "unrecognized command/environment" (when cursor is hover on the commands/environment).
Texstudio uses cwl files to highlight the predefined commands from loaded packages. It is welcome to to contribute to texstudio project by "adding missing cwl files". The related documentation can be found in Sec. 4.13 of texstudio's user manual. You can open the manual from texstudio's menu item "Help > User Manual", or here is a litter bit outdated online verion.
usually txs can parse unknown styles automatically to generate a provisional cwl in .config/texstudio/completion/autogenerated This fails occasionally as .sty files are notoriously hard to parse. You can generate a user file (see manual) which lists the commands, possibly just by extending whatever cwl txs has managed to generate.
See also FAQ: Why does TeXstudio mark a command as missing and the links therein.
We welcome if you want to contribute a .cwl
with the command definitions of tkz-euclide
.
@timhoffm this is still an issue until the cwl files are added. I'm not sure if I can add them myself but I think closing the issue is a bit drastic. This feels kinda like a "we don't care and you can do it yourself" so far
@LoganDark I'm sorry if this feels a bit drastic. We do have a .sty file parser that can automatically create basic cwl files, but it is not possible to identify all ways a command can be defined in .sty files. Additionally that parser cannot attach semantic information to the commands.
There are edge cases which require manual work. Given the limited bandwidth of core developers, we cannot promise to support these as a core feature of TeXstudio. We have to rely on community contributed .cwl files here, and we welcome these very much. But on the other hand, I don't see it as a bug of TeXstudio if they are not available. This part of language detection is inherently incomplete.
But on the other hand, I don't see it as a bug of TeXstudio if they are not available
Indeed, but could be considered as "enhancement".
I've introduced a new label "cwl" and reopened.
This will not be targeted by core developers, but everybody from the community is very welcome to contribute a hand-crafted cwl file.
Indeed, but could be considered as "enhancement".
At this point it would probably be better to create a new issue about the missing cwl files. From what I can see the devs don't feel like it would be worth the effort for TeXstudio to automatically look for commands, so an issue about the editor not discovering commands is basically a 'works as intended wontfix'.
From what I can see the devs don't feel like it would be worth the effort for TeXstudio to automatically look for commands, so an issue about the editor not discovering commands is basically a 'works as intendeed wontfix'.
I'm sorry, but that's absolutely not true. We do have put quite some effort in that automatism and it's working well, but TeX is too complex to make it work for all edge cases.
TeX is too complex to make it work for all cases.
Would you be willing to look into the specific method tkz-euclide uses to define its commands then? I understand it might not be possible to solve the issue for every package but the packages included in the distribution should work and be recognized, right?
Would you be willing to look into the specific method tkz-euclide uses to define its commands then?
I'm sorry, but no. Further improving the .sty parser this is a rabbit hole I won't dive into. I have too little time for this.
I understand it might not be possible to solve the issue for every package but the packages included in the distribution should work and be recognized, right?
Even that is a goal too high, unfortunately.
There are now cwl files for each of the tkz-*
packages in the completion folder. I imagine this issue should be closed now.
@mbertucci47 If the tkz-euclide commands provided in the example code are recognized, then the issue can be closed.
With the small fix in pull request #1674, the commands in the example are all recognized. However, the various pgf
completion files are still very much incomplete.
With the small fix in pull request #1674, the commands in the example are all recognized. However, the various
pgf
completion files are still very much incomplete.
Feel free to include the magic words closes #752
in your PR description to link that PR to this issue
Environment
pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016)
Expected behavior
Things like
tkz-euclide
macros/commands are recognizedActual behavior
This happens with tkz-euclide, pgfplots, and some other libraries
How to reproduce