ipatalas / vscode-postfix-ts

Postfix notation for TypeScript/Javascript - extension for VS Code
MIT License
159 stars 43 forks source link

question: How to disable built-in postfix snippet ? #40

Closed shawn-yee closed 2 years ago

shawn-yee commented 3 years ago

I want to use my custom if/for/while.. snippet But built-in postfix snippet has high priority,so that i have to select my custom snippet every time.

ipatalas commented 3 years ago

Try changing that option: image

By default it was set to inline while what you are probably expecting is top.

Completion items from extensions do not have priority that could be overridden. It's VS Code mechanics which decides what to show where and this option is responsible for that I believe.

Let me know if that helps.

shawn-yee commented 3 years ago

Thank you for answering my question. Changing the order of the custom snippets to top is not a good idea, because it causes all variable's properties and methods to be sorted to the end. Custom snippets are optional, so I sort them last. I would like you to provide an option to disable the built-in suffix snippets, which is probably a rare requirement, but I think it would be valuable for those who like to customize.

ipatalas commented 3 years ago

Ok, so now I got confused. Which snippets do you want to disable? The ones from my extension or the one that you can write on your own? Can you show an example?

MoYuM commented 3 years ago

i think his mean is that he wants the one write on his own.

i have same question, the original log template is not good enough for me, so i made a new log template like this

{
            "name": "log",
            "description": "log a value with it name and current line index",
            "body": "console.log('${TM_LINE_NUMBER}:{{expr}} ========>', {{expr}});",
            "when": []
},

now i do not need original log template any more, i want it disappear in my suggestions, and the other templates will not be influenced

ipatalas commented 3 years ago

Oh.. I get it now. That should be easy to do.

ipatalas commented 3 years ago

See new postfix.customTemplate.mergeMode option in just released version. When changed to override it will drop built-in templates with the same name as custom templates.