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

Some snippets doesn't work #120

Open
wtrtony opened this issue Feb 26, 2017 · 5 comments
Open

Some snippets doesn't work #120

wtrtony opened this issue Feb 26, 2017 · 5 comments
Labels

Comments

@wtrtony
Copy link

wtrtony commented Feb 26, 2017

Some snippets doesn't work. Like "frac","it",ect.
image
image

It's a .tex file in latex.

@Aerijo
Copy link
Collaborator

Aerijo commented Jul 17, 2017

No math snippets work because mathmode is a string environment with this package, and strings don't get considered for snippets by the autocomplete-snippet package. See atom/autocomplete-snippets#55 and atom/autocomplete-snippets@28a0af0.

In fact, these snippets shouldn't have been working for a couple of years now.

@Aerijo
Copy link
Collaborator

Aerijo commented Aug 4, 2017

A workaround is to run the command apm develop autocomplete-snippets and edit the new local version of the package it installs in the following way:

Go to the new package it made (try ~/github/<package>), open lib/snippets-provider.coffee, and change line 4 to disableForSelector: '.comment'.

Now go to your .atom folder, into dev/packages. You should see a linked folder to autocomplete-snippets. Move this link to the normal packages folder (.atom/packages).

Having done this, the next time you load Atom it will use the local version of the autocomplete-snippets package you made, as opposed to the normal version. This should allow snippets to be used in mathmode. If this still doesn't work, go to .atom/packages/language-latex/snippets/language-latex.cson and change line 71 to '.text.tex.latex, .string.other.math': (I inserted a comma; this fixed an issue I was having. It may also be needed on line 114).

If you (or someone else reading this) get stuck, let me know where. For updates on when the snippets package itself will implement this, subscribe to atom/autocomplete-snippets#77.

@Antzy21
Copy link

Antzy21 commented Nov 16, 2017

@Aerijo Hey! This math mode snippets thing is really annoying. I've been following your interest in the matter and you're definitely the guy who knows what they're doing. Thank you for trying to fix this for us!
It looks like the overarching snippet problem isn't going to get fixed, the user trying to sort it has given up, as you found. I'm wondering if you've had anything new pop up since you last posted in August?

Cheers for the hard work on the topic!

@Aerijo
Copy link
Collaborator

Aerijo commented Nov 26, 2017

@Antzy21 I think the math scope will eventually be changed to markup in version2 (see #137), which should be allowed by autocomplete-snippets.

The real issue with autocomplete-snippets is that they want changes to the disabled scopes to be in effect immediately, but it seems autocomplete-plus will only make the changes after restarting atom. Therefore, the issue seems to be in how autocomplete-plus handles the disableForSelector key (provider documentation here)

As a workaround / side project I've been making an autocomplete-latex package which would do (more or less) the same thing as the snippets. There is already a latex-autocomplete package, but it doesn't offer the completions and snippets I would expect. Note it's not published yet, as I'm still working on some parts.

@Aerijo
Copy link
Collaborator

Aerijo commented Dec 16, 2017

It's available now, for anyone interested. Feel free to make a PR with more default commands that everybody could appreciate.

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

4 participants