Commit Graph

400 Commits

Author SHA1 Message Date
sheaf
46c7634111 use GHC language extension names (#362) 2020-01-26 14:45:50 +00: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
19a346a3cc Add documentation (#368)
* Add documentation for Util.hs

* Add documentation to OfInterest
2020-01-26 12:37:10 +00:00
Neil Mitchell
7e133ea59c Delete unused function (#367) 2020-01-26 11:35:45 +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
556bebea9a Make the .ghci pick up the cabal-v1 Paths file (#363) 2020-01-26 11:17:22 +00:00
Alan Zimmerman
20a723a47f Fix typo (#366) 2020-01-26 11:11:40 +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
Neil Mitchell
0992bc7326 Make the .ghci work even if you don't have ghc-lib-parser installed (#358) 2020-01-25 17:04:42 +00:00
Pepe Iborra
f84dcf4f95 Simplify the abortion mechanism with async (#353)
* Extract a minimal Abortable abstraction from shakeRun

* Add an Abortable implementation with Async

* Switch to async implementation

Off-sourcing the details of aborting computations to a mature library

* Inline the async implementation

Abortable is nothing but a thin wrapper for 'Async'

* Call logDebug out of the withMVar lock

* Simplify withMVar'
2020-01-25 16:56:55 +00:00
Neil Mitchell
c32217b02b #346, don't use nameModule, which raises errors (#356)
* #346, don't use nameModule, which raises errors

* #346, ban nameModule, as its dangerous
2020-01-25 15:16:45 +00:00
Alejandro Serrano
1d32025e93 Keywords in completion (#351)
* Keywords in completion

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

Co-Authored-By: fendor <fendor@users.noreply.github.com>

* Fix the other usage of "keywrd"

Co-authored-by: fendor <fendor@users.noreply.github.com>
2020-01-25 08:36:20 +00:00
Neil Mitchell
eb0c0eaca9 Reduce the number of Stackage overrides (#349) 2020-01-24 16:05:19 +01:00
Moritz Kiefer
8f74783835
Disable getDocs call with ghc-lib (#342)
This has caused a bunch of issues in DAML where GHC seems to randomly
panics when completions are requested, see
https://github.com/digital-asset/daml/issues/4152 for the error. I am
not entirely sure what is going wrong there but `getDocs` also goes
through the GHCi codepaths which are known to cause issues with
ghc-lib so for now, let’s disable it.
2020-01-23 17:50:12 +01:00
Alejandro Serrano
2154bb2eaf Show constraints on hover (#338) 2020-01-22 10:40:26 +01:00
Nikos Baxevanis
c147e625d3 Fix build on Windows/MinGW (#337)
This was causing the following error when trying to build under MinGW:

    [28 of 38] Compiling Development.IDE.Core.FileStore

    C:\Snapshot\src\ghcide\src\Development\IDE\Core\FileStore.hs:142:20: error:
        Not in scope: `Dir.getModificationTime'
        No module named `Dir' is imported.
        |
    142 |         do time <- Dir.getModificationTime f
        |                    ^^^^^^^^^^^^^^^^^^^^^^^
2020-01-21 16:15:19 +01:00
Rob Rix
2f5d0d3e69 Fix the build for ghc-8.8.2. (#335)
* Fix the build for ghc-8.8.2.

* Match the single-element list first.

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

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-21 14:30:13 +01: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
Andy
1929fde73c Readme: Consistent language server command (#332)
Solves #331
2020-01-19 16:18:28 +01:00
Pepe Iborra
85b83777bf GC tweaks (#329) 2020-01-17 16:27:39 +01:00
Moritz Kiefer
e180a626eb
Avoid lookupName on ghc-lib (#327)
This fixes an issue that we encountered in DAML. I’ll add a test for
this in the DAML repo since we cannot test the ghc-lib codepath
here (since we don’t setup an environment that works).
2020-01-16 17:55:23 +01:00
Pepe Iborra
789f4031e6 Code action to insert new definitions (#309)
* code action to insert new definitions
2020-01-13 09:08:54 +01:00
Moritz Kiefer
1b4cd9d8d7
Release ghcide 0.0.6 (#319)
* Release ghcide 0.0.6
2020-01-10 16:52:36 +01:00
Moritz Kiefer
4f61cb66c9
Fix source spans for multi-clause definitions (#318)
* Fix source spans for multi-clause definitions

Currently, we use the source span of the match which corresponds to
the whole clause instead of just the function identifier. This
resulted in us pointing every goto definition request within a clause
to the function if there is no other information (either because it
failed because it came from an external package or simply because you
are not on an identifier).

This PR fixes this by getting the proper source spans frmo the
HsMatchContext. Somewhat annoyingly, we have to get it from the parsed
module since GHC messes this up during typechecking but it’s
reasonably simple.
2020-01-10 15:37:09 +01:00
Moritz Kiefer
eb96e2c859
Fix HLint (#316)
The new version introduced a new hint that broke our build.
2020-01-10 10:23:44 +01:00
Alejandro Serrano
c122ebdc4f Trigger completion after dot (#313)
* Trigger completion after dot

* Fix stupid mistake in test
2020-01-10 10:05:44 +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
Jacek Generowicz
5f4384e8ef Tests for issue 310 (misleading hover on inner signature) (#311)
* Tests for issue 310 (misleading hover on inner signature)

The most important pair of tests here is the "inner signature" pair. The others
serve mainly to document, compare and contrast what is happening in related
situations.

In summary, hover and gotoDef

+ on inner signatures: give type and location information for the outer
  definition; this is misleading,

+ on outer signatures: give no information at all,

+ on inner definitions: give correct information for the inner definition,

+ on outer definitions: give correct information for the outer definition.

Should hover and gotoDef do anything at all for signatures? or is the current
behaviour for outer signatures (doing nothing at all) what we want?

* Require signature hover/gotoDef to point to first clause of definition

* Remove perhaps superfluous tests for definitions
2020-01-08 14:27:31 +01:00
Pepe Iborra
b7208a333f Smarter logic to remove redundant import bindings (#308)
* Smarter logic to remove redundant import bindings

The new code finds the spans to remove using the GHC parse tree, then manually
extends them to include commas/spaces.

Fixes #299

* Compatibility with GHC 8.4

* Improve comment

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

* Use breakOnEnd in unqualify

This will handle A.foo as well as A.B.foo

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2020-01-08 12:01:59 +01:00
Pepe Iborra
db456b0e51 Add a new flag --shake-profiling DIR (#307)
The flag provides a way to enable Shake profiling reports without recompiling.
Debug output prints links to the Shake reports for convenience
2020-01-06 19:56:40 +01:00
Pepe Iborra
fd163cd8e9 Insert imports code action (#295)
*  #46 Code action to add suggested imports

* code action to fix constructor imports

* #46 Add test for (broken) constructor import
2020-01-06 09:37:53 +01:00
Pepe Iborra
f8e6ab171f Fix #247 (#292) 2020-01-06 09:17:22 +01:00
Alejandro Serrano
821c7f6ffa Remove JSON instances for unused completion code (#305)
* Remove JSON instances for completions, since we are not implementing "resolve"

* Remove completion resolve data from tests
2020-01-06 09:16:00 +01:00
Jinwoo Lee
8f50699d24 Collect CPP error logs into diagnostics. (#296)
* Collect CPP error logs into diagnostics.

Fixes https://github.com/digital-asset/ghcide/issues/87
2020-01-06 09:14:55 +01:00
Pepe Iborra
b78efe36bb Extend version message to include path and git commit (#306) 2020-01-06 09:13:14 +01:00
Moritz Kiefer
64693eddd8
Fix check for empty file path (#304)
I accidentally broke this on Windows in #303 by letting the two
conversirons get out of sync.
2020-01-04 01:25:31 +01:00
Moritz Kiefer
7e80629188
Fix performance regression introduced by filepath normalisation (#303)
We already normalise filepaths in NormalizedFilePath. haskell-lsp
changed things such that the conversion from Uri to NormalizedUri
normalises the filepath again which caused a significant slowdown in
GetFileExists.

We already have a wrapper for converting from NormalizedFilePath to
NormalizedUri so this PR changes this wrapper to inline the definition
without the additional layer of normalisation.

fixes #298
2020-01-03 16:01:12 +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
6bb1e4e05a jjk (#300) 2020-01-02 17:31:51 +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
Gabriele Lana
359cdf5b24 Swapped argument names (#289) 2019-12-23 10:48:38 +01:00
Nikos Baxevanis
31edb5b010 Add Sublime Text section on the README (#287) 2019-12-20 09:47:00 +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
b1435e2aee Tests for issue #283 (#284) 2019-12-19 10:29:53 +01:00
Neil Mitchell
d06894fd79 Make hie.yaml hie-bios-0.3 compatible (#280) 2019-12-18 23:02:40 +01:00
Neil Mitchell
81f78a403b Add Atom plugin link (#278)
* Add Atom plugin link

* Fix typo
2019-12-18 23:00:43 +01:00