haskell-language-server/plugins/hls-alternate-number-format-plugin
wz1000 191bda61fe
9.6 support for HLS (#3480)
* 9.6 support

Fixes

hls-refactor-plugin 9.6 support

hls-gadt-plugin

Fix 9.4 build

Fixes

hls-gadt-plugin fixes

WIP 9.6 patches

fixes

fixes

fixes

fixes

fixes

Fixes and add CI

CI

CI fixes

patch haskell/actions for https://github.com/haskell/ghcup-hs/issues/783

CI fixes

CI fixes

CI fixes

CI

CI

CI

CI

CI

Fix build on 9.0

Fix build on 9.0

hls-splice-plugin 9.6 compat

fixes

fixes

fixes

fixes

Fix benchmark build errors

9.2.5 and 8.10.7 had build errors when running benchmarks due to `mfsolve`
test suite having duplicate instances, so stop building tests for
mfsolve (see: https://github.com/kuribas/mfsolve/issues/8). Also,
`http2-4.0.0` has a parse error due to a misplaced haddock comment that
causes build failure with `-haddock`. It is fixed in the latest commit
of the source repo, so use that in the `cabal.project` for now.

Checkout correct commit on `pull_request` in CI

By default, the `pull_request` event has a `GITHUB_SHA` env variable set to the
"last merge commit on the GITHUB_REF branch"
(see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request).
But we want to check out the latest commit on the branch whether or not it is a
merge commit. This commit changes the CI actions to do just that.

fixes

Use head.hackage for 9.4

Only use head.hackage for 9.5 and up

Reverts the change that caused head.hackage to be used for 9.4 as
well

Reintroduce source-repo-package for ekg-json

Fix refactor plugin tests

Fix missing constraint detection in refactor plugin

ghc 9.6+ allow newer unordered-containers:template-haskell

Some refactor tests no longer broken for 9.2

Fix simple-multi-test on 9.6

Mark simple-plugin as broken on 9.6

func-test fixes

Disable unsupported plugins on 9.6

Eval plugin fixes

Eval plugin test fixes, debug output in CI script

Restore 'working' setup/actions

WIP Fix GHC prerelease windows install

Fix eval plugin T11

fixes

Eval plugin fixes

Fix splice plugin test

Mark `simple plugin` ghcide test broken on 9.6

fixes

fixes

Use GHC 9.6-rc1 in CI

Try using 9.6.1 for CI

* 9.6 nix

* Remove head.hackage

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes
2023-03-22 13:56:51 +00:00
..
src/Ide/Plugin 9.6 support for HLS (#3480) 2023-03-22 13:56:51 +00:00
test Introduce common code for Recorders in Plugin Tests (#3347) 2022-11-28 15:19:51 +00:00
hls-alternate-number-format-plugin.cabal Prepare release 1.9.0.0 2022-12-26 16:09:25 +05:30
HLSAll.gif Provide all format suggestions in AlternatFormat Code Action (#2790) 2022-03-21 12:22:22 +00:00
LICENSE HLS Plugin to provide Alternate Literal Formats. (#2350) 2021-12-01 14:12:06 +00:00
README.md Provide all format suggestions in AlternatFormat Code Action (#2790) 2022-03-21 12:22:22 +00:00

Alternate Number Format Plugin

The alternate number format plugin provides alternative formatting for Numeric Literals in source code. These can be any numeric literal such as 123, 0x45 or any of the other numeric formats. The Code Action will provide all possible formatting suggestions (and when required insert the associated Language Extension)

Setup

The plugin requires no extra setup to work. Simply place your cursor on top of a literal and invoke the codeAction command for your editor.

Demo

Alternate format suggestions

Currently Supported GHC Extensions:

  • BinaryLiterals
  • HexFloatLiterals
  • NumDecimalLiterals

Design

The plugin is relatively simple, it traverses a files source contents using the GHC API. As it encounters Literals (of the type HsExpr with the constructor of either HsLit or HsOverLit), it will construct an internal Literal datatype that has additional information for use to generate suggestions. Currently, the traversal is done in the file, Literal.hs, using the package SYB for most of the heavy lifting.

To generate suggestions, the plugin leverages the Numeric package which provides a multitude of conversion functions to and from strings/numerics.

Known Quirks

  • Anything that produces a bad Source Span (i.e. can't be easily replaced by an edit) is ignored as well.

Changelog

1.0.0.0

  • First Release

1.0.1.0

  • Dependency upgrades

1.0.1.1

  • Buildable with GHC 9.2

1.0.2.0

  • Test Suite upgraded for 9.2 semantics (GHC2021)
  • Fix SYB parsing with GHC 9.2

1.1.0.0

  • Provide ALL possible formats as suggestions
  • Insert Language Extensions when needed