Commit Graph

124 Commits

Author SHA1 Message Date
Pepe Iborra
a538f0644b
ghc initialization error handling (#609)
There are a couple of cases to handle as seen below.
Thanks @jneira for help discovering them all.
There used to be linking errors but I no longer see those after the multi-cradle patch

Non Nix
=========

The table below shows a couple of combinations of cradles and ghcide versions in a
non-Nix environment. All the version mismatches are now handled as follows:

- "Cannot satisfy package" -  `-package-id` flags referencing
  package versions not available (generally base)
- "bad interface" - tried to load an interface file created by a different version of ghc

cradle/ghcide | 8.6 | 8.8 | 8.10
--------------|-----|----|---
Cabal 8.6   | success | cannot satisfy package | cannot satisfy package
Cabal 8.8   | cannot satisfy package | success | cannot satisfy package
Cabal 8.10  | cannot satisfy package | cannot satisfy package | success
Stack 8.6   | success | bad-interface | bad-interfac-
Stack 8.8   | bad-interface | success | bad-interface
Stack 8.10  | bad-interface | bad-interface | success

Nix
=========

Because Nix redefines the libdir to point at the run-time ghc installation,
it's actually much easier to detect a version mismatch:
just compare the compile-time and run-time libdirs
2020-06-10 14:26:35 +02:00
Pepe Iborra
5a754e1bb9
Benchmark suite (#590)
* Initial benchmark suite, reusing ideas from Neil's post

https://neilmitchell.blogspot.com/2020/05/fixing-space-leaks-in-ghcide.html

* Add an experiment for code actions without edit

* formatting

* fix code actions bench script

* error handling + options + how to run

* extract Positions and clean up imports

(Neil's review feedback)

* replace with Extra.duration

* allow ImplicitParams

* add bench to the cradle

* applied @mpickering review feedback

* clean up after benchmark

* remove TODO
2020-06-03 16:35:08 +02:00
Moritz Kiefer
4149ab539d
Prepare release of ghcide 0.2.0 (#601)
* Prepare release of ghcide 0.2.0

* Fix year in copyright notices

* Credit chshersh for the 8.10 support
2020-06-02 17:11:36 +02:00
Matthew Pickering
373c4060df
Multi Component (#522)
* Multi component support

In this commit we add support for loading multiple components into one
ghcide session.

The current behaviour is that each component is loaded lazily into the
session. When a file from an unrecognised component is loaded, the
cradle is consulted again to get a new set of options for the new
component. This will cause all the currently loaded files to be
reloaded into a new HscEnv which is shared by all the currently known
components. The result of this is that functions such as go-to
definition work between components if they have been loaded into the
same session but you have to open at least one file from each component
before it will work.

Only minimal changes are needed to the internals to ghcide to make the
file searching logic look in include directories for all currently
loaded components. The main changes are in exe/Main.hs which has been
heavily rewritten to avoid shake indirections. A global map is created
which maps a filepath to the HscEnv which should be used to compile it.
When a new component is created this map is completely refreshed so each
path maps to a new

Which paths belong to a componenent is determined by the targets listed
by the cradle. Therefore it is important that each cradle also lists all
the targets for the cradle. There are some other choices here as well
which are less accurate such as mapping via include directories  which
is the aproach that I implemented in haskell-ide-engine.

The commit has been tested so far with cabal and hadrian.

Also deleted the .ghci file which was causing errors during testing and
seemed broken anyway.

Co-authored-by: Alan Zimmerman <alan.zimm@gmail.com>
Co-authored-by: fendor <power.walross@gmail.com>

* Final tweaks?

* Fix 8.4 build

* Add multi-component test

* Fix hlint

* Add cabal to CI images

* Modify path

* Set PATH in the right place (hopefully)

* Always generate interface files and hie files

* Use correct DynFlags in mkImportDirs

You have to use the DynFlags for the file we are currently compiling to
get the right packages in the package db so that lookupPackage doesn't
always fail.

* Revert "Always generate interface files and hie files"

This reverts commit 820aa24189.

* remove traces

* Another test

* lint

* Unset env vars set my stack

* Fix extra-source-files

As usual, stack doesn’t understand Cabal properly and doesn’t seem to
like ** wildcards so I’ve enumerated it manually.

* Unset env locally

Co-authored-by: Alan Zimmerman <alan.zimm@gmail.com>
Co-authored-by: fendor <power.walross@gmail.com>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-06-02 14:44:16 +02:00
fendor
9129475b87
Update to hie-bios 0.5.0 (#552)
* Update to hie-bios 0.5.0

* Fix test-cases due to changes in the direct cradle

* Update test/exe/Main.hs comment

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-05-23 09:54:25 +02:00
Luke Lau
cd6f62bbed
Use lsp-test-0.11 (#566)
Replace openDoc' with createDoc which sends out
workspace/didChangedWatchedFiles notifications
2020-05-17 16:37:08 +02:00
Pepe Iborra
a2e091c5ac
Fix upper bounds for ghc-check (#565) 2020-05-17 16:01:19 +02:00
Luke Lau
5661348b5e
Upgrade to haskell-lsp-0.22 (#547) 2020-05-13 14:59:51 +02:00
Dmitrii Kovanikov
07cf929ac6
[#518] Build ghcide with GHC 8.10.1 (#519)
* [#518] Build ghcide with GHC 8.10.1

Resolves #518

* Move CPP logic to the Compat module

* Revert changes to mkHieFile

* Add local fork of HieAst for 8.10.1

The fix for mkHieFile didn't make it into 8.10.1, so the override is still needed

* Ignore hlint in src-ghc810/HieAst.hs

* Whitelist CPP for Development.IDE.GHC.Orphans

* [#518] Build ghcide with GHC 8.10.1

Resolves #518

* Move CPP logic to the Compat module

* Revert changes to mkHieFile

* Add local fork of HieAst for 8.10.1

The fix for mkHieFile didn't make it into 8.10.1, so the override is still needed

* Ignore hlint in src-ghc810/HieAst.hs

* Whitelist CPP for Development.IDE.GHC.Orphans

* Plugin tests known broken in 8.10.1 (#556)

* Bump up ghc-check version

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>

Co-authored-by: pepe iborra <pepeiborra@gmail.com>
2020-05-11 16:55:54 +02:00
Pepe Iborra
15bb044269
Improve ghc version check (#535)
- retrieve runtime version from ghc executable, not from pkg db (ghc-check 0.3.0.0)
- Do not error when unable to retrieve runtime version
2020-05-08 15:48:05 +02:00
Alan Zimmerman
78d4031f7c
Add a custom prefix to command IDs (#500)
* Add a custom prefix to command IDs

A client can run more than one instance of ghcide.  Some clients have a global
command registry, and all commands must be unique in that registry.

So to make the command ids unique, prefix them with the ghcide server process
id, as is done in haskell-ide-engine.

* Use same command naming scheme as in haskell-language-server

To ease interoperability

* Use makeLspCommandId for prefixing commands

This puts all the prefixing logic in one place.

* Add hlint exception for CPP in Development.IDE.Compat

* Bring in Win32 dependency for windows build
2020-04-27 12:59:13 +02:00
Pepe Iborra
4f9c7561ee
Parse module headers (#511)
* Create rule to get ModSummary without parsing entire source file

* Load file source from disk if not available in memory

* Fix build after cherry pick

* Couple of fixes

- extract getModSummaryFromImports and fix diagnostics
- replace GetParsedModule by GetModSummary where possible
  There is only one usage of GetParsedModule left, and that is in GetSpanInfos
  for documentation. This the wrong approach, docs should be loaded from
  interface files and not from sources. TODO

* Fix watched file tests

Progress notifications are not being sent anymore

* Compat with GHC 8.6

* Avoid parsing source files for completions and documentation

Instead, embed haddocks in interface files

* Allow CPP in module

* Force things after parsing in order to release buffers

* avoid holding on to stringbuffer unnecessarily

* Skip unnecessary file contents read

* Drop HscEnv requirement

* Add comments on forcing things

* Add comments on GHC_LIB restriction

* Parse files of interest twice to capture Haddock errors

If Opt_Haddock is not enabled we parse twice to capture Haddock parse errors

* Parallelize two-pass parsing

* Update src/Development/IDE/Core/Compile.hs

Co-authored-by: Marcelo Lazaroni <lazaronijunior@gmail.com>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-04-27 11:05:39 +02:00
Alan Zimmerman
116a5baee1
Expose codeAction and codeLens providers for haskell-language-server (#499)
* Expose codeAction and codeLens providers for haskell-language-server

Also tweak the code action reply type to generate well-formed JSON

* Expose moduleOutline for symbolProvider in hls too

* Revert to using [CAResult] rather than List CAResult
2020-03-24 12:40:56 +01:00
Pepe Iborra
9ccd9eec08
Detect ghc mismatch (#462)
* Detect ghc version mismatches

* Add ghc-check to stack extra deps

* ghc-check: explicit libdir and delay version error
2020-03-24 12:40:21 +01:00
Pepe Iborra
f804b138dc
Support for interface files (#457)
* Rules for loading interface files

* Typechecking with interface files

* Add a note in the README about the optimal project setup

* Improve support for hs-boot files

The branch was failing to load GHC because the module graph was missing
edges between a .hs file and its .hs-boot file. This means the .hs-boot
file was getting added into the HPT after the .hs file which led to
confusing errors about variables being out of scope.

The fix is to maintain a map from hs-boot to hs files and then add an
edge for this case when calling `transitiveDependencies`.

Also tidy up some code in setupEnv which I assume was attempting to fix
this but in an incorrect manner.

Add the -boot suffix when looking for hi-boot files.

For some reason, the `hi` path is not set to the right thing for
`hs-boot` files. I don't know why not perhaps it is ok to use an
existing `.hi` file in place of an `hs-boot` file. More investigation
needed. My experience is that GHC is quite bad a recompilation avoidance
for hs-boot files anyway.

For example: https://gitlab.haskell.org/ghc/ghc/issues/17434

Add the -boot suffix when writing interface files

* Generate .hi and .hie files during type checking

* Refactor GetModIface to not retain TypeChecked module in memory

This improves memory performance on a cold cache.

* Trailing whitespace

* Turn debug log messages into diagnostics

* Implement "hie" files for ghc-8.6.5

This means that the .hi files patch can also be used with 8.6.5

* Add tests for hover/definition on imported symbols

* hlints

* Generate .hie files when missing

* Fix subtle bug in setDefaultHieDir

* Simplify optimal project setup in README

* Move interface loading diagnostics behind --test flag

Reusing the --test flag for this seems harmless, I cannot justify introducing a
new flag

* Avoid expensive interface file generation for files of interest

* avoid redundant arguments (thanks Moritz K)

* qualify a DAML only comment

* Skip module source when generating hie file

thanks Moritz Kiefer for noting that we don't care for the generated .hie files
to embed module sources

* runGhcEnv <-> evalGhcEnv

* Apply suggestions from code review

Thanks Moritz Kiefer

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Add suggested Show instance

Co-Authored-By: Matthew Pickering <matthewtpickering@gmail.com>

* Use Control.Exception.Safe

This is to avoid accidentally capturing asynchronous exceptions

* Rename atomicFileUpdate

* Fix a flaky test

We have to be careful with module naming in tests to avoid interference of .hi
files across tests

* Undo formatting of D.IDE.GHC.Util

* follow changes in master

Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-03-24 12:39:53 +01:00
Moritz Kiefer
9b6e712251
Fix emptyPathUri (#502)
* Fix emptyPathUri

* Remove platform dependency
2020-03-23 12:21:23 +01:00
Javier Neira
9951f35b08
Use NormalizedFilePath and adapt types of haskell-lsp-0.21 (#479)
* Use custom version of h-l-t

* Use normalized path functions from h-l-t

* Restore empty path corner case

* Create a wrapper over NFP to override IsString

* Use maybe instead fromMaybe

* Use patched version of lsp-types in all yaml files

* Remove unused import

* Rename specific NormalizeFilePath to NormalizeFilePath'

* Remove specific newtype and IsString instance

* Use released haskell-lsp-0.21

* Adapt to type changes of haskell-lsp-0.21

* Add tags field to CompletionItem

* Fix test case about empty file path

* Correct stack.yaml used in azure ci cache

* Build ghcide including tests in windows azure ci

* Qualify haskell-lsp modules to avoid name clashes
2020-03-23 09:07:04 +01:00
Alan Zimmerman
bd53aced70
Expose underlying hover and gotoDefinition handlers (#490)
For use in haskell-language-server
2020-03-19 11:41:09 +01:00
Alan Zimmerman
111b6855e2
Use tasty-rerun to allow rerunning failed tests only (#484)
Use by

  stack --stack-yaml=stack84.yaml test --test-arguments "--rerun"
2020-03-16 09:07:50 +01:00
Pepe Iborra
da92de218a
Guess all imports (#459)
* Suggest missing imports via package exports map

At the expense of some space and initialization time, suggest imports now is
able to find suggestions in all the packages available to the project.

* BadDependency - include the key in the error message

* remove the assumption that the GhcSession is always available

* fix bad spacing

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Add type annotation to clarify rule being defined

* Remove file dependency from PackageExports rule

* Guess patterns

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-03-09 13:22:46 +01:00
Pepe Iborra
df63fd76c0
Tests for cradle loading (#460)
* Refactor: extract Rules to a separate module

* Add tests for cradle loading

* Fix default extensions in exe target

* Move cradle loaded messages behind a flag

* Use satisfy

Following a suggestion by Moritz Kiefer (@cocreature)
2020-03-04 17:31:24 +01:00
Pepe Iborra
ff62fdd87d
Fix regression in cradle loading logic (#450)
We were calling runCradle multiple times per cradle, concurrently. For Cabal
cradles this function runs Cabal, which is neither fast nor designed to be run
concurrently
2020-02-26 09:16:17 +01:00
Pepe Iborra
48a7867a07
Local hidir and hiedir folders to avoid conflicts with Cabal (#441)
* Local hidir and hiedir folders to avoid conflicts with Cabal

hi files created by ghcide would have different optimization settings,
triggering Cabal recompilation if they were stored in Cabal folders

hie files would end up in the src folder as -hiedir is not set by Cabal

Telling GHC to write interface/hie files is pointless since we do it ourselves,
and it also leads to the recompilation checker getting confused

Using hie-bios initSession does things like setting up the cache directory for
interface files and other things which ghcide would rather manage itself.

* linker options

Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
2020-02-20 12:32:20 +01:00
Pepe Iborra
f586955e8a
Fix redundant import code action corner cases (#433)
- Redundant "All" imports, e.g. Maybe(..)
 - Redundant datatype plus constructors, e.g. Maybe(Just)

Fixes #352
2020-02-18 09:22:17 +01:00
Jinwoo Lee
00d914efa7
Automatically pick up new dependencies (#408)
* Automatically pick up new dependencies

hie-bios's componentDependencies returns the dependencies of a cradle
that might change the cradle. Add those deps to the shake graph so that
the GHC session is newly created whenever they change.

For that, add a new rule type, GetHscEnvEq, to cache GHC sessions with
the key of GHC options and dependencies. And delete the optGhcSession
field from IdeOptions.

This is for https://github.com/digital-asset/ghcide/issues/50.

hie-bios's componentDependencies can return files that don't exist yet:
https://github.com/mpickering/hie-bios/blob/master/src/HIE/Bios/Types.hs#L90-L93.
This PR handles changes in the existing dependency files, but doesn't
handle newly created dependency files.

* address comments

* revert hie.yaml

* address more comments

* add test

* make direct cradles work; and use direct cradle in test
2020-02-17 10:33:33 +01:00
Pepe Iborra
ffb05636b6
Workspace roots and getFileExists (#412)
* parse lsp client configuration to track workspace roots

* Only use Watched files on workspace files

* Apply suggestions from code review

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Add tests for watched files

Left as future work: adding tests for workspace folder notifications

* Add a test for file creation outside workspace

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-02-13 13:34:11 +01:00
Moritz Kiefer
4e89d4574d
Use HashMap/HashSet for maps indexed by Normalized{FilePath,Uri} (#420)
Now that we have optimized Hashable instances for these, it makes
sense to use this consistently.
2020-02-11 10:09:48 +01:00
Moritz Kiefer
4aaba4d3e0
Make debouncer configurable (#409)
We have been experiencing a few flaky tests in DAML caused by our CLI
compiler losing diagnostics. The reason for that is the debouncer
which meant that messages got delayed and not send before the process
exited.

This PR makes the debouncer abstract and adds a noopDebouncer which
doesn’t do any debouncing. This is also what we use in the terminal
ghcide test thingy.
2020-02-06 20:57:55 +01:00
Moritz Kiefer
e59d3e2c77
Upgrade to haskell-lsp-0.20 (#405) 2020-02-05 10:14:13 +01:00
Moritz Kiefer
368cff7af5
Release ghcide 0.1.0 (#403) 2020-02-04 16:15:03 +01:00
fendor
1d04b09add
Update to latest hie-bios (#382)
* Update to latest hie-bios

* Remove explicit usage of type parameter Void from Cradle
2020-02-04 11:09:50 +01:00
Neil Mitchell
f3abff8b7c
Better progress messages (#379)
* Require shake-0.18.4 which contains actionBracket

* Change progress reporting to use files rather than Shake nodes

* Remove inadvertantly writing down Shake twice
2020-02-03 13:26:16 +01:00
Neil Mitchell
913aa5f9fa Don't support old haddock-library versions (#375)
* Don't support old haddock-library versions

* Update stack.yaml values

* Remove some more haddock_library CPP

* Make sure the latest haddock-library is on GHC 8.4
2020-01-28 20:20:38 +01:00
Moritz Kiefer
f695c50bda
Migrate tests for position mapping from DAML repository (#388)
Given that the code for this lives in ghcide it makes no sense for the
tests to be part of the DAML repository.
2020-01-28 10:31:28 +01:00
Alejandro Serrano
956e11dff8 Enhancements to Haddock -> Markdown conversion (#344)
* Enhancements to Haddock -> Markdown conversion

* Add tests for Haddock -> Markdown conversion

* Make HLint happy

* Let Haddock tests compile also in 8.4

* Fix build for 8.4

* Fix test for haddock-library 1.8.0

* Fix CPP problem

* Make tests a bit more readable

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-27 16:30:54 +01:00
Alan Zimmerman
742df7dd66 Add Development.IDE.GHC.Error to the public API (#369)
And noSpan
2020-01-26 13:26:09 +00:00
Neil Mitchell
331a144296 Add plugin type (#365)
* Add a plugin type

* Add a helper to construct codeAction values

* Remove a redundant $
2020-01-26 11:28:11 +00:00
Neil Mitchell
3ccebde867 Move the completions and code actions into Plugin (#359)
* Move the completions into a Plugin pile

* Fix HLint

* Turn CodeAction into a plugin as well

* Fix HLint

* Remove a redundant def <>
2020-01-26 09:36:48 +00:00
Alejandro Serrano
6d0b6ea18a Enhancements to hover (#317)
* Show kinds in hover

* Documentation on hover

* Enable kind tests

* Fix tests

* Print literals

* Show (some) overloaded literals

* Fix for 8.4

* Fix tests

* Do not consider literals for definitions

* Suggestions by @cocreature

* No warning for 8.4

* More fixes for 8.4

* Make it work with ghc-lib

* More fixes for warnings when compiled with ghc-lib

* More fixes to build in ghc-lib

* Try once again to build with ghc-lib

* More fixes for ghc-lib

* Fix warning with ghc-lib
2020-01-21 09:15:19 +01:00
Pepe Iborra
2d9314ae1d Fix performance of getFileExists (#322)
* Improve hover performance by speeding up getFileExists

We touch the file system only the first time.
After that, we rely on the lsp client to tell us if a file is created or deleted

Fixes #101
2020-01-21 09:05:58 +01:00
Pepe Iborra
703bb82a1d Fix -with-rtsopts flags (#333)
Before this change:
[nix-shell:~/scratch/ghcide]$ /home/pepe/scratch/ghcide/dist-newstyle/build/x86_64-linux/ghc-8.8.1/ghcide-0.0.6/x/ghcide/build/ghcide/ghcide  +RTS --info
 [("GHC RTS", "YES")
 ,("GHC version", "8.8.1")
 ,("RTS way", "rts_thr_p")
 ,("Build platform", "x86_64-unknown-linux")
 ,("Build architecture", "x86_64")
 ,("Build OS", "linux")
 ,("Build vendor", "unknown")
 ,("Host platform", "x86_64-unknown-linux")
 ,("Host architecture", "x86_64")
 ,("Host OS", "linux")
 ,("Host vendor", "unknown")
 ,("Target platform", "x86_64-unknown-linux")
 ,("Target architecture", "x86_64")
 ,("Target OS", "linux")
 ,("Target vendor", "unknown")
 ,("Word size", "64")
 ,("Compiler unregisterised", "NO")
 ,("Tables next to code", "YES")
 ,("Flag -with-rtsopts", "-A128M")
 ]

After this change:
[nix-shell:~/scratch/ghcide]$ /home/pepe/scratch/ghcide/dist-newstyle/build/x86_64-linux/ghc-8.8.1/ghcide-0.0.6/x/ghcide/build/ghcide/ghcide  +RTS --info
 [("GHC RTS", "YES")
 ,("GHC version", "8.8.1")
 ,("RTS way", "rts_thr")
 ,("Build platform", "x86_64-unknown-linux")
 ,("Build architecture", "x86_64")
 ,("Build OS", "linux")
 ,("Build vendor", "unknown")
 ,("Host platform", "x86_64-unknown-linux")
 ,("Host architecture", "x86_64")
 ,("Host OS", "linux")
 ,("Host vendor", "unknown")
 ,("Target platform", "x86_64-unknown-linux")
 ,("Target architecture", "x86_64")
 ,("Target OS", "linux")
 ,("Target vendor", "unknown")
 ,("Word size", "64")
 ,("Compiler unregisterised", "NO")
 ,("Tables next to code", "YES")
 ,("Flag -with-rtsopts", "-I0 -qg -A128M")
 ]
2020-01-19 17:06:12 +01:00
Pepe Iborra
85b83777bf GC tweaks (#329) 2020-01-17 16:27:39 +01:00
Moritz Kiefer
1b4cd9d8d7
Release ghcide 0.0.6 (#319)
* Release ghcide 0.0.6
2020-01-10 16:52:36 +01:00
Alejandro Serrano
a0aa013e33 Better docs for completions (#288)
* Remove JSON instances for completions, since we are not implementing "resolve"

* Remove completion resolve data from tests

* Better docs

* Fix tests

* Fix for 8.4

* Turn Haddock markup into Markdown

* Add types to completion items

* Make it work on 8.8 and 8.4

* Revert "Remove completion resolve data from tests"

This reverts commit 625d710f11.

* Revert "Remove JSON instances for completions, since we are not implementing "resolve""

This reverts commit 12ff27dce7.

* Fix tests

* Require higher version of regex-pcre-builtin

* Replace Pandoc with direct conversion from Haddock to Markdown

* Show kinds of type constructors too

* A few fixed to Markdown conversion

* Check optNewColonConvention

* Fix build on 8.4 and 8.8

* More fixes for 8.4 and 8.8

* Check only the common part of the completion text

* Make icons consistent with Outline

* Test docs for completions

* Make constructors return the corresponding CompletionItem + tests for that behavior

* Make test work on 8.4
2020-01-09 09:44:32 +01:00
Pepe Iborra
b78efe36bb Extend version message to include path and git commit (#306) 2020-01-06 09:13:14 +01:00
Neil Mitchell
2c96c9b87f Require hie-bios 0.3.2 or above (#286)
* Require hie-bios 0.3.2 or above

* Update stack.yaml files

* Use newer parser-combinators on GHC 8.4

* Bump parser combinators on 8.6

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-03 11:14:09 +01:00
Pepe Iborra
5ca06a1d24 Document symbols provider (#293)
* Document symbols provider

* Compatibility with GHC 8.4

* Replace large number with more descriptive maxBound

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Use SkFunction for all Val Declarations

* Improve outlining of PatBind and FunBind

No longer relying on gfindtype

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2019-12-31 10:31:55 +01:00
Pepe Iborra
0bcdc6a226 Fix for #45 - remove redundant symbols from imports (#290)
* Test for #45

* Remove redundant symbols from imports

Fixes #45

* Update src/Development/IDE/LSP/CodeAction.hs

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Add regex-tdfa extra deps to ghc-lib build

* Fix for GHC 8.4 (error message prints qualified binding)

GHC ticket #14881 changed this to print identifiers unqualified

* dropBindingsFromImportLine: make total

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2019-12-30 10:40:13 +01:00
Alejandro Serrano
b52ee607f9 [WIP] Completion support (#227)
* Initial implementation of completion support

* Add fuzzy to set of additional dependencies in 8.8

* Fix test

* Work a bit more on completion

* Attempt at getting completions from last good tckd module

* Revert "Attempt at getting completions from last good tckd module"

This reverts commit 04ca13b9d8.

* "useWithStale" everywhere

* Some suggestions by @cocreature

* Adjust positions in the document

* Start working on tests

* Fix compilation problem

* Fix tests

* Better type tests
2019-12-19 15:00:39 +01:00
Neil Mitchell
70cb92cc01 #279, support preprocessors (#282)
* Support preprocessors

* Add a preprocessor for testing

* Add a preprocessor test
2019-12-19 12:06:03 +01:00
Jacek Generowicz
7e18f84f81 Refactor hover and go-to-definition searching (#260)
The process of searching for definitions is similar to the process of searching
for hover information. In the original code (much of which was written out twice
with occasional stylistic differences) the signal to noise ratio seemed pretty
poor.

Here is a refactoring which aims to make it easier to see the similarities and
differences between these two related functionalities.
2019-12-18 09:50:30 +01:00
Moritz Kiefer
8ea5d69e18
Upgrade to haskell-lsp 0.19 (#254)
* Upgrade to haskell-lsp 0.19

* Clarify version handling
2019-12-16 14:57:38 +01:00
Moritz Kiefer
fc30f1476f
Upgrade to hie-bios (#257)
This does not yet take advantage of any new features but we should at
least be able to benefit from bugfixes.
2019-12-16 11:42:44 +01:00
Moritz Kiefer
9feb7c75fe
Prepare for ghcide 0.0.5 release (#236) 2019-12-12 20:04:34 +01:00
Greg Steuck
337a268d4c Tighten haskell-lsp* cabal bounds to match #203 (#215) 2019-11-28 06:10:02 +01:00
Jinwoo Lee
3bec234ddb Support plugins (#192)
* Support plugins

Call initializePlugins before running typecheck.

* call initializePlugins only for GHC >= 8.6

initializePlugins doesn't exist in older GHC versions.

* A separate function for initializing plugins

* Add a test for plugins
2019-11-15 09:27:28 +01:00
Jacek Generowicz
5645a8030c Move test sample code out to external file (#175)
* Move sample code out into into separate source file

* Add test/data/GotoHover.hs to cabal extra-source-files

* hlint: explicit module export list

* hlint: implement and use readFileUtf8

* hlint: remove -Wmissing-signatures
2019-10-22 16:41:13 +02:00
Moritz Kiefer
58b997d1aa
Prepare for new releases (#173)
* Prepare for new releases

* More accurate changelog
2019-10-20 17:57:34 -04:00
Moritz Kiefer
2755212f48
Switch to new releases of haskell-lsp and lsp-test (#171) 2019-10-18 20:58:26 +02:00
Moritz Kiefer
5febbcbc48
Fix progress reporting (#153)
* Fix progress reporting

* Bump haskell-lsp and lsp-test revisions

* Change client name

* Fix typo

* Bump revisions
2019-10-17 11:11:52 +02:00
Jacek Generowicz
2779dbb2e1 Add tests for find-definition and hover (#139)
* Add find definition tests

* Add tests for hovers
2019-09-29 12:03:16 +02:00
Neil Mitchell
60ed687de9 Support multiple hie.yaml files (#127)
* Hack around https://github.com/mpickering/hie-bios/pull/56 - hie-bios expects files to really exist on disk

* Fix getLocatedImportsRule to pass the file to the session

* Add support for multiple simultaneous hie.yaml files.
Also rewrites the user experience on setup to be less verbose.
Also adds masking for GHC session construction.

* HLint

* Code review comments

* Switch to the Strict map
2019-09-25 13:01:41 +02:00
Neil Mitchell
f050719d4f Add an upper bound to hie-bios (#122) 2019-09-24 20:41:52 +02:00
Neil Mitchell
32a049cc4c Add Paths_ghcide, fixes a warning (#117) 2019-09-24 00:09:20 +02:00
Moritz Kiefer
a581aa907f
Add changelog boilerplate (#111)
fixes #110
2019-09-23 14:54:06 +02:00
Moritz Kiefer
cec3159ace
Bump version in preparation for new release (#108) 2019-09-21 12:50:50 +02:00
Neil Mitchell
1a0b852ec0 Add a lower bound on hie-bios (#92) 2019-09-19 19:43:03 +02:00
Moritz Kiefer
29d84e835b
Enable more warnings for the ghcide codebase (#75) 2019-09-17 08:50:20 +02:00
jacg
4fc09fafa2 Code actions for filling typed holes (#69)
* Add code action for filling type holes

* Incorporate hole name into action title

Useful if more than one hole appears on the same line. Not so useful
if both of these holes are just `_` rather than `_name` (or more than
one hole on the same line has the same `_name`): In which case perhaps
some numbers could be attached to the action titles, to distinguish
the holes. But I suspect that this would not be worth the effort.

* Add tests for fill-type-hole actions

* Disable two tests on GHC 8.4

These test hints about local bindings, whic GHC 8.4 does not provide.

* Replace compilerVersion with new MIN_GHC_API_VERSION macro
2019-09-16 16:43:50 +02:00
Moritz Kiefer
2c24f2be15 Cleanup GHC API version checks
Previously we had a mix of GHC_STABLE and checks on
__GLASGOW_HASKELL__. This PR changes this to always check on
MIN_GHC_API_VERSION. Depending on whether you use ghc-lib or not (now
controlled by a cabal flag), this macro expands to MIN_VERSION_ghc or
MIN_VERSION_ghc_lib.
2019-09-16 11:34:25 +02:00
Neil Mitchell
18ee98f069 Pull the preprocessor functions into a separate module 2019-09-11 22:25:07 +01:00
Moritz Kiefer
351d9d01ad Update cabal file metadata to point to the new repo 2019-09-11 14:16:48 +02:00
Neil Mitchell
82d9d6248d
Add a lower bound on haskell-lsp (we are incompatilbe with 0.14) 2019-09-11 08:53:32 +01:00
Moritz Kiefer
5da86c3e44 Rename hie-core to ghcide (#2820)
* Rename hie-core to ghcide

The name `hie-core` has caused a lot of confusion as to how we relate
to haskell-ide-engine so changing it should hopefully help with that.
I also think that ghcide is still a good name once we hopefully
integrate with haskell-ide-engine more closely.

The name ghcide seems to have a reasonable amount of support on
Twitter https://twitter.com/ndm_haskell/status/1170681262987710464
which is of course the only good way to come up with names.

* Add a readme that points people to the new directory.

* Fix bogus replacements

* Use a proper link

* links are hard
2019-09-10 15:01:29 +02:00