ternjs / tern

A JavaScript code analyzer for deep, cross-editor language support
https://ternjs.net/
MIT License
4.26k stars 378 forks source link

Command-line argument to manually specify the path to .tern-config/.tern-project. #957

Open kreskij opened 6 years ago

kreskij commented 6 years ago

Hello, I'm really liking the TernJS experience with Neovim+Deoplete.

One feature which is common in most command-line programs is the ability to manually specify the path to the program's config file using a command-line argument. For example, vim -u <path/to/.vimrc>, tmux -f <path/to/.tmux.conf>. Can TernJS support this feature for the .tern-config and/or .tern-project file? For example something along the lines of tern --tern-config <path/to/.tern-config>?

My justification/use-case is I like to keep all of my configuration isolated in a Dropbox folder. I like to manually specify config-file paths for everything, for example vim -u <path/to/.vimrc>, tmux -f <path/to/.tmux.conf>. It's all done automatic using aliases and configuration. This is so I don't need to set anything up (such as symlinks) when moving between environments, less $HOME clutter, and no interference with other users which may use the same system.

othree commented 5 years ago

Hi

How do you give argument to /bin/tern inside Neovim+Deoplete. Configure in .vimrc?

kreskij commented 5 years ago

From the deoplete-ternjs readme,

" Set bin if you have many instalations let g:deoplete#sources#ternjs#tern_bin = '/path/to/tern_bin'

Also,

" Use tern_for_vim. let g:tern#command = ["tern"] let g:tern#arguments = ["--persistent"]

Although tern has no argument to set the path to config file.

othree commented 5 years ago

How about copy(or create symlink) the config file to ~/.tern-config

kreskij commented 5 years ago

That is what I'm currently doing. However it's not ideal for the way I manage config files.

From what I've seen, most people keep all their dotfiles in a directory, and create an install script to symlink everything to $HOME/<some-dotfile>, $HOME/.config/<some-dotfile> and a bunch of other places.

I do it a bit differently and it has significant advantages for me. I don't put or symlink any dotfiles in their standard locations. I keep everything completely contained in my own personal directory (for example $HOME/<jasons-config>). For every program I use which has a config file, I manually specify it's config file path using it's command-line arguments. You might think that's silly but I don't actually type this stuff out.. it's all automatic. I make it automatic by wrapping things in shell aliases and shell functions. As well as I manually set paths in the insides of config files. For example, my .vimrc knows to look somewhere in $HOME/<jasons-config> for plugins, linter configs, shell scripts, etc.

I do this for 3 main reasons:

For now, TernJs is an exception for me. I manually symlink the file in each environment. Which isn't a big deal but as I'm sure you know, when it comes to development, all the little things add up. That's the reason I think it would be nice to have a command-line argument for specifying a config file path.

I appreciate your consideration.

othree commented 5 years ago

I need to figure out what is a good behavior to add custom config file. Because there are many cases, ex: user set custom tern-config, and the project have a tern-project file, should I load the tern-project? And I don't think its good to have both tern-config and tern-project configurable. It will confuse users.