I'd like restore the feature "fold preamble" like in Texmaker.
i don't know why quit this feature.
It's good to fold since \documentclass{} to \begin{document}
Ok, we leave this open because the request is reasonable. However it is currently not possible to implement this because of the program logic: Folding is associated with "brackets" and you cannot specify "beginning of file" to "\begin{document}" as bracket in the language specification.
Last edit: Tim Hoffmann 2012-11-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2012-11-25
I wonder about the benefit of such a functionality. If you have a really long preamble, the first thing that comes to mind is to outsource the preamble to a seperate file and include this with the 'input' command.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2012-11-25
Sometimes in a short document a "well-specified" preamble (maybe with some explanatory comments) can occupy several lines and that bothers, not worth it separated into a new file. (if this is not posible, how is done in Texmaker?)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Of course, everything is possible, given you had endless ressouces. It's just that TXS and Texmaker use different mechanisms to detect folding, and in our case folding the preamble is not easy to implement. The reasons are given below:
Afaik Texmaker hard-codes these things, e.g. something like
if (line.contains("\\begin{")) {
fold to matching \\end
}
In contrast, TXS (actually the underlying editor QCodeEdit) uses a formal language definition (see .qnfa files in the sources) and an engine that parses this definition and handles the details. Code folding is part of these language definitions. This approach is much more powerful and is the basis that allows us to have the detailed highlighting and folding (and support for other languages, Like BibTeX, QtScript, dtx files, Lua etc.) with reasonable effort.
Now, in the Texmaker way, it is easy to hack an additional line
lf (startOfDocument()) {
fold to line before \\begin{document}
}
This doesn't work in our approach. The language format of QCodeEdit neiter supports startOfDocument, nor "line before something". So you'd have to adapt the language definition format and the parser/engine. The latter is a non-trivial piece of code which makes sure, that also complicated situations are highlighted and folded correctly (that's not always the case in Texmaker). And I'm not going to touch this for the time being.
As a workaround, I cound offer you a special comment that can be folded:
% PREAMBLE
% END_PREAMBLE
Actually, implementing this would be trivially due to the language system.
Last edit: Tim Hoffmann 2012-11-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, we leave this open because the request is reasonable. However it is currently not possible to implement this because of the program logic: Folding is associated with "brackets" and you cannot specify "beginning of file" to "\begin{document}" as bracket in the language specification.
Last edit: Tim Hoffmann 2012-11-24
I wonder about the benefit of such a functionality. If you have a really long preamble, the first thing that comes to mind is to outsource the preamble to a seperate file and include this with the 'input' command.
Sometimes in a short document a "well-specified" preamble (maybe with some explanatory comments) can occupy several lines and that bothers, not worth it separated into a new file. (if this is not posible, how is done in Texmaker?)
Of course, everything is possible, given you had endless ressouces. It's just that TXS and Texmaker use different mechanisms to detect folding, and in our case folding the preamble is not easy to implement. The reasons are given below:
Afaik Texmaker hard-codes these things, e.g. something like
In contrast, TXS (actually the underlying editor QCodeEdit) uses a formal language definition (see .qnfa files in the sources) and an engine that parses this definition and handles the details. Code folding is part of these language definitions. This approach is much more powerful and is the basis that allows us to have the detailed highlighting and folding (and support for other languages, Like BibTeX, QtScript, dtx files, Lua etc.) with reasonable effort.
Now, in the Texmaker way, it is easy to hack an additional line
This doesn't work in our approach. The language format of QCodeEdit neiter supports startOfDocument, nor "line before something". So you'd have to adapt the language definition format and the parser/engine. The latter is a non-trivial piece of code which makes sure, that also complicated situations are highlighted and folded correctly (that's not always the case in Texmaker). And I'm not going to touch this for the time being.
As a workaround, I cound offer you a special comment that can be folded:
% PREAMBLE
% END_PREAMBLE
Actually, implementing this would be trivially due to the language system.
Last edit: Tim Hoffmann 2012-11-25
I think the
% PREAMBLE
% END_PREAMBLE
idea you mention would be very helpful!
Thanks,
DW
Maybe we should generalize it to
% START_EXTRA_FOLD
% END_EXTRA_FOLD
Last edit: Tim Hoffmann 2012-12-04
Implemented (rev. 3532)
which lets the user specify an arbitrary region as foldable
with the above workaround, one can make the preamble region foldable. Nevertheless, directly supporting a folding of the preamble would be desirable.
Reinvestigate, when QCE3 is used.
Ok, I like this idea ... because it allows you to fold any region more generally.
A fold command would be very appreciated. TeXnicCenter has the following command to delimit a foldable region:
%\begin
your foldable region
%\end
Thanks, it looks good in the new version 2.5.2