-
Notifications
You must be signed in to change notification settings - Fork 47
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
Trigger of the Snippets #119
Comments
I agree completely - I spend a lot of energy deciding whether to type "begin" or "\begin" depending on whether I want matching or not. I could save a lot of time by always typing "\begin". |
Not to mention that latex is all about typing English. The word "begin" (and other snippet starters) could come up a lot, and it is annoying to see the snippet suggestion every time. Restricting it to when the backslash character is used will prevent this, and be more consistent with author's habits. |
@clsmt I now realise why they are this way: the autocomplete-snippets package does not support punctuation in snippet prefixs. If you want a workaround for this issue, do the following
I will try and get this behaviour working by default, but I don't know much about hacking Atom yet. The developers of the |
I DO agree with including backslashes to snippet trigger. However, as can be seen in atom/autocomplete-snippets#67, snippets starting with non-letter are not autocompleted (snippet itself should work). That's why we can't do that. |
This feature would be nice, but would have to be done by the |
@Aerijo Hi! The autocomplete-snippet package has been update and the problem cannot be solved using the solution you provided. Any advice on how to fix it now? |
@Goysa2
EDIT: My bad, I thought you were saying the issue was resolved. For the solution I provided, it seems I had a typo in it. Additionally, they have now converted to JavaScript (form CoffeeScript). A better set of steps would be:
getSuggestions({scopeDescriptor, editor, bufferPosition}) {
let prefix = this.getPrefix(editor, bufferPosition)
if (!(prefix != null ? prefix.length : undefined)) { return }
const scopeSnippets = this.snippetsSource.snippetsForScopes(scopeDescriptor)
return this.findSuggestionsForPrefix(scopeSnippets, prefix)
}
getPrefix(editor, bufferPosition) {
let regex = /[\w0-9\-\_\\]+$/
let line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])
let match = line.match(regex)
return match ? match[0] : ''
}
|
I have been using this package for a while now. And I am bothered by this issue more and more.
I would strongly recommend using
\begin
as trigger as opposed to justbegin
.We are very used to type
\begin{equation}
to start an equation. It would make sense that now we just have to type\be
... and\begin
pops up as an option. Now anenter
produce the full equation commands.But as of now, when I type
\begin
,\begin{equation}
pops up, and anenter
would produce something like\\begin
. I have to go back and erase the first\
.Sure, if you are used to just
begin
giving you\begin
, it saves you a character, but experienced latex writers would have to change their habit. If god forbidden they later on have to use other editors (for example writing something online) for latex, they have to change their habit again. What a pain.The text was updated successfully, but these errors were encountered: