Skip to content

Conversation

@vidit-od
Copy link
Contributor

@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
Contributor 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
Collaborator

fendor commented Feb 9, 2026

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

@vidit-od
Copy link
Contributor 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
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

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