Sublime Forum

Autocomplete/snippet conflict

#1

I’m having issues with autocompletion in Sublime, and I want to check whether the problem is that I’m still stuck in a TextMate mindset or whether it’s actually an interface issue.

The problem is that autocomplete and snippet completion are both bound to but often conflict. As a simple example, in a Ruby document:

    def<Tab>run

gives me the following code, with the cursor at the indicated point:

    def run❚
      
    end

Now, in most places in the document, hitting at the current cursor position would autocomplete run to running_process (assuming that phrase is the closest available match, which in this case it is). But because I’m still in “snippet mode”, the actually skips me to the method body:

    def run
      ❚
    end

There seems to be no way to choose indicate to Sublime that I want to use autocomplete at that point. In Textmate this wasn’t an issue because was reserved for snippets and was the autocomplete trigger - which makes sense to me, because two features which might be available at the same time shouldn’t share the same key.

Is there a way to change one of these triggers to a different key, or do I need to change how I’m thinking somehow?

0 Likes

Bug with python completer
#2

Changing the file setting auto_complete_with_fields to true would enable you to complete an auto-completion/snippet while within a snippet.

[code] // By default, auto complete will commit the current completion on enter.
// This setting can be used to make it complete on tab instead.
// Completing on tab is generally a superior option, as it removes
// ambiguity between committing the completion and inserting a newline.
“auto_complete_commit_on_tab”: false,

// Controls if auto complete is shown when snippet fields are active.
// Only relevant if auto_complete_commit_on_tab is true.
"auto_complete_with_fields": false,[/code]

You may need to press Ctrl-Space to display the completions list, and then use Enter (rather than Tab) to select one of the new completions.

Alternatively, having typed ‘run’ and Tab, press Escape to escape from the snippet fields - then Tab (once or twice) might select ‘running_thing’.

0 Likes

#3

I seem to be having a different kind of conflict.
I have a snippet with:<tabTrigger>@Br</tabTrigger> and an auto-complete:{ "trigger": "@Break($1)", "contents": "Break($1)" },
When I type: @Br the auto-complete window comes up and then hitting tab chooses the auto complete over the snippet. The docs say:

which is the case, but the Snippet seems to be losing to the auto-complete.

Other than turning auto-complete off or increasing the delay on the auto-complete window, no combination of the preferences regarding tab-completion seem to fix this problem for me. I realize it’s a bit of a weird case but I’d really rather not change the tabTrigger for my snippet if I can avoid it. I feel like I must be missing something pretty obvious but for the life of me I can’t figure it out. Any suggestions?

0 Likes