Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with multiple backslashes #11

Open
Evpok opened this issue Jun 11, 2016 · 3 comments
Open

Issue with multiple backslashes #11

Evpok opened this issue Jun 11, 2016 · 3 comments
Labels

Comments

@Evpok
Copy link
Owner

Evpok commented Jun 11, 2016

The following

\\begin{enumerate}

is closed as if it was \begin{enumerate}. In other words, there is no distinction between a backslash beginning a macro and a backslash in a newline.

@Evpok Evpok added the wontfix label Jun 11, 2016
@Evpok
Copy link
Owner Author

Evpok commented Jun 11, 2016

TL;DR : give me a better regex engine and I'll fix it.

The current state of js regex engine doesn't allow lookbehinds, which is the only way I see of handling this without changing anything but the regex, using e.g. (?:(?<!\\)(?:\\\\)*)\\label{([^}]+)} to find actual instances of \label.

Another solution would be dirty manipulation of last match index, which I refuse to do. That would need too much refactoring, for no real benefit, as it seems unlikely anyone would actually mean to write \\label{...}.

@larkvi
Copy link

larkvi commented Jun 15, 2017

If you cannot tell whether there is a \ why not just have it autocomplete without the \?

I suppose it is a question of: if this cannot distinguish normal content typing and markup, why is it a better solution than not having it installed?

@Evpok
Copy link
Owner Author

Evpok commented Jun 16, 2017

If you cannot tell whether there is a \ why not just have it autocomplete without the ?
Because the command we are completing is \begin, an not e.g. an hypothetical \atbegin. It also (probably) speeds up the search for \begins.

I suppose it is a question of: if this cannot distinguish normal content typing and markup, why is it a better solution than not having it installed?
I fail to see your point

  • There is arguably no distinction between “content typing” and “markup” in LaTeX.
  • This issue is with an improbable line break followed by the literal word “begin” and something between braces, with no space between them. This is very unlikely to appear legitimately in a LaTeX document, so there is no real issue there.
  • The main point of this package is to close environments automatically, which it does reasonably well. That makes it a better solution to me than not having it installed. See what works for you.
  • This package provides autocompletion for a couple of other commands, however, mostly due to LaTeX nature, it is very hard to provide autocompletion for arbitrary commands, so the coverage is limited
  • I don't have much time to spare, so for the foreseeable future, this package will stay more or less in its current state, unless someone steps up and add support for more things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants