Skip to content

fix spacing issues while refactor-reduce#4841

Merged
fendor merged 1 commit into
haskell:masterfrom
vidit-od:refactor-issues
Feb 14, 2026
Merged

fix spacing issues while refactor-reduce#4841
fendor merged 1 commit into
haskell:masterfrom
vidit-od:refactor-issues

Conversation

@vidit-od
Copy link
Copy Markdown
Collaborator

@vidit-od vidit-od commented Feb 9, 2026

Fixes #4825

In the previous implementation resetEntryDP function was triggered when reduction code action removed any leading constraint from the context. This lead to inconsistent spacing for this scenario.

fixes this by

  1. not using the resetEndtryDP function ( fixes removal of space after => )
  2. add a normalization function that trims leading spaces

@vidit-od vidit-od requested a review from santiweight as a code owner February 9, 2026 11:27
@vidit-od
Copy link
Copy Markdown
Collaborator Author

vidit-od commented Feb 9, 2026

while working on this issue i also gathered the following observation that

  • Remove redundant constraint does not get triggered while dealing with single constrains. i.e

triggering it on the below example does nothing (But constantly shows warning)

image

while for example 2 (Below) we do observe expected result from

-- Example 2 before remove redundant constraint
j :: (Eq a, Show a) => a -> a
j x = x

to

-- Example 2 after remove redundant constraint
j :: a -> a
j x = x

i did try and fix this but could not !!
main possible suspect of this behaviour could be lying at \hls-refactor-plugin\src\Development\IDE\Plugin\CodeAction.hs

to be specific findSigOfDeclRanged function possibly returning Nothing on single constrains.

Requesting a look at it if worthwhile @fendor

@fendor
Copy link
Copy Markdown
Collaborator

fendor commented Feb 9, 2026

Looks like the ubuntu 9.12 errors are genuine EDIT: Nope, flaky

@vidit-od
Copy link
Copy Markdown
Collaborator Author

vidit-od commented Feb 9, 2026

Error logs stated that it failed due to resource vanish ( broken pipe )

Should i look into it ? ( any possibility of optimisation like call-hierarchy ? )

@fendor
Copy link
Copy Markdown
Collaborator

fendor commented Feb 9, 2026

Error logs stated that it failed due to resource vanish ( broken pipe )

We try to address this kind of error in #4701

Dont investigate, I don't think it is worth it

Copy link
Copy Markdown
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

LGTM, tbh, I am relying on the test suite for correctness, because I can't tell without serious tinkering whether this is correct.

Thank you for fixing this!

@fendor fendor merged commit df47a4c into haskell:master Feb 14, 2026
70 of 74 checks passed
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

Successfully merging this pull request may close these issues.

"Remove constraint" refactoring gets spacing wrong

2 participants