-
Notifications
You must be signed in to change notification settings - Fork 14
Settings
Set project directory for completions ot a sub folder in sublime project folder. This will deny any caching or
completion of folders outside this folder.
i.e. "project_directory": "dev/src"
Default base directory to use if set in trigger.
i.e. "base_directory": "dev/src"
will be used for relative or absolute filepath completions if scope-property
scope: { "base_directory": true}
.
Whenever Sublime Text queries completion suggestions, FuzzyFilePath will propose filepaths if the current query meets its requirements.
This may conflict with other plugins. Set "disable_autocompletions": true
to disable this automatic behaviour.
Set "disable_keymap_actions": true
to disable all FuzzyFilePath commands triggered by shortcuts. Default shortcut definitions are
found in Sublime Text | Preferences | Package Settings | FuzzyFilePath | KeyBinding - Default. This may prevent conflicts with
other plugins.
Skips scanning of given folders. This improves performance on startup (read files) and queries (filter file list).
Folders are checked via regex, thus you need to escape all regex characters.
i.e. "exclude_folders": ["node\\_modules]
will ignore all files and folders in node_modules (highly recommended).
Each object in scopes
triggers a specific configuration for filepaths completions. Objects are iterated in the given
order for the current scope
-regex. If it matches the current scope, its configuration is used for filepath suggestions
and insertions. i.e.
"scopes": [
{
// trigger
},
{
// next trigger
}
]
Trigger properties are as follows:
A regular expression to test the current scope. In order to escape a regex character two backslashes are required: \\.
.
To lookup a scope within your source code, press alt+super+p
. The current scope will be displayed in Sublime Text's
status bar.
i.e. The following rule will apply for strings in javascript scope
// trigger
{
"scope": "string.*\\.js"
}
The scope selection may be further restricted by theese properties. Since scope settings are not easily adjusted, following variables are retrieved from the current context (cursor position and line):
- The prefix is any string before the matched query. Mostly any string before an
=
,:
or(
- The style is a string before the prefix, separated by a
:
- The tagName is set with
<tagName ... 'query'
Examples
-
<img src="./assets/logo.png">
results in{"prefix": "src", "tagName": "img"}
-
'"property-name": url(./assets/logo.png)'
results in{"prefix": "url", "style": "property-name"}
and -
from 'component'
results in{"prefix": "from"}
Any unspecified property will be ignored.
If "auto": false
the specified configuration will only be triggered by shortcuts.
Sets the type of the path to insert. If "relative": true
paths will be inserted relative to the given file. Else
filepaths are inserted absolute to the project folder. This option may also be set by
key commands for insert_path. Note: option relative will be overwritten if the string
starts with /
, ./
or ../
.
The base_directory property will adjust the base path from which the filepath is resolved. This is true for
relative and absolute paths. If "base_directory": true
paths will be resolved from the default base_directory
given in main settings. If "base_directory": "/dev/src"
, any paths matching this scope-item are resolved by
/dev/src
.
i.e. if the file in /dev/src/components/index.js
is inserted absolute, the final path will be
/components/index.js
This will further filter proposed files for this scope (based on extensionsToSuggest
).
i.e. "extensions": ["js", "json"]
will only list javascript or json files.
An array containing substitutions for the inserted path. After a selected filepath completion is inserted,
the path may be further adjusted. Each item within replace_on_insert must be another array like
[Search:RegExp, Replace:RegExp]
. Use cases:
- If the project path varies, it may be adjusted for the current scope with
["\\/base\\_path\\/module", "vendor"]
. - In NodeJs index files are resolved by default, thus set
["index$", ""]
to resolve a selection of ../module/index.js to ../module - i.e. webpack may resolve paths differently. Thus if a bower component
is selected, but its folder is not required, the replacement:
["^[\\.\\./]*/bower_components/", ""]
will fix this.
This option may also be set by key commands for insert_path.
See Sublime Text | Preferences | Package Settings | FuzzyFilePath | Settings - Default for an up to date version
{
"disable_autocompletions": false,
"disable_keymap_actions": false,
"exclude_folders": ["node\\_modules"],
"scopes": [
{
"scope": "string.*\\.html$",
// match <div style="background: url(path/to/image)">
"auto": true,
"relative": true,
"base_directory": "path/to/base",
"extensions": ["png"],
"prefix": ["url"],
"style": ["background", "background-image"],
"tagName": ["div"]
},
{
"scope": "\\.js$",
// enable shortcuts 'insert_path' for all js languages
"auto": false,
"extensions": ["js", "json"],
"replace_on_insert": [
["^[\\.\\./]*/bower_components/", ""],
["index$", ""]
]
}
]
}
extensionsToSuggest:Array Valid filetypes are now retrieved from the extensions property of each scope entry.
insertExtension:Boolean Extensions should now be removed by replace_on_insert.
auto_trigger removed