j0rd1smit / obsidian-copilot-auto-completion

MIT License
92 stars 10 forks source link

Compatibility with Outliner Plugin #41

Open torbenkeller opened 2 weeks ago

torbenkeller commented 2 weeks ago

I use the Outlinier Plugin to get a better user experience modifying lists. Unfortunately it also binds ⇥ to indent a bullet point one level more. Now when I want to accept the prediction in an unordered list with ⇥ the bullet point will move and the prediction stays unaccepted. Would be awesome if acception the prediction would get a higher precedence than moving the bullet point

j0rd1smit commented 2 weeks ago

We are both using something like:

Prec.highest(  
    keymap.of([  
        {  
            key: "Tab",  
            run: ...  
        },  
    ]),  
),  

We are both binding the Tab key to our custom behavior and giving ourselves the highest priority. This creates a conflict. Unfortunately, this is not something I can fix.

However, you could adjust which plugin wins the race by changingt he loading order. You can change this order in the .obsidian/community-plugins.json. Try playing around with this and see if it fixes your problem.

torbenkeller commented 2 weeks ago

Thank you for the explanation! When I reordered the .obsidian/community-plugins.json and placed the auto completion plugin before outliner, I can accept completions in unordered lists. But now adding indention levels to list items doesn't work anymore, even if there is no completion to accept. Is there a way to only bind the key when a completion can be accepted?

j0rd1smit commented 2 weeks ago

I'm not sure why this is. My code checks if it is in the suggested state. If not, it returns false, which means, according to the doc: Screenshot 2024-06-19 at 16 20 11

So then it should go to the other plugins. I'm not sure how they handle this. So I don't think this can be fixed nicely.

However, you could try accepting the suggestion not with the tab, but when a suggestion is there, open the command pallet and search for the copilot accept command. This should be inserted. (Additionally, you can bind this to another hot key if you want.)