atom / autocomplete-snippets

Adds snippets to autocomplete+ suggestions
MIT License
46 stars 50 forks source link

Snippets not showing up #46

Open basarat opened 9 years ago

basarat commented 9 years ago

This is similar to https://github.com/atom-community/autocomplete-snippets/issues/30 But different in that no snippets show up:

Modifying the source code so that it logs the snips:

class SnippetsProvider
  selector: '*'

  getSuggestions: ({scopeDescriptor, prefix}) ->
    return unless prefix?.length
    scopeSnippets = atom.config.get('snippets', {scope: scopeDescriptor})
    snips = @findSuggestionsForPrefix(scopeSnippets, prefix)
    console.log(snips)
    return snips

  findSuggestionsForPrefix: (snippets, prefix) ->
    return [] unless snippets?

    for __, snippet of snippets when snippet.prefix.lastIndexOf(prefix, 0) isnt -1
      text: snippet.prefix
      replacementPrefix: prefix
      rightLabel: snippet.name

  onDidInsertSuggestion: ({editor}) ->
    atom.commands.dispatch(atom.views.getView(editor), 'snippets:expand')

They still don't show in the list:

image

I suspect this is because one is async (atom-typescript) and the other is not (autocomplete-snippets).

capaj commented 9 years ago

I don't have any in the autocomplete as well. Sucks badly.

benogle commented 9 years ago

Is this still an issue?

basarat commented 9 years ago

Is this still an issue?

yes.

image

joefitzgerald commented 9 years ago

Is your provider excluding lower priority providers?

basarat commented 9 years ago

Is your provider excluding lower priority providers?

Nope : https://github.com/TypeStrong/atom-typescript/blob/master/lib/main/atom/autoCompleteProvider.ts#L116-L273

benogle commented 9 years ago

@basarat using atom-typescript on atom typescript the snippets provider snippets showed up way at the bottom of the list for me (looks like you also have your own implementation of snippet completions in atom-typescript). I've updated the priorities in autocomplete-snippets so they show toward the top of the list now. Update ac+ and autocomplete-snippets, and let me know what you see.

basarat commented 9 years ago

@basarat using atom-typescript on atom typescript the snippets provider snippets showed up way at the bottom of the list for me

I just noticed this, indeed it does show in some cases (still at the bottom though, was the priority change pushed to apm?): image

However it doesn't show for others e.g. class:

image

drrmmng commented 7 years ago

Has this been fixed? Because there are still basic snippets that don't show up in my case. I think it is when a keyword with the same trigger exists.