Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Need api: disable FuzzyProvider, let typedText.length > 0 #90

Closed
yongkangchen opened this issue Jul 7, 2014 · 15 comments · Fixed by #186
Closed

Need api: disable FuzzyProvider, let typedText.length > 0 #90

yongkangchen opened this issue Jul 7, 2014 · 15 comments · Fixed by #186
Assignees
Milestone

Comments

@yongkangchen
Copy link
Contributor

yongkangchen/atom-ctags#3

1、I need a provider api to disable just FuzzyProvider
for reason is: atom-ctags auto update symbols when file save, there no need to enable FuzzyProvider. But still need autocomplete-snippets, so I can't use exclusive to exclusive all other provider.

2、I need a provider api to let typedText.length > 0 instead of typedText.length is 1 in autocomplete-view.coffee#L188
for reason is: when input (, bracket-matcher auto insert ), lead to typedText.length == 2, and I need autocomplete to show symbol for pre word which include function param.

@yongkangchen
Copy link
Contributor Author

urgly hack for now:

diff --git a/lib/autocomplete-view.coffee b/lib/autocomplete-view.coffee
index 3c4b5e1..d8ba104 100644
--- a/lib/autocomplete-view.coffee
+++ b/lib/autocomplete-view.coffee
@@ -26,7 +26,7 @@ class AutocompleteView extends SimpleSelectListView

     return if @currentFileBlacklisted()

-    @registerProvider new FuzzyProvider(@editorView)
+    # @registerProvider new FuzzyProvider(@editorView)

     @handleEvents()
     @setCurrentBuffer @editor.getBuffer()
@@ -185,7 +185,7 @@ class AutocompleteView extends SimpleSelectListView
   # e - The change {Event}
   onChanged: (e) =>
     typedText = e.newText.trim()
-    if typedText.length is 1 and atom.config.get "autocomplete-plus.enableAutoActivation"
+    if typedText.length > 0 and atom.config.get "autocomplete-plus.enableAutoActivation"
       @contentsModified()
     else
       # Don't refocus since we probably still have focus

@yongkangchen
Copy link
Contributor Author

atom-ctags-complete

@yongkangchen
Copy link
Contributor Author

Already find a way to disable FuzzProvider by yongkangchen/atom-ctags@ebcc61a

@joefitzgerald
Copy link
Contributor

Isn't that the purpose of an exclusive provider?

@yongkangchen
Copy link
Contributor Author

But still need autocomplete-snippets, so I can't use exclusive to exclusive all other provider. 😄

@yongkangchen
Copy link
Contributor Author

@joefitzgerald for the second need, do you have any ideal? I am finding a way about it.

@joefitzgerald
Copy link
Contributor

If we allowed a registering provider to optionally specify a list of grammars (including an "all" specified - "*"?) for which it wanted to have the built-in provider disabled, you could then use that in fuzzyprovider to avoid autocomplete for those grammars.

@yongkangchen
Copy link
Contributor Author

Good idea, but a little complex. For now, my hack: yongkangchen/atom-ctags@ebcc61a works well, even though not very graceful.

@joefitzgerald
Copy link
Contributor

Yeah but that is the nuclear option. The fuzzyprovider is dead for the remainder of the Atom session.

@joefitzgerald
Copy link
Contributor

I would much rather we don't encourage others to mess with the internals of autocomplete-plus, and instead provide a clean API to disable the fuzzyprovider when required

@yongkangchen
Copy link
Contributor Author

Agree with you.

@joefitzgerald joefitzgerald added this to the 2.0 milestone Dec 31, 2014
@joefitzgerald joefitzgerald self-assigned this Jan 19, 2015
@joefitzgerald
Copy link
Contributor

@yongkangchen Would it suffice to simply ensure atom-ctags and autocomplete-snippets suggestions are always more specific (and consequently higher in priority) than FuzzyProvider?

@apcshields
Copy link

@joefitzgerald I'd like to be able to disable FuzzyProvider without disabling all other providers as well, but I'd specifically like the user to be able to decide to disable it or not.

With an earlier version of autocomplete-plus, I could simply use a fork of autocomplete-plus which had FuzzyProvider stripped out. That way the user could install autocomplete-plus or not, or adjust the individual fileBlacklist settings of the two autocomplete engines so that they didn't overlap. This doesn't seem possible anymore (without significant inconvenient rewriting), since providers are expected to use the atom.services api.

I'm chiming in here because I think it's important that however this issue is resolved, the user be in control. I think most of the users of my provider don't want to see the default provider options at all, but some may, and some may want to see them in some contexts but not in others. My solution wasn't optimal, but it let the user decide whether and when they would be presented with the different options. Now that I'm migrating back to the stock autocomplete-plus, I'd still like to provide my users with that same configurability.

@joefitzgerald
Copy link
Contributor

👍 @apcshields: I'm going to provide two ways to suppress FuzzyProvider: 1) a preference to disable it entirely 2) a way for providers to add to a blacklist of selectors where the FuzzyProvider doesn't get used.

This provides flexibility for the user and provider authors.

@apcshields
Copy link

Great!

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

Successfully merging a pull request may close this issue.

3 participants