area / language-latex

Syntax highlighting for LaTeX for Atom.
Other
78 stars 47 forks source link

[Feature request] Correct highlight on custom environments #182

Open Strauman opened 6 years ago

Strauman commented 6 years ago

Motivation

Being able to correctly syntax-highlight own defined environments.

Example usage

\lstnewenvironments{myListing}{}{}
\begin{myListing}
VerbatimHighlighting here
\end{myListing}

Thoughts on implementation

Get the environment names from settings. Then reformat the user settings to a regex and write this regex to a file that can be included in grammars/latex.cson.

I think that verbatim environments and math environments are the environments that I would define myself (sometimes), and I suspect that these are the ones that are most common to define yourself (as opposed to lists, tikz, etc.)

kylebarron commented 6 years ago

It wouldn't be possible to do this dynamically based on the document's settings, but it would be possible to color \begin{env}...\end{env} for any value of env. But still, it would only color those keywords, and there would be no way to have special inside highlighting.

Strauman commented 6 years ago

@kylebarron I was not thinking about the document's settings, but the user settings of your amazing atom plugin. If it's not possible, then it's not possible :)