The autocomplete popup is not showing in html files. However, the tab completion works just fine…
It works fine in python files. Any suggestions?
The autocomplete popup is not showing in html files. However, the tab completion works just fine…
It works fine in python files. Any suggestions?
Can you describe a situation you’re seeing where you would expect the popup to appear
but it doesn’t?
By default, the autocomplete popup appears in HTML, but not everywhere. For example, if you type <d
you should get a popup for tags that start with d
:
Or, while you’re inside of a tag, the autocomplete should appear when you’re typing the names of tag attributes:
If those sorts of things don’t work, then I would double check that the syntax for the current file is set to HTML and that you don’t have a package that might be getting in the way.
Hey @OdatNurd, thanks for replying!
I am not seeing the popup in any scenario. Not for word completion nor for snippet completion.
For example, say I have an .html file with “blabla123 and blabla456” written in it. After typing “blabla”, the popup should appear, showing me options to autocomplete to “blabla123” or “blabla456”. As far as snippets go, when typing “html”, there should be a popup menu showing me there’s a snippet for that word, that expands to " bla bla"…
The filetype is corretly set to .html. The thing is that even though the popup is not showing, the tab completion works just fine. In the above examples I gave, I can just click on tab and it will autocomplete or expand the snippet…
I don’t have any packages that are causing this.
I do have this in the user settings:
{
"auto_complete_selector": "meta.tag - punctuation.definition.tag.begin, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc, text.tex, - ",
"auto_complete_triggers":
[
{
"characters": ".",
"selector": "source.python"
}
],
Is there anything there that jumps to the eye as a possible cause?
The default values for the settings you describe are set up specifically to only show autocomplete inside of HTML files at the points where I outlined above; in response to typing <
and in tag attributes but not inside of the file content in general since having autocomplete appear every time you type a word can be overpowering.
The default value for auto_complete_triggers
is:
// Additional situations to trigger auto complete
"auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],
That makes the autocomplete open when you press the <
key, prompting you to enter a tag name. Your version of the setting doesn’t include it, so that won’t happen for you, and instead you’d have to enter <
and then press the first character of a tag name to get suggestions for tags that start with that character. If you’d like that to happen, add {"selector": "text.html", "characters": "<"}
to the list in your own version of the setting.
The auto_complete_selector
setting controls where autocomplete happens automatically; the default value for that is:
// Controls what scopes auto complete will be triggered in
"auto_complete_selector": "meta.tag - punctuation.definition.tag.begin, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
This makes the panel open up automatically:
<
or <!
)Specifically, the scope for HTML files is generally text.html
, and text
doesn’t appear in the default setting, so the autocomplete panel doesn’t open inside of any sort of text file (plain text, HTML, Markdown files, etc).
Your version of the file above has added text.tex
to the list, so autocomplete will work there. If you want it to also work in HTML files, you need to add ,text.html
to the setting.
That trailing , -
seems wrong; it’s trying to exclude things from the scope but it’s not specifying any. I would try removing that part (or replacing it with text.html
) and verify that everything still works the way you want.
If you’re generally unfamiliar, this video on scopes and scope selectors provides background on the topic.