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

Extract the pre-decl pragma parsing to its own module #2428

Merged
merged 56 commits into from
Dec 4, 2021

Conversation

eddiemundo
Copy link
Collaborator

@eddiemundo eddiemundo commented Dec 1, 2021

The purpose is so that it can be reused by multiple plugins, and ghcide.

eddiemundo and others added 30 commits November 11, 2021 22:52
@jneira
Copy link
Member

jneira commented Dec 1, 2021

Many thanks for the refactoring: it makes sense to me but i would like to know @pepeiborra thoughts about the chosen place and name

@jneira jneira requested a review from pepeiborra December 1, 2021 21:51
@pepeiborra
Copy link
Collaborator

Unless you are planning to use this in ghcide, it doesn't seem like a good idea to move it in. In my view code should be moved out of ghcide where possible, in order to shrink the core surface that needs to be maintained and updated.

@jneira
Copy link
Member

jneira commented Dec 2, 2021

hmm ok, so we should looking for another place to put this kind of code, useful for several plugins, depending on ghcide and no suitable to be in ghcide itself 🤔

@jneira
Copy link
Member

jneira commented Dec 2, 2021

hmm ok, so we should looking for another place to put this kind of code, useful for several plugins, depending on ghcide and no suitable to be in ghcide itself

alternatives:

  • put the code in a concrete plugin and make the other ones depending on it: dont like that
  • create a new package hls-plugin-common or hls-plugin-utils: dont like it as it increases maintainers work but it seems to be the cleaner one

thoughts @pepeiborra?

@pepeiborra
Copy link
Collaborator

alternatives:

  • put the code in a concrete plugin and make the other ones depending on it: dont like that

  • create a new package hls-plugin-common or hls-plugin-utils: dont like it as it increases maintainers work but it seems to be the cleaner one

thoughts @pepeiborra?

What's the problem with plugins depending on each other?

  • if plugins A and B depend on plugin P, only A and B will break if P breaks while the rest of plugins will be fine.
  • If we have a plugin-common library that all the plugins depend on, it becomes a piece of core code that needs to be maintained and upgraded just like ghcide

@jneira
Copy link
Member

jneira commented Dec 2, 2021

if plugins A and B depend on plugin P, only A and B will break if P breaks while the rest of plugins will be fine.

Well, if the code is generic enough (and we should encourage so), it would not fit naturally in any concrete plugin and will be less discoverable to be used in other ones.

it becomes a piece of core code that needs to be maintained and upgraded just like ghcide

I was thinking in the better place to put it even if it needs more maintainer work. It is one package more between the bunch of existing ones.

@eddiemundo
Copy link
Collaborator Author

eddiemundo commented Dec 2, 2021

The main reason I thought putting this somewhere into its own module was necessary is because the pragmas plugin depends on ghcide, and so if something in ghcide needs some pragmas plugin functionality then there would be a cyclic dependency and it wouldn't work. This might not be the case?

@pepeiborra
Copy link
Collaborator

The main reason I thought putting this somewhere into its own module was necessary is because the pragmas plugin depends on ghcide, and so if something in ghcide needs some pragmas plugin functionality then there would be a cyclic dependency and it wouldn't work. This might not be the case?

That's why I said:

Unless you are planning to use this in ghcide, it doesn't seem like a good idea to move it in

Are you planning to use this in ghcide then? If not, best left in the pragmas plugin.

@eddiemundo
Copy link
Collaborator Author

eddiemundo commented Dec 2, 2021

Are you planning to use this in ghcide then? If not, best left in the pragmas plugin.

Oh, yeah, there is an import placement bug outlined in the tests in #2425 that can be solved using functionality in the pragmas plugin, otherwise we'd have to duplicate the logic, or solve it in a different way. The import placement stuff is done in CodeAction.hs which is in ghcide.

Copy link
Member

@jneira jneira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the refactoring

@jneira jneira added the merge me Label to trigger pull request merge label Dec 3, 2021
@mergify mergify bot merged commit 8441ef2 into haskell:master Dec 4, 2021
@eddiemundo eddiemundo deleted the extract-predecl-comments-parser branch December 4, 2021 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants