Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easily add triggers to FFP settings #19

Open
Z-Clive opened this issue Oct 16, 2015 · 2 comments
Open

Easily add triggers to FFP settings #19

Z-Clive opened this issue Oct 16, 2015 · 2 comments

Comments

@Z-Clive
Copy link

Z-Clive commented Oct 16, 2015

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?

@sagold
Copy link
Owner

sagold commented Oct 17, 2015

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.

@Z-Clive
Copy link
Author

Z-Clive commented Oct 17, 2015

@sagold This should be good. Hopefully user could replace or overwrite one or some of the default scope settings in the custom-scopes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants