-
Notifications
You must be signed in to change notification settings - Fork 100
snippet not working without spaces between characters #272
Comments
I have a similar issue in HTML mode: For instance, if I expand a |
@axe-z, here’s the issue (merely describing, not defending current behavior): When you hit Tab to expand, the snippets package figures out what the current prefix is based on the cursor position and the characters that precede the cursor.
When your cursor is here, the “word prefix” is rather clearly
When your cursor is here, the “word prefix” is interpreted by Atom to be This determination is made by Cursor#getBeginningOfCurrentWordPosition, and the decision about what constitutes a “word” is determined internally to this method depending on what scope(s) the cursor is in. My snippet for an arrow function is For a moment I thought I’d found an elegant fix to this, one that would allow the snippets package to invoke a So I’ll have to meditate on this, and perhaps I’ll throw these corner cases at other editors and see how they’re handled. @jonkri, haven’t tried your example yet, but since your snippet has an alphanumeric prefix, I think it’s probably not the same underlying cause. I’ll let you know. |
@jonkri, your issue is different. The So <p>^</p> …because the scope includes However, the snippet does work when there are spaces around the cursor… <p> ^ </p> …because the scope no longer includes In your case, I think you’d be able to work around this by putting this into your
In theory, that ought to take precedence over the config in |
Well it's even worst in jsx code: AGAIN dot dot .. is my arrow FN snippet Also when entering lets say:
( ... is an other arrow FN snippet , same goes if .. ) And pressing ctrl-space to get the snippet menu, both bracket are now gone :
snippets in jsx are not working well thing is creating {.. as a snippet is nowhere near as convenient . This works in other IDE. if I type: TEST.. the snippets works ! It's not about space. I get TEST() => |
Now that I understand this better, I’m closing it because it’s a duplicate of #151. This bug is on my radar. |
@savetheclocktower: Thanks a lot! Have a great weekend! :) |
<!latest, every version:
been ussing Atom for 5 years now, I've waited long enough ;)
ex:
.. is my snippet for an arrow FN in js.
I type :
setTimeout()
then want a function in there:
setTimeout(..) , hit tab, nothing 👎
I go back
put spaces between:
setTimeout( .. ) hit tab:
I finally get
setTimeout( () => )
fix the unwanted space:
setTimeout(() => )
Got it !!
if Bracket can do this right, there is no way Atom should have issues with this.
The text was updated successfully, but these errors were encountered: