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

Unify module name checks #3785

Open
fendor opened this issue Sep 1, 2023 · 3 comments
Open

Unify module name checks #3785

fendor opened this issue Sep 1, 2023 · 3 comments
Labels
component: hls-cabal-plugin Issues related to the hls-cabal-plugin component: hls-module-name-plugin level: easy The issue is suited for beginners type: enhancement New feature or request

Comments

@fendor
Copy link
Collaborator

fendor commented Sep 1, 2023

Is your enhancement request related to a problem? Please describe.

I know of at least two locations where we check a module name for sanity, e.g. each component starts with an upper char.
The plugins hls-cabal-plugin, hls-module-name-plugin and ghcide itself (until #3779 lands) are known to do that. However, they do not share any code.

Describe the solution you'd like

Common sanity checks should be performed by everyone in the same, predictable way.

Additional context

One bug in hls-module-name-plugin #3784

@fendor fendor added type: enhancement New feature or request component: hls-module-name-plugin component: hls-cabal-plugin Issues related to the hls-cabal-plugin labels Sep 1, 2023
@michaelpj
Copy link
Collaborator

Furthermore, this would provide a place to turn it into a saner check that looks for .cabal files and their hs-src-dirs to actually work out the module prefix more correctly.

@michaelpj michaelpj added the level: easy The issue is suited for beginners label Jun 20, 2024
@pbrinkmeier
Copy link
Contributor

pbrinkmeier commented Oct 13, 2024

Here's a few locations that might be interesting for working on this issue:

Module Name Manipulation

There's a few types (ModuleName, Text, [Text], etc.) and different syntactical forms (Data.Text, Data/Text.hs, src/Data/Text.hs, etc.) in use for refering to modules.
This is an (incomplete) list of code that works with theses representations.

Getting hs-source-dirs

  • hls-cabal-plugin does that in multiple places:
  • ghcide as well:

@pbrinkmeier
Copy link
Contributor

I think an easy first step would be making the hs-source-dirs stuff consistent. Basically provide a common interface to map components of a GenericPackageDescription to source directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-cabal-plugin Issues related to the hls-cabal-plugin component: hls-module-name-plugin level: easy The issue is suited for beginners type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants