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

vim-rails and Ember .projections.json in subdirectory #505

Open
jgadbois opened this issue Jan 12, 2018 · 12 comments
Open

vim-rails and Ember .projections.json in subdirectory #505

jgadbois opened this issue Jan 12, 2018 · 12 comments

Comments

@jgadbois
Copy link

I have a vim rails installed and an ember app in a subdirectory with a .projections.json. Any time there's a conflict (:Econtroller, :Eserializer) it's using the Rails projections instead of the Ember ones.

Is there a way to exclude this subdirectory from the Rails projections?

@tpope
Copy link
Owner

tpope commented Jan 25, 2018

I'm afraid there's not, currently. My intended solution for this was to unify both plugins with the same projections system, but that's proving to be really difficult. If you're feeling ambitious, you can look into making RailsDetect() fail if keys(b:projectionist) contains a subdirectory of the Rails root, thus causing rails.vim not to activate at all in that case.

@juanibiapina
Copy link

@tpope If it's proving difficult, how about a config to disable it for now?

@tpope
Copy link
Owner

tpope commented Mar 15, 2018

If you're feeling ambitious, you can look into making RailsDetect() fail if keys(b:projectionist) contains a subdirectory of the Rails root, thus causing rails.vim not to activate at all in that case.

@juanibiapina
Copy link

I'm not feeling ambitious. I was suggesting more in terms of early returning from RailsDetect based on a global config variable that I can set if I know I have projectionist or any other plugin which might conflict.

@tpope
Copy link
Owner

tpope commented Mar 15, 2018

What? It needs to be conditional on the project. A global variable that unconditionally short circuited RailsDetect() would be the same as uninstalling rails.vim entirely.

@juanibiapina
Copy link

juanibiapina commented Mar 15, 2018

True. I would like to short circuit only the alternation, while keeping everything else.

@tpope
Copy link
Owner

tpope commented Mar 15, 2018

If you're looking for a hack, duplicate your Projectionist alternates in config/projections.json or wherever. I'm not going to add a g:combine_rails_and_projectionist_in_the_way_that_is_easiest_for_juanibiapina option.

@juanibiapina
Copy link

juanibiapina commented Mar 15, 2018

That's not how I meant at all. I tried to say that if combining the two plugins is a long term goal and there is no easy way to integrate them now, there could be a correct, simple way to provide a config that disables only parts of the rails.vim behavior while keeping things consistent and solving a few of the common use cases.

I understand now that there probably isn't an good way, so it's better to keep the workarounds in our own vimfiles.

@tpope
Copy link
Owner

tpope commented Mar 15, 2018

Which parts though? Your request for alternates seems tailor made your own particular config.

The next best thing to true unification is "innermost nested directory wins". This isn't some insurmountable challenge, it's just way down on my priority list.

@juanibiapina
Copy link

I just observed the conflict with the :As and :Es.

Another option is to drop the support for :As and :E completely from vim-rails and just integrate with a projectionist hook. But I admit I don't have enough knowledge of how vim-rails internally depends on many of the projection heuristics.

@tpope
Copy link
Owner

tpope commented Mar 15, 2018

That's exactly the end goal. The problem is that rails.vim supports additional behavior, like the ability for :Econtroller with no argument to take you directly from the user model to the users controller, or the way :A takes you to from a migration to the next earlier one chronologically.

@juanibiapina
Copy link

Thanks for the explanations! I think I see the bigger picture now.

tpope added a commit that referenced this issue Jul 9, 2018
rtlechow pushed a commit to rtlechow/vim-rails that referenced this issue Mar 10, 2021
algert072 added a commit to algert072/vim-rails that referenced this issue Mar 5, 2022
algert072 added a commit to algert072/vim-rails that referenced this issue Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants