hls-alternate-number-format-plugin: Provide Alternate Number Formats plugin for Haskell Language Server

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at https://github.com/haskell/haskell-language-server#readme


[Skip to Readme]

Properties

Versions 1.0.1.0, 1.1.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.3.0.1, 2.0.0.0, 2.0.0.1, 2.1.0.0, 2.2.0.0, 2.3.0.0, 2.4.0.0, 2.5.0.0, 2.6.0.0
Change log None available
Dependencies aeson, base (>=4.12 && <5), containers, ghc-boot-th, ghcide (>=1.6 && <1.8), hie-compat, hls-graph, hls-plugin-api (>=1.3 && <1.5), lens, lsp, mtl, regex-tdfa, syb, text, unordered-containers [details]
License Apache-2.0
Author Nick Suchecki
Maintainer nicksuchecki@gmail.com
Category Development
Uploaded by hls_team at 2022-04-27T09:21:29Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hls-alternate-number-format-plugin-1.1.0.0

[back to package description]

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:

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

Changelog

1.0.0.0

1.0.1.0

1.0.1.1

1.0.2.0

1.1.0.0