SublimeText-Markdown / MarkdownEditing

Powerful Markdown package for Sublime Text with better syntax understanding and good color schemes.
MIT License
3.19k stars 647 forks source link

Remove HTML Tab Completion #229

Closed shanemgrey closed 3 years ago

shanemgrey commented 9 years ago

When I have the syntax set to Markdown in any of the flavors, ST3 (3065) applies the available tab completions as if my .md file is .html.

For example, type the word "details" and hit tab or enter and it inserts a snippet. (this example may be html5 only, but other html examples like br also have this behaviour.

I have Markdown Editing and MarkdownPreview installed.

I'm not sure this is a MarkdownEditing issue, a ST3 issue, or a config issue on my setup. But I can't find any forum etc for this plugin, so added it here.

The .txt doesn't offer html tab completions.

Is there a way to turn this off for this file type? Or better yet, give it tab completions of it's own?

felixhao28 commented 9 years ago

It actually makes sense because markdown is initially designed for making web pages, so markdown is considered as a sub scope of html. It is not a ST3 issue or a config issue on your side. It is a designed behavior of this plugin.

However, if this really troubles you, the only workaround I can think of is to turn off the tab completion globally.

Providing a markdown specific completion sounds like an interesting idea though.

damiendr commented 6 years ago

This has bugged me for ages too. I use markdown to write text that isn't web pages, and HTML completions keep popping up when I want unicode completions — for instance \pi completes to <picture></picture> instead of π.

Here's a workaround. Extract the HTML package and open the file html_completions.py:

    def on_query_completions(self, view, prefix, locations):
        # Only trigger within HTML
        if not view.match_selector(locations[0], "text.html - source"):
            return []

This matches all HTML that isn't tagged as source. Let's exclude markdown too:

if not view.match_selector(locations[0], "text.html - source - text.html.markdown"):

And voilà.

Tagirijus commented 5 years ago

Thanks for the help. I still had some issues that inside Markdown other auto_complete stuff was happening. I found out that the package SublimeCodeIntel was causing it. I managed to disable autocompletion for Markdown by adding this into my user settings for SublimeCodeIntel:

"codeintel_exclude_scopes_from_complete_triggers": ["comment", "markdown"],

Hope this might help someone, who might have a similar problem like I did. (-;

deathaxe commented 3 years ago

As of ST4107 default HTML completions are disabled in Markdown.

It can be configured via syntax specific setting in 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"
    ]