File tree Expand file tree Collapse file tree 5 files changed +10
-3
lines changed
plugins/hls-alternate-number-format-plugin Expand file tree Collapse file tree 5 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ You can watch demos for some of these features [below](#demos).
17
17
- [ Module name suggestions] ( #module-names ) for insertion or correction
18
18
- [ Call hierarchy support] ( #call-hierarchy )
19
19
- [ Qualify names from an import declaration] ( #qualify-imported-names ) in your code
20
+ - [ Suggest alternate numeric formats] ( #alternate-number-formatting )
20
21
21
22
## Demos
22
23
@@ -51,3 +52,7 @@ You can watch demos for some of these features [below](#demos).
51
52
### Qualify imported names
52
53
53
54
![ 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 )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ The plugin requires no extra setup to work. Simply place your cursor on top of a
10
10
11
11
## Demo
12
12
13
- ![ Alternate format suggestions] ( HLSInt .gif)
13
+ ![ Alternate format suggestions] ( HLSAll .gif)
14
14
15
15
### Currently Supported GHC Extensions:
16
16
- ` BinaryLiterals `
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ module Ide.Plugin.Conversion (
21
21
) where
22
22
23
23
import Data.Char (toUpper )
24
- import Data.List (delete )
24
+ import Data.List (delete , dropWhileEnd )
25
25
import Data.Maybe (mapMaybe )
26
26
import Data.Ratio (denominator , numerator )
27
27
import Data.Text (Text )
@@ -165,7 +165,9 @@ generateNumDecimal val = map (toNumDecimal val) $ take 3 $ takeWhile (val >= ) $
165
165
toNumDecimal :: Integer -> Integer -> Text
166
166
toNumDecimal val divisor = let (q, r) = val `quotRem` divisor
167
167
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
169
171
170
172
toBase :: (Num a , Ord a ) => (a -> ShowS ) -> String -> a -> String
171
173
toBase conv header n
You can’t perform that action at this time.
0 commit comments