Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit c121eb2

Browse files
authored
Merge branch 'master' into window-progress
2 parents 97a18d0 + 69878c9 commit c121eb2

File tree

14 files changed

+571
-149
lines changed

14 files changed

+571
-149
lines changed

Changelog.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# 0.9.0.0
2+
3+
- GHC 8.6.5 preliminary support added via the nightly build (@alanz)
4+
- Resolver bumped, LTS 13.19 for GHC 8.6.4 (@alanz)
5+
- Add `diagnosticsOnChange` config parameter, default `True`
6+
(preserving prior hie behaviour). Setting it `False` only generates
7+
diagnostics on file save. ([#1164](https://github.com/haskell/haskell-ide-engine/pull/1164), @mpickering/@lorenzo)
8+
- The `Hsimport` plugin now formats the resulting change using the
9+
formatter configured for hie. ([#1167](https://github.com/haskell/haskell-ide-engine/pull/1167),@fendor)
10+
- Actually enable type definition requests, if supported by the client
11+
(e.g. vscode). ([#1169](https://github.com/haskell/haskell-ide-engine/pull/1169)/@fendor, [#1172](https://github.com/haskell/haskell-ide-engine/pull/1172)/@bubba)
12+
- Use LSP MarkupContent for generated documentation ([#1181](https://github.com/haskell/haskell-ide-engine/pull/1181), @alanz)
13+
- remove installation of Cabal by cabal ([#1184](https://github.com/haskell/haskell-ide-engine/pull/1184), @power-fungus)
14+
- Add EmptyDataDecls to available pragmas, for generating code actions
15+
to insert if needed. ([#1187](https://github.com/haskell/haskell-ide-engine/pull/1187),@fendor)
16+
- Make sure the end of formatted text is properly indicated for marked
17+
up documentation ([#1189](https://github.com/haskell/haskell-ide-engine/pull/1189), @alanz)
18+
- Fix some of the tests with cabal new-build ([#1194](https://github.com/haskell/haskell-ide-engine/pull/1194), @michaelpj)
19+
- Update build-tool-depends for func-test ([#1198](https://github.com/haskell/haskell-ide-engine/pull/1198), @bubba)
20+
- Fix version of lsp-test so `cabal new-build` works ([#1211](https://github.com/haskell/haskell-ide-engine/pull/1211), @power-fungus)
21+
- Bump hlint to 2.1.17 ([#1213](https://github.com/haskell/haskell-ide-engine/pull/1213), @alanz)
22+
- Use cabal helper that searches with exe extension on windows ([#1217](https://github.com/haskell/haskell-ide-engine/pull/1217), @alanz)
23+
24+
- Stability improvements
25+
- Avoid crash in case of nonsensical hoogle db ([#1174](https://github.com/haskell/haskell-ide-engine/pull/1174), @fendor)
26+
- Prevent hie crash if apply-refact crashes ([#1220](https://github.com/haskell/haskell-ide-engine/pull/1220), @Hogeyama)
27+
28+
- Documentation improvements
29+
- Improve code documentation about formatters ([#1165](https://github.com/haskell/haskell-ide-engine/pull/1165),@fendor)
30+
- Add code documentation for the Hoogle plugin ([#1173](https://github.com/haskell/haskell-ide-engine/pull/1173),@fendor)
31+
- Change 'build-docs' to 'build-doc' in README ([#1185](https://github.com/haskell/haskell-ide-engine/pull/1185), @ajeetdsouza)
32+
- README Nix - replace old.postFixup -> postFixup ([#1193](https://github.com/haskell/haskell-ide-engine/pull/1193), @backuitist)
33+
- Expand documentation on the build system ([#1200](https://github.com/haskell/haskell-ide-engine/pull/1200), @power-fungus)
34+
- Fixed a typo. ([#1212](https://github.com/haskell/haskell-ide-engine/pull/1212), @rashadg1030)
35+
- Add documentation about building hie with profiling
36+
enabled. ([#1225](https://github.com/haskell/haskell-ide-engine/pull/1225), @skress)
37+
- Add Documentation for Pragmas Plugin ([#1222](https://github.com/haskell/haskell-ide-engine/pull/1222), @fendor)
38+
39+
- Build system improvements
40+
- Further improvements and simplification of the `./install.hs`
41+
build system ([#1168](https://github.com/haskell/haskell-ide-engine/pull/1168), @power-fungus)
42+
143
# 0.8.0.0
244

345
- GHC 8.6.4 support added.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ we talk to clients.__
5959
- [Is \<package\> base-x?](#is-package-base-x)
6060
- [Is there a hash (#) after \<package\>?](#is-there-a-hash--after-package)
6161
- [Otherwise](#otherwise)
62+
- [Nix: cabal-helper, No such file or directory](#nix-cabal-helper-no-such-file-or-directory)
6263

6364
## Features
6465

@@ -597,3 +598,16 @@ Delete any `.ghc.environment*` files in your project root and try again. (At the
597598

598599
#### Otherwise
599600
Try running `cabal update`.
601+
602+
### Nix: cabal-helper, No such file or directory
603+
604+
An error on stderr like
605+
606+
```
607+
cabal-helper-wrapper: /home/<...>/.cache/cabal-helper/cabal-helper<...>: createProcess: runInteractiveProcess:
608+
exec: does not exist (No such file or directory)
609+
```
610+
611+
can happen because cabal-helper compiles and runs above executable at runtime without using nix-build, which means a Nix garbage collection can delete the paths it depends on. Delete ~/.cache/cabal-helper and restart HIE to fix this.
612+
613+

haskell-ide-engine.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: haskell-ide-engine
2-
version: 0.8.0.0
2+
version: 0.9.0.0
33
synopsis: Provide a common engine to power any Haskell IDE
44
description: Please see README.md
55
homepage: http://github.com/githubuser/haskell-ide-engine#readme
@@ -286,6 +286,7 @@ test-suite func-test
286286
, lens
287287
, text
288288
, unordered-containers
289+
, containers
289290
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
290291
if flag(pedantic)
291292
ghc-options: -Werror

hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,16 @@ type HoverProvider = Uri -> Position -> IdeM (IdeResult [Hover])
220220

221221
type SymbolProvider = Uri -> IdeDeferM (IdeResult [DocumentSymbol])
222222

223-
-- | Format the document either as a whole or only a given Range of it.
224-
data FormattingType = FormatDocument
223+
-- | Format the given Text as a whole or only a @Range@ of it.
224+
-- Range must be relative to the text to format.
225+
-- To format the whole document, read the Text from the file and use 'FormatText'
226+
-- as the FormattingType.
227+
data FormattingType = FormatText
225228
| FormatRange Range
226229

227230
-- | Formats the given Text associated with the given Uri.
228-
-- Should, but might not, honor the provided formatting options (e.g. Floskell does not).
229-
-- A formatting type can be given to either format the whole document or only a Range.
231+
-- Should, but might not, honour the provided formatting options (e.g. Floskell does not).
232+
-- A formatting type can be given to either format the whole text or only a Range.
230233
--
231234
-- Text to format, may or may not, originate from the associated Uri.
232235
-- E.g. it is ok, to modify the text and then reformat it through this API.
@@ -237,6 +240,11 @@ data FormattingType = FormatDocument
237240
-- Failing means here that a IdeResultFail is returned.
238241
-- This can be used to display errors to the user, unless the error is an Internal one.
239242
-- The record 'IdeError' and 'IdeErrorCode' can be used to determine the type of error.
243+
--
244+
--
245+
-- To format a whole document, the 'FormatText' @FormattingType@ can be used.
246+
-- It is required to pass in the whole Document Text for that to happen, an empty text
247+
-- and file uri, does not suffice.
240248
type FormattingProvider = T.Text -- ^ Text to format
241249
-> Uri -- ^ Uri of the file being formatted
242250
-> FormattingType -- ^ How much to format

hie-plugin-api/hie-plugin-api.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: hie-plugin-api
2-
version: 0.6.0.0
2+
version: 0.9.0.0
33
synopsis: Haskell IDE API for plugin communication
44
license: BSD3
55
license-file: LICENSE

install.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ cabalInstallHie versionNumber = do
222222

223223
cabalBuildDoc :: Action ()
224224
cabalBuildDoc = do
225-
execCabal_ ["new-build", "hoogle", "generate"]
225+
execCabal_ ["new-build", "hoogle"]
226226
execCabal_ ["new-exec", "hoogle", "generate"]
227227

228228
cabalTest :: VersionNumber -> Action ()

src/Haskell/Ide/Engine/Plugin/Brittany.hs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ provider
4343
provider text uri formatType opts = pluginGetFile "brittanyCmd: " uri $ \fp -> do
4444
confFile <- liftIO $ getConfFile fp
4545
let (range, selectedContents) = case formatType of
46-
FormatDocument -> (fullRange text, text)
47-
FormatRange r -> (normalize r, extractRange r text)
46+
FormatText -> (fullRange text, text)
47+
FormatRange r -> (normalize r, extractRange r text)
4848

4949
res <- formatText confFile opts selectedContents
5050
case res of
@@ -65,21 +65,28 @@ formatText
6565
=> Maybe FilePath -- ^ Path to configs. If Nothing, default configs will be used.
6666
-> FormattingOptions -- ^ Options for the formatter such as indentation.
6767
-> Text -- ^ Text to format
68-
-> m (Either [BrittanyError] Text) -- ^ Either formatted Text or a error from Brittany.
69-
formatText confFile opts text =
68+
-> m (Either [BrittanyError] Text) -- ^ Either formatted Text or a error from Brittany.
69+
formatText confFile opts text =
7070
liftIO $ runBrittany tabSize confFile text
7171
where tabSize = opts ^. J.tabSize
7272

73-
-- | Extend to the line below to replace newline character, as above.
73+
-- | Extend to the line below and above to replace newline character.
7474
normalize :: Range -> Range
7575
normalize (Range (Position sl _) (Position el _)) =
7676
Range (Position sl 0) (Position (el + 1) 0)
7777

78-
-- | Recursively search in every directory of the given filepath for brittany.yaml
78+
-- | Recursively search in every directory of the given filepath for brittany.yaml.
7979
-- If no such file has been found, return Nothing.
8080
getConfFile :: FilePath -> IO (Maybe FilePath)
8181
getConfFile = findLocalConfigPath . takeDirectory
8282

83+
-- | Run Brittany on the given text with the given tab size and
84+
-- a configuration path. If no configuration path is given, a
85+
-- default configuration is chosen. The configuration may overwrite
86+
-- tab size parameter.
87+
--
88+
-- Returns either a list of Brittany Errors or the reformatted text.
89+
-- May not throw an exception.
8390
runBrittany :: Int -- ^ tab size
8491
-> Maybe FilePath -- ^ local config file
8592
-> Text -- ^ text to format

src/Haskell/Ide/Engine/Plugin/Floskell.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ provider contents uri typ _opts =
3535
pluginGetFile "Floskell: " uri $ \file -> do
3636
config <- liftIO $ findConfigOrDefault file
3737
let (range, selectedContents) = case typ of
38-
FormatDocument -> (fullRange contents, contents)
39-
FormatRange r -> (r, extractRange r contents)
40-
result = reformat config (uriToFilePath uri) (BS.fromStrict (T.encodeUtf8 selectedContents))
38+
FormatText -> (fullRange contents, contents)
39+
FormatRange r -> (r, extractRange r contents)
40+
result = reformat config (Just file) (BS.fromStrict (T.encodeUtf8 selectedContents))
4141
case result of
4242
Left err -> return $ IdeResultFail (IdeError PluginError (T.pack $ "floskellCmd: " ++ err) Null)
4343
Right new -> return $ IdeResultOk [TextEdit range (T.decodeUtf8 (BS.toStrict new))]

0 commit comments

Comments
 (0)