سؤال

Say I have 2 files:

foo
bar
baz

and

123
456
f[want autocomplete here]

If I type 1 in the 2nd file, Sublime will suggest 123. But if I type f it wont suggest anything. I want it to suggest foo like it would if I were inside the first file.

It seems like this should be simple (each buffer can autocomplete, so searching all of them can't be so hard) but I haven't been able to find a plugin that does this.

هل كانت مفيدة؟

المحلول 2

I wrote a plugin that does this:

import sublime_plugin, sublime

class AutocompleteAll(sublime_plugin.EventListener):

    def on_query_completions(self, view, prefix, locations):
        window = sublime.active_window()
        # get results from each tab
        results = [v.extract_completions(prefix) for v in window.views() if v.buffer_id() != view.buffer_id()]
        results = [(item,item) for sublist in results for item in sublist] #flatten
        results = list(set(results)) # make unique
        results.sort() # sort
        return results

نصائح أخرى

I've implemented the same idea and published it as a package so it can be installed directly from within Sublime with Package Control:

Press ctrl+shift+p (Windows, Linux) or cmd+shift+p (OS X) to open the Command Pallete. Start typing 'install' to select 'Package Control: Install Package', then search for AllAutocomplete and select it.

Code is here: https://github.com/alienhard/SublimeAllAutocomplete

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top