texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.76k stars 343 forks source link

Autocompletion not working with the `standalone` package #1895

Closed Zheoni closed 2 years ago

Zheoni commented 2 years ago

Environment

Expected behavior

When I use the \includestandalone macro it should autocomplete and mark it as correct latex syntax.

Actual behavior

Usage of the \includestandalone macro is marked as an unrecognised command. When compiled, all works fine, but it's annoying seeing it marked as if it is wrong. I have tried deleting the autogenerated standalone.cwl but the result is the same.

How to reproduce

2 files:

% main.tex
\documentclass{article}

\usepackage{standalone}
\usepackage{tikz}

\begin{document}

% this is marked as unrecognised
\includestandalone{fig_test}

\end{document}
% fig_test.tex
\documentclass[tikz]{standalone}

\begin{document}
    \begin{tikzpicture}
        \draw (0,0) rectangle (2,1) node[midway] {Example};
    \end{tikzpicture}
\end{document}
sunderme commented 2 years ago

i refer you to the wiki: https://github.com/texstudio-org/texstudio/wiki/Frequently-Asked-Questions#why-does-texstudio-mark-a-command-as-unrecognized

Zheoni commented 2 years ago

Ok, my bad. I'm sorry, I didn't see the wiki. I managed to create a cwl file for the package myself. Thanks for your answer! I'm really enjoying writing my documents in texstudio, thanks for your work.

sunderme commented 2 years ago

you could hand in your cwl if you like.

Zheoni commented 2 years ago

I have put together all the commands and options, however I have not tested it as I don't use all of them. Also, I think this package does something unsupported by the cwl description here: https://htmlpreview.github.io/?https://github.com/texstudio-org/texstudio/blob/master/utilities/manual/usermanual_en.html#CWLDESCRIPTION

The "problem" is that this package behaves differently when used as a document class or with \usepackage. The same command has different keyvalues in these 2 situations. Now it shows all the key values no matter how it is used.

Should I make a pull request o just paste the file here?

sunderme commented 2 years ago

If possible, a pull-request is preferable.