Skip to content

Commit

Permalink
Adds per project settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiokr committed Jan 30, 2014
1 parent 4f5f891 commit 1bfefc4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1.0.0 - Jan 28, 2014

- First versioned release.
- Added support for per project configs.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,20 @@ The plugins comes configured to lookup Rails related files, but you can add your
The configuration has two parts: the key, which is a regular expression to match against the currently open file, and a list of globs to map the related files.

You can use the $1, $2, etc. on the glob strings to be replace by the extracted parts from the regex.

In addition to global configs, you can also have per project configs. To add that, in a sublime project file (project-name.sublime-project),
add this:


```json
{
"settings":
{
"RelatedFiles": {
"patterns": {
// you project patterns
}
}
}
}
```
9 changes: 8 additions & 1 deletion related_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ def __open_file(self, index):

# Retrieves the patterns from settings.
def __patterns(self):
return sublime.load_settings("RelatedFiles.sublime-settings").get('patterns')
# default settings
patterns = sublime.load_settings("RelatedFiles.sublime-settings").get('patterns').copy()

# per project settings
if sublime.active_window().active_view().settings().get('RelatedFiles'):
patterns.update(sublime.active_window().active_view().settings().get('RelatedFiles').get('patterns'))

return patterns

# Returns the activelly open file path from sublime.
def __active_file_path(self):
Expand Down

0 comments on commit 1bfefc4

Please sign in to comment.