atom / symbols-view

Jump to symbols in Atom
MIT License
163 stars 114 forks source link

Issue #77 Allow end-user configuration of tags path relative to project root #137

Open mshenfield opened 8 years ago

mshenfield commented 8 years ago

Allow user to specify the directory, relative to the root of each project open within Atom, where symbols-view looks for the tags file, using the tagsDirectory config variable. This closes #77 and is a step towards

127.

This only effects toggle-project-symbols. The impetus behind this commit is to allow popular confirations, such as storing tags files in the .git directory, to work. The change required additional information on each tag object, mainly specifiying the path of the project the tag was generated for. This was to a) easily display the project directory when multiple projects were open and b) to programatically resolve the full path of the symbol's file when generating symbols relative to root.

This also required adding a configuration variable tagsDirectory, which should be a directory relative to the project root that contains the tags file.

Also refactored the reloadTags method inside of watchTagsFiles into a separate instance method, with a different name (triggerReloadTags) so that it didn't shadow the instance attribute reloadTags, and could be used in the configuration watcher for the new tagsDirectory configuration variable.

Added an appropriate test to run toggle-project-symbols with a relative tagsDirectory config set.

mshenfield commented 8 years ago

I feel like there is an implied AtomTag class floating around, but would like to refactor in a separate PR. We have node-ctags Tag objects returned in TagReader and TagGenerator, and there is some Atom specific data and logic scattered throughout, including projectPath added in this PR, as well as the workspace appropriate naming in viewForItem.