SublimeText-Markdown / MarkdownEditing

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

Tab autocomplete of extant words does not work #761

Closed reagle closed 3 months ago

reagle commented 4 months ago

When I'm editing markdown files, I can't tab autocomplete on existing words in the document; I assume this should be possible. In my Preferences.sublime-settings I have:

    "auto_complete_commit_on_tab": true,
    "auto_complete_delay": 500,

In Markdown.sublime-settings I have:

    "auto_complete_selector": "source, text",

I assume text.html.markdown is within text, so I probably don't need this. And if I add text.html.markdown specifically, I still can't tab autocomplete. So this is probably a red herring.

I don't know if this is related to the old issue #128 .

ST4 4169, MDE 3.1.12

reagle commented 4 months ago

BTW: Installing AllAutocomplete seems to enable tab autocompletion in markdown files?!?

deathaxe commented 4 months ago

I don't see anything misbehaving, neither on my normal production setup nor on a clean ST4169 with only Package Control and MarkdownEditing installed. I am on Windows.

I tried to reproduce with a new unsaved MD view with "lorem ipsum" snippet inserted. Typing existing words auto-completes them on pressing tab as expected. Same with an existing README.md

You could enable command logging by executing sublime.log_commands() in ST's console to see which command is executed, when pressing tab.

With your settings, I see...

command: auto_complete {"commit_single": true, "default": "\t", "mini": true}
command: commit_completion

An autocomplete panel opens with various words from buffer, when hitting tab after a started word, with another tab completing with first selected item.

reagle commented 4 months ago

I just tried and I too can autocomplete on trivial test markdown files. I just tried to create a minimal defective example here: https://reagle.org/joseph/2024/rah/autocomplete-test.md . I suspect it has to do with YAML front matter; when it is present I'm not able to autocomplete the word "subreddit". In the log, I see lingo/sublime-fscompletion is being invoked. So, somehow, the YAML frontmatter confuses FSAutocompletion? That hasn't been updated in years, so I'll uninstall that for now.

>>> sublime.log_commands()
FSAutocompletion: get_view_cwd: folder found {'file_exclude_patterns': ['*.docx', '*.html', '*.mm', '*.pdf', '*.yaml', '*.zip', '*.zst'], 'name': 'Reddit advice history', 'path': '/Users/reagle/e/clear/data/2web/reagle.org/joseph/2024/rah'}
get_view_cwd: <function get_cwd_from_project at 0x1074ad2f0> => /Users/reagle/e/clear/data/2web/reagle.org/joseph/2024/rah
deathaxe commented 4 months ago

I also see those entries, but still everything works with your minimal example and sublime-fscompletion installed.

EDIT: It seems to interfere in case it thinks the word being completed is part of a folder or path. Maybe you have a folder named "Subreddits" or something along those lines in your project?

That's nothing MarkdownEditing can fix.

reagle commented 4 months ago

Huh. I feel like having MarkdownEditing, fscompletion, AllAutocomplete, and EnhanceSnippets is a precarious pile of completion plugins but having the four of them seems to work now, at least. I'll close this and return if I gain other insights.