Sublime Forum

ST4 - Reinstate HTML tag autocompletions for MD syntax?

#1

Hi there. It is early days, but I am greatly enjoying ST4.

One thing that troubles me however, is the new autocomplete engine, when editing Markdown files.

Previously, if a typed “a” then hit tab, it would autocomplete the HTML tag:
<a href="|"></a>

Now, it simply suggest a list of words that start with, or contain the letter “a”

Similarly for other HTML tags - p, br, div etc.

How do I reconfigure it to preferentially use the HTML autocompletions FIRST (I’d be quite happy to keep the text suggestions, but lower down)

Thanks in advance.

0 Likes

#2

You may want to tweak it via syntax specific settings (Packages/User/HTML.sublime-settings) to reanable html like completions within markdown files.

This is the current default from Packages/HTML/HTML.sublime-settings

{
    // Controls what scopes default completions will be provided in.
    // Can be a list of strings which are joined before matching.
    "default_completions_selector": [
        // Plain HTML
        "text.html - source - string - text.html.markdown, ",
        // Embedded HTML blocks
        "text.html.embedded - text.html.embedded source, ",
        // Markdown fenced code blocks
        "markup.raw.code-fence text.html - markup.raw.code-fence text.html source"
    ]
}

To enable html completions in Markdown you may override it in Packages/User/HTML.sublime-settings with

{
    // Controls what scopes default completions will be provided in.
    // Can be a list of strings which are joined before matching.
    "default_completions_selector": "text.html - source - string"
}
0 Likes

#3

Thanks @deathaxe for your prompt reply. This seemed to work … sort of.

It still does not autosuggest the anchor tag if I simply type “a” (as it previously did), but will now do so if I type “<a”.

I guess I’ll need to retrain my brain.

Thanks again.

0 Likes

#4

The change with <a is intented to prevent tags from being completed when normal words are meant. I personally didn’t like the html completions in Markdown as it often caused tags from being added when words are intended. I use mardown to prevent bothering with html, while I see why someone might need it sometimes.

I find typing < to start a tag more natural than just typing a tag name.

Funnies thing is typing “html” and hitting tab somewhere in the middle of markdown resulting in the whole html boilerplate being added.

0 Likes