zokugun / vscode-explicit-folding

Customize your Folding for Visual Studio Code
MIT License
99 stars 14 forks source link

Not sure how to use... #3

Closed robertcatgithub closed 5 years ago

robertcatgithub commented 5 years ago

hi can you please help ? I'm new to VS Code. The code of the script I want to fold is very OLD, obscure VB-like language. (PICK). The comment character is "*".

Can you let me know how to use your extension ? thanks

daiyam commented 5 years ago

Hi Robert,

Pick/Basic doesn't seem to have comment blocks so your best option is to use emacs folding ({{{ and }}}). For example:

* {{{
PRINT "ENTER NAME"
INPUT NAME
IF NAME = "" THEN STOP
* }}}

Here the settings for that:

"folding": {
    "*": {
        "begin": "\\{\\{\\{",
        "end": "\\}\\}\\}"
    }
}
louie6111 commented 5 years ago

Hi, daiyam, I have a problem in using this extension. I tried to fold a section in latex between "\section" and "\n" before the next "\section", like this:

 "*": {
        "begin": "\\\\section",
        "end": "\\\\n(?=\\\\section)"
    }

But it does not work. How should I set it in a right way?

daiyam commented 5 years ago

Hi @louie6111,

The extension read the code line by line so it won't see the \n.

How do you close the last section by only using \section?

In Latex, you could use something like:

\begin{document}

\chapter{Let's begin}

\section{First Attempt} % {{{

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut 
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
% }}}

\section{Second attempt} % {{{

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut 
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
% }}}

\end{document}