Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Fix for #45 - remove redundant symbols from imports #290

Merged
merged 7 commits into from
Dec 30, 2019

Conversation

pepeiborra
Copy link
Collaborator

To parse and edit module imports I went with a very low tech solution, instead of reusing the GHC parse tree or similar, in the interest of preserving as much of the user text as possible.

To match on the GHC error output I went with regex-tdfa, which is able to run regular expressions on Text values, because it seems the right tool for the job. While it has an upper bound on base that rules out 8.8, it worked for me with allow-newer.

Copy link
Contributor

@aherrmann-da aherrmann-da left a comment

Choose a reason for hiding this comment

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

Thank you, that looks great!

There are some CI issues (hlint and stack.yaml) - see review comments

src/Development/IDE/LSP/CodeAction.hs Outdated Show resolved Hide resolved
src/Development/IDE/LSP/CodeAction.hs Outdated Show resolved Hide resolved
stack.yaml Show resolved Hide resolved
stack84.yaml Show resolved Hide resolved
stack88.yaml Show resolved Hide resolved
pepeiborra and others added 2 commits December 23, 2019 18:33
@pepeiborra
Copy link
Collaborator Author

Suggestions applied, thanks!

@aherrmann-da
Copy link
Contributor

@pepeiborra Thank you for fixing all these and for implementing the feature.

@aherrmann-da aherrmann-da merged commit 0bcdc6a into haskell:master Dec 30, 2019
pepeiborra added a commit to pepeiborra/ghcide that referenced this pull request Jan 3, 2020
* Test for #45

* Remove redundant symbols from imports

Fixes #45

* Update src/Development/IDE/LSP/CodeAction.hs

Co-Authored-By: Andreas Herrmann <[email protected]>

* Apply suggestions from code review

Co-Authored-By: Andreas Herrmann <[email protected]>

* Add regex-tdfa extra deps to ghc-lib build

* Fix for GHC 8.4 (error message prints qualified binding)

GHC ticket #14881 changed this to print identifiers unqualified

* dropBindingsFromImportLine: make total

Co-authored-by: Andreas Herrmann <[email protected]>
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
…skell/ghcide#290)

* Test for haskell/ghcide#45

* Remove redundant symbols from imports

Fixes haskell/ghcide#45

* Update src/Development/IDE/LSP/CodeAction.hs

Co-Authored-By: Andreas Herrmann <[email protected]>

* Apply suggestions from code review

Co-Authored-By: Andreas Herrmann <[email protected]>

* Add regex-tdfa extra deps to ghc-lib build

* Fix for GHC 8.4 (error message prints qualified binding)

GHC ticket haskell/ghcide#14881 changed this to print identifiers unqualified

* dropBindingsFromImportLine: make total

Co-authored-by: Andreas Herrmann <[email protected]>
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
…skell/ghcide#290)

* Test for haskell/ghcide#45

* Remove redundant symbols from imports

Fixes haskell/ghcide#45

* Update src/Development/IDE/LSP/CodeAction.hs

Co-Authored-By: Andreas Herrmann <[email protected]>

* Apply suggestions from code review

Co-Authored-By: Andreas Herrmann <[email protected]>

* Add regex-tdfa extra deps to ghc-lib build

* Fix for GHC 8.4 (error message prints qualified binding)

GHC ticket haskell/ghcide#14881 changed this to print identifiers unqualified

* dropBindingsFromImportLine: make total

Co-authored-by: Andreas Herrmann <[email protected]>
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
…skell/ghcide#290)

* Test for haskell/ghcide#45

* Remove redundant symbols from imports

Fixes haskell/ghcide#45

* Update src/Development/IDE/LSP/CodeAction.hs

Co-Authored-By: Andreas Herrmann <[email protected]>

* Apply suggestions from code review

Co-Authored-By: Andreas Herrmann <[email protected]>

* Add regex-tdfa extra deps to ghc-lib build

* Fix for GHC 8.4 (error message prints qualified binding)

GHC ticket haskell/ghcide#14881 changed this to print identifiers unqualified

* dropBindingsFromImportLine: make total

Co-authored-by: Andreas Herrmann <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants