Skip to content

Commit b573bff

Browse files
committed
Update Features.md and Minor Bug Fix :)
1 parent 681dc5b commit b573bff

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

docs/features.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ You can watch demos for some of these features [below](#demos).
1717
- [Module name suggestions](#module-names) for insertion or correction
1818
- [Call hierarchy support](#call-hierarchy)
1919
- [Qualify names from an import declaration](#qualify-imported-names) in your code
20+
- [Suggest alternate numeric formats](#alternate-number-formatting)
2021

2122
## Demos
2223

@@ -51,3 +52,7 @@ You can watch demos for some of these features [below](#demos).
5152
### Qualify imported names
5253

5354
![Qualify Imported Names Demo](../plugins/hls-qualify-imported-names-plugin/qualify-imported-names-demo.gif)
55+
56+
### Alternate Number Formatting
57+
58+
![Alternate Number Format Demo](../plugins/hls-alternate-number-format-plugin/HLSAll.gif)
Loading
Binary file not shown.

plugins/hls-alternate-number-format-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The plugin requires no extra setup to work. Simply place your cursor on top of a
1010

1111
## Demo
1212

13-
![Alternate format suggestions](HLSInt.gif)
13+
![Alternate format suggestions](HLSAll.gif)
1414

1515
### Currently Supported GHC Extensions:
1616
- `BinaryLiterals`

plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Conversion.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module Ide.Plugin.Conversion (
2121
) where
2222

2323
import Data.Char (toUpper)
24-
import Data.List (delete)
24+
import Data.List (delete, dropWhileEnd)
2525
import Data.Maybe (mapMaybe)
2626
import Data.Ratio (denominator, numerator)
2727
import Data.Text (Text)
@@ -165,7 +165,9 @@ generateNumDecimal val = map (toNumDecimal val) $ take 3 $ takeWhile (val >= ) $
165165
toNumDecimal :: Integer -> Integer -> Text
166166
toNumDecimal val divisor = let (q, r) = val `quotRem` divisor
167167
numExponent = length $ filter (== '0') $ show divisor
168-
in T.pack $ show q <> "." <> show r <> "e" <> show numExponent
168+
-- remove unnecessary trailing zeroes from output
169+
r' = dropWhileEnd (== '0') $ show r
170+
in T.pack $ show q <> "." <> r' <> "e" <> show numExponent
169171

170172
toBase :: (Num a, Ord a) => (a -> ShowS) -> String -> a -> String
171173
toBase conv header n

0 commit comments

Comments
 (0)