haskell-language-server/.github
Nick Suchecki 1a74937ca5
HLS Plugin to provide Alternate Literal Formats. (#2350)
* Initialize and Setup Plugin Source.

* Provide Traversal Module to Haskell AST that collects Literals.

* Change Literals module to return type.

Update our parsing module to return the data type we will use in our
plugin.

The datatype: Literal

Constructors:

Overloaded - Contains an overloaded literal with a SrcSpan

NonOverloaded - Contains non-overloaded literals with a SrcSpan

NoLocation - currently unused.

This data type is bound to change. This module is designed to capture
ALL numeric literals for use in the plugin. When parsing Haskell source
tree, certain cases result in getting a plain `Expr`. This means it is
not annotated with a SrcSpan. As a result, we pass along a SrcSpan
through most functions to keep track of the most recent SrcSpan
encountered. This isn't a fool proof plan and may be removed in the
future.

* Implement Logic for actual CodeActions.

The traversal of Haskell source has been turned into a rule. This rule
generates hidden diagnostics which allow a user to run a code action
over (most) literals.

There is some "dead code" in the sense that some literals (prims to be
exact) are not allowed to be changed, despite existing in code. The
other "dead code" exists in the FormatType type. Certain extensions
exist that alter how numbers are shown or act, we make note of those
extensions but call them "NoFormat", which essentially means it's a
NOOP.

Most of the conversion is done via the Numeric module. There are plenty
of "show" functions that provide the translation of numbers into the
various formats. The only custom format is a slightly "dumb"
NumDecimal-extension-function that generates three separate options,
instead of using a numeric defined function.

* Clarify source code comments. Reformat file structure.

* Set up Test Scaffolding.

* Miscellaneous clean-up.

* Use Regex to Match Source Text.

* Remove unneccessary diagnostics from Rule.

* Update all stack versions to include new Plugin.

* Clean up Conversion.hs and AlternateNumberFormat.

Clean up function names and add supporting haddock documentation for
exported functions.

* Update cabal file bounds and add Github workflow test

* Add plugin package to all cabal.project

* Add plugin to test suite

* Push SYB changes. Test.hs is merely for testing and will be removed prior to Merge.

* Use Generics.SYB for parsing Literals from GHC Source.

Updated Literals.hs to use custom SYB traversal of the AST.

* Update hls-alternate-number-format-plugin.cabal

* WIP: run tests

* Test additions and GHC compatability changes.

* Removed dead code.

PrimLiterals were defined originally, however GHC source doesn't provide
the source text. This is one of the needs of the plugin so we don't
provide duplicate suggestions.

Swapped `Maybe Text` to `Text`. Similar to above we now ignore all
literals that have no source text attached.

Swapped `Maybe SrcSpan` to `RealSrcSpan`. Again, similar to the previous
points we now ignore literals that don't get a sourceSpan attached.
Similarly, we drop any `UselessSpan`'s as those are also not very
helpful.

* Use Set to remove duplicates from CollectLiterals Result.

Certain AST representations are traversed multiple times with the switch
to SYB. Using Set allows to easily remove duplicate Literals from our
result.

Added a test suite to monitor for regressions.

* Delete Test.hs

Inadvertently commit this file.

* Add README and bump version to 1.0.0.0.

* Update HLS cabal file for version change.

* Additional Tests.

* Update Test file to use Path library function.

* Miscellaneous Code Fixes.

- Remove unneeded imports/functions.

- Export only specified functions from each module (and add Haddock
  Comment if necessary)

- Minor text changes for accuracy

* Add README to Extra Source Files.

* Update Extra Source Files to include Test Haskell Source files.

* Update Features.md and Minor Bug Fix :)

* Add new plugins to hackage workflow

* Fix Bug caused by Minor Bug Fix.

Co-authored-by: jneira <atreyu.bbb@gmail.com>
Co-authored-by: Fendor <power.walross@gmail.com>
2021-12-01 14:12:06 +00:00
..
ISSUE_TEMPLATE [skip circleci] Add modern issue templates (#2394) 2021-11-29 15:35:26 +00:00
workflows HLS Plugin to provide Alternate Literal Formats. (#2350) 2021-12-01 14:12:06 +00:00
dependabot.yml add dependabot: add Actions CI merge requests automation (#2339) 2021-11-10 23:56:06 +00:00
mergify.yml Use new queue rules for mergify bot (#2301) 2021-10-28 19:17:05 +02:00