Skip to content

Add support for file creation request handling in CabalAdd - #5123

Merged
fendor merged 11 commits into
haskell:masterfrom
ChristophHochrainer:feat/5114-add-support-for-file-creation
Oct 14, 2026
Merged

fendor merged 11 commits into
haskell:masterfrom
ChristophHochrainer:feat/5114-add-support-for-file-creation

Conversation

@ChristophHochrainer

Copy link
Copy Markdown
Contributor

Description

This PR implements the mentioned file creation hook for the CabalAdd module of the cabal plugin mentioned in #5114.

The feature creates a best guess of an automatic module placement in the nearest cabal file.

Currently, if a new file is created, the name of the file is assumed as the module name.
Then HLS proposes an edit to the closest cabal file in either other-modules (default) or exposed-modules (only for main libraries).

If the module name is already in use, no action is taken.

The implementation is strongly inspired by the already present Rename implementation.

Tests

The test architecture as well as the plugin request system is copied and slightly adapted from the Rename feature.
The tests cover most of the component types as well as the negative case of a module with the same name present.

Open Tasks

From the issue #5114, I have not created the didCreateFile suggestion with the module header.
I believe this can be another issue as this PR is already quite big.


  • the PR was create as part of MuniHack2026
  • special thanks to @VeryMilkyJoe for the help!

@VeryMilkyJoe
VeryMilkyJoe force-pushed the feat/5114-add-support-for-file-creation branch 3 times, most recently from 393f6ca to 14ac0b5 Compare October 11, 2026 12:34

@fendor fendor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Great work, this is some amazing progress!

@fendor
fendor force-pushed the feat/5114-add-support-for-file-creation branch from 5db9d4b to 40c94e1 Compare October 14, 2026 09:19
@fendor
fendor enabled auto-merge (squash) October 14, 2026 09:20
@fendor
fendor force-pushed the feat/5114-add-support-for-file-creation branch from 40c94e1 to d4d1fc8 Compare October 14, 2026 09:55
@fendor fendor added the merge me Label to trigger pull request merge label Oct 14, 2026
@mergify

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@fendor
fendor merged commit 8f83e4b into haskell:master Oct 14, 2026
42 of 43 checks passed
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