Sublime Forum

Launch Dropdown list from Snippet

#1

Hey there,
I am not sure if I am at the right place for this question, but couldn’t find any hint in the web. I am using ST3 for programming as well as for LaTex writing. Since I am on german keyboard, and Latex have a lot of constructions with backslash and this ones: ‘{}’, to implement a simple citation (\cite{#}) is quit complicated finger gymnastics. So this is why I wrote a cite snippet, but the very handy dropdown list of all labels in the documents isn’t launched in contrast if I am writing it by hand. So the question is, is there a command to launch it, or to send a key to the keyboard ({) which would trigger the list as well or any other idea how to launch the dropdown list?

Thanks
benni

0 Likes

#2

The completion panel can be called manually by ctrl+space.

Setting "auto_complete_with_fields": true in the Preferences.sublime-settings the completion panel is triggerd automatically within a snippet’s field by simply start typing.

<snippet>
    <content><![CDATA[\cite{$1}$0]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>cite</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>text.tex</scope>
</snippet>
0 Likes

#3

Dear all,

thanks for the answer. I set "auto_complete_with_fields": true but still, by triggering the snippet, the completion panel is not shown. I can call it manually as described.
Beside this the completion panel is not as it is shown by LATEXTools but seems to be just differently rendered?!
So I am still loking for a automatically opening completion panel…

0 Likes

#4

… Beside this the completion panel is not as it is shown by LATEXTools …

Sublime Text provides only one completion panel, but there are 4 possible sources of content.

  1. a plugin (like LATEXTools)
  2. snippets (*.sublime-snippet)
  3. static completions (*.sublime-completions)
  4. words, ST picked from up from the view

1. to 3. respect the current scope of where your caret is located at the moment to be able to provide more or less context sensitive suggestions. So what you see most likely means LATEXTools doesn’t have anything to offer at this point, which causes word completions (4.) to be triggered only.

… but still, by triggering the snippe …

ST does not automatically trigger the auto-completion when moving the caret into a field of a snippet. You’d need to start typing to trigger the completion panel.

Furthermore auto-completion triggers can be defined globally (Preferences.sublime-settings) or on a per syntax (<SyntaxName>.sublime-settings), but this won’t help here.

	"auto_complete_triggers":
	[
		{
			"characters": ".",
			"selector": "source.python"
		}
	],

I am not sure whether a plugin could trigger the auto_completion command after a snippet was inserted or the caret moved to a field within the added snippet.

0 Likes