简体   繁体   English

片段的VSCode文档选择器

[英]VSCode Document Selector for snippets

Is there a way to filter the suggested snippets regarding the file path name? 有没有办法过滤有关文件路径名的建议片段?

This could be similar to pattern parameter for the Document Selector API . 这可能类似于Document Selector API的 pattern参数。

For example, I would like to suggest only snippets for Model if the current file path matches the pattern "**models**" , eg: 例如,如果当前文件路径与模式"**models**"匹配,我想建议Model片段,例如:

  • src/prj/some_app/models.py
  • src/prj/some_app/models/pizzas.py

This is not possible using user snippets as of VS Code 1.25 从VS Code 1.25开始,这不可能使用用户代码段

However an extension could provide these types of dynamic snippets by implementing a CompletionItemProvider that contributes the snippets 但是,扩展可以通过实现提供片段的CompletionItemProvider来提供这些类型的动态片段

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM