Easily add triggers to FFP settings
In sublime, there's a FuzzyFilePath.sublime-settings in Packages/User/. When try to add more triggers to FFP, like to make settings file:
{
"scopes": [
{
// js - *.src = ""
"scope": "source\\.js.*string",
"prefix": ["src"],
"auto": true,
"base_directory": true,
"extensions": ["js", "png", "gif", "jpg", "jpeg"],
"relative": true
},
{
"scope": "\\.python",
"extensions": ["py"],
"auto": true,
"prefix": ["from", "import"],
"relative": false,
"replace_on_insert": [
["^\\/", ""], // remove first slash
["\\/", "."], // replace slashed by dots
["^(.*)\\.py$", ""], // remove file extension
]
}
]
}
then it would overwrite the original scopes setting, and all that works are just js and py. To make it function like before, you should manually copy all the scopes from original settings file to the user one.
Is there a better way to add triggers to the scopes but not just completely overwrite it?
The problem with merging the default scope arrays is
- the number of triggers is growing large, which may result in poor performance since they must be filtered in each view (especially triggers, which are never used, i.e. website project and php-triggers)
- the remaining triggers must all be checked for the current cursor context (each time you type, except the filetype is unknown)
- overwriting triggers for customization is not possible and results in a larger scope list
Performance is critical for any auto-completion task and a manual copy offers complete control of what is validated. But i see the pain and could offer another array for custom triggers, which would still enable modifying the set of base-triggers. Something like
{
"scopes": [
// default list of triggers
],
"custom-scopes": [
// your own set of scopes, which will be merged with "scopes"-array, being first in resulting list
]
}
Any other ideas are welcome.
@sagold This should be good. Hopefully user could replace or overwrite one or some of the default scope settings in the custom-scopes.