Recently, we fixed a bug in `prettyRange` where lines where rendered
1-based but columns 0-based. Let's make sure we don't get into such
weird situations again by adding a test.
* Switch back to bytecode
* return a HomeModInfo even if we can't generate a linkable
* set target to HscNothing
* add rule for GetModIfaceWithoutLinkable
* use IdeGlobal for compiled linkables
* Add code action for remove all redundant imports
* Call suggestRemoveRedundantImport only once
* Adjust tests for code action removing all redundant imports
* Update src/Development/IDE/Plugin/CodeAction.hs
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
* Refactor removeAll
* Update the test of remove all redundant imports
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
* Do not show internal hole names
* Better way to print holes as _
* Use suggestion by @alanz
* Remove unneeded import
* Give more time to suggestion tests
* Do not import GotoHover for testing suggestions
* Remove -f-external-interpreter for 8.10
* Rerun tests in the first step
* Rerun tests in the first step for linux
* Wait for register caps
* Remove -f-external-interpreter for 8.10
* Rerun tests in the first step
* Rerun tests in the first step for linux
* Wait for register caps
* Refactor ignoreInWindows* functions
* Ignore test for win and ghc-8.8
* Enable all win jobs (again)
* Ignore in win the known broken in nix
* Ignore addDependentFile for ghc-8.8
* Ignore findsTHnewNameConstructor for ghc-8.8
* Use --rerun-update in first test execution
To make sure it creates/overwrites .tasty-rerun-log
* Use object code for TH
* Set target location for TargetFiles
* Fix tests
* hlint
* fix build on 8.10
* fix ghc-lib
* address review comments
* hlint
* better error handling if module headers don't parse
* Always desugar, don't call interactive API functions
* deprioritize desugar when not TH, fix iface handling
* write hie file on save
* more tweaks
* fix tests
* disable desugarer warnings
* use ModGuts for exports map
* don't desugar
* use bytecode
* make HiFileStable early-cutoff
* restore object code
* re-enable desugar
* review comments
* Don't use ModIface for DocMap
* fix docs for the current module
* mark test as broken on windows
* Enable tests in windows ci
* Use lsp-test-0.11.0.6
* Fix tests in windows
* Use chocolatey to install cabal in ci
* Fix test: type constructor external
* Fix test: non workspace file
* Mark cpp-error as ignored for windows
* Ignore plugin tests for windows
* FileExists: set one watcher instead of thousands
This prevents us from sending thousands of notifications to the client
on startup, which can lock up some clients like emacs. Instead we send
precisely one.
This has some consequences for the behaviour of the fast file existence
lookup, which I've noted in the code, alongside a description of how it
works (I spent a while figuring it out, I thought I might as well write
it down).
Fixes#776.
* Use fast rules only if it matches our watcher spec
* Add GetHieAsts rule
* hlint
* fix build for 8.4
* Reimplement Hover/GotoDefn in terms of HIE Files.
Implement Document Hightlight LSP request
Add GetDocMap, GetHieFile rules.
* Fix gotodef for record fields
* Completion for locals
* Don't need to hack cursor position because of fuzzy ranges
* hlint
* fix bench and warning on 8.10
* disable 8.4 CI jobs
* Don't collect module level bindings
* tweaks
* Show kinds
* docs
* Defs for ModuleNames
* Fix some tests
* hlint
* Mark remaining tests as broken
* Add completion tests
* add highlight tests
* Fix HieAst for 8.6
* CPP away the unexpected success
* More CPP hacks for 8.10 tests
* Enable test suite to run in parallel
To run the test suite in parallel with Cabal:
> cabal test --test-options="+RTS -N"
Locally, this runs the test suite in 58s in a Xeon with 56 logical cores
Importantly, this change does not change CI
(unless stack passes +RTS -N secretly)
* Revert runInDir
* Tag unused warning as such
* Fix compilation for 8.4
* Always enable warning for unneeded elements + fix tests for them
* Apply suggestions by @ndmitchell
* Fix a diagnostics test after merge
Co-authored-by: Neil Mitchell <ndmitchell@gmail.com>
* Store client settings in ide state
* Log ide config registered in initHandler
* Use a Maybe aware updater function
* Create a Rule to get client settings
* Create a specific getter for client settings
* Trim trailing whitespace
* Use modifyVar to avoid race conditions
* Add comment to GetClientSettings
* Use defineEarlyCutOffNoFile for GetClientSettings
* Restart shake on config changed
* Use Hashed for clientSettings
* Send log notifications to client about session
* Show test output directly
* Add tests over client settings
* Apply hlint hints
* Simplify iface test to make it more robust
Following @pepeiborra advise
* Send session notifications only in test mode
* Retry bench execution
This
* fixes a part of https://github.com/digital-asset/ghcide/issues/614
by introducing a workaround for ghc droping some bindings that we still
need.
* Adds a regression test for this fix
* Adds a known broken test for the remaining part of the issue
* add failing test
* add fix (disable hasrecord due to linker error on my local machine)
* re-enable record-hasfield
* Allow CPP in Preprocessor module
* Revert "Allow CPP in Preprocessor module"
This reverts commit c392150421.
* apply pr 801
* move all the CPP to D.I.GHC.Compat
* fix hlint complaint
* unconditionally import MonadIO
* refactor, address PR comments
* isolate the two plugin tests
* minimize diff
* Fix test timeout
* Disable record pre processor test in 8.4
* Fix compiler warning on 8.4
* Fix yet another warning in 8.4
* Explicitly import for 8.4
* 8.4 again
* Don't apply this plugin in 8.4
The Plugins import is unavailable in 8.4
* CPP at it again
* Import paths are relative to cradle
I noticed ghcide HEAD was broken on the ghcide submodule of the hls repo.
* remove unused
* Fix comment placement
* Special case the implicit cradle
The implicit cradle comes without import paths, so we need to preserve the old
logic that synthetised them from the current module
* Hlint
* Fix timing issue: update known files before restarting the session
Also, DO NOT filter out missing targets
* Use --verbose when running tests
* Log test outputs on 3rd attempt
* Fall back to filtering known files
* hlint
* Upgrade KnownFiles to KnownTargets
* Use KnownTargets to filter modules, not module paths
* Fix test cradle
* Increase pauses in flaky test
* remove no longer needed check
* Disable ansi color codes in CI
* Disable flaky test
* Write ifaces on save
* Move isFileOfInterestRule to FileStore.hs and use real mtime for saved files
* hlint
* Add test
* fix flaky tests
* Only check for hie file in >= 8.6
* Cancellation of user actions
* Dispatch event handlers asynchronously
* add tests for asynchronous features
This adds a new Test plugin for custom requests
and a new blocking Command
* hlint
* Link the Testing plugin only when --testing
* Fix expectNoMoreDiagnostics
Needs also https://github.com/bubba/lsp-test/pull/74
* Upgrade lsp-test to a version that understands CustomClientMethod
* Refinement holes
* Set more GHC options and use indentation for parsing
* Add an option to customize the typed holes settings
Refinement hole fits are very cool, but currently too slow to enable at deeper
levels. It should eventually be user configurable.
* GHC Compatibility
* Compat. with 8.4
* tighten some return types
* Extract ShakeQueue from shakeSession
Instead of creating a new TQueue on every restart, we reuse the same TQueue
over and over.
The trickiest bit is to ensure that enqueued actions are always retried when
a Shake session is cancelled. The ActionQueue datatype is intended to manage
this complexity.
* Handle multiple user actions concurrently
* Fixes for .ghci
Unfortunately these are dependent on the ghc version
* redundant parens
* Formatting
* Attempt fix for completion tests
These tests are failing because ghcide is sending diagnostics interleaved with
completions now (which is good) and the tests cannot handle it
* remove debugging printout
* simplify
* Fix a test
* Fix flaky tests
* Show documentation on hover for symbols defined in the same module
When parsing a module, if parsing haddocks succeeds, then use them
Previously, even though we were parsing modules twice, with and without
haddocks, we were just returning the result of parsing without haddocks.
The reason for this was that Opt_KeepRawTokenStream and Opt_Haddock do
not interact nicely. We decided that for now it was better to fix an
actual issue and then solve the problem when hlint requires a module
with Opt_KeepRawTokenStream.
* Add option to decide which ParsedModule to return
* Add new command to GetModuleGraph for a session and propate changes to
modules
Only propagate changes to parent modules when saving
Typecheck files when they are opened, don't TC FOI
Add known files rule
Don't save ifaces for files with defered errors
Co-authored-by: Zubin Duggal <zubin@cmi.ac.in>
* Add configuration for parent typechecking
* hlint ignore
* Use targets to filter located imports (#10)
* Use targets to filter located imports
* Remove import paths from the GHC session
Otherwise GHC will prioritize source files found in the import path
* Update session-loader/Development/IDE/Session.hs
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
* Add session-loader to hie.yaml (#714)
* move known files rule to RuleTypes
* Disable checkParents on open and close document (#12)
* Really disable expensive checkParents
* Add an option to check parents on close
Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
Co-authored-by: Luke Lau <luke_lau@icloud.com>
* Add PatSynBind to GHC.Compat
* Tests for "export unused top level binding" codeaction
* Add "export unused top-level binding" codeaction
* exportUnusedTests refactored
* Fix export unused codeaction
* NFC: remove unused import
* hlint
* add exports to the end of list instead
* handle the case where last export end with comma
Currently this only searches local documentation (generated with
`cabal haddock --haddock-hyperlink-source` or equivalent) but could be
extended to support searching via Hoogle in the future. And it works for
any of the core libraries since they come installed with documentation.
Will show up in hover and (non-local) completions.
Also fixes extra markdown horizontal rules being inserted with no
content in between them.
* Code action: remove redundant constraints for type signature
* Handle peculiar formatting
Make the content parsing safe for type signature formatted with an
arbitrary and unexpected number of spaces and/or line feeds.
* Update to hie-bios 0.6.1
* Obtain the GHC libdir at runtime using hie-bios
This replaces hardcoding the GHC libdir path with ghc-paths and instead
gets it at runtime through the hie-bios cradle. This means that the
ghcide binary should be a bit more distributable now, since it won't
rely on paths baked at compile time that are local to the machine it was
compiled on. And we also no longer need the ghcLibCheck since we are
comparing the coompiled and runtime versions with the installationCheck
(ghcVersionChecker)
Co-authored-by: Fendor <power.walross@gmail.com>
* Code action to add default type annotation to satisfy the contraints
this is useful when using `traceShow` with with OverloadedStrings
and type-defaults warning enabled
Handle the following cases:
- there is one literal and one contraint to be satisfied
- there are mulitple literals and/or multiple constraints
Adding type annotations to expressions that trigger type-defaults
warning is not part of this changes
* Simplify older test
* Fix hlint issue
* Use global NameCache for reading HIE files
Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
* ignore hlint
* redundant imports
* Use hie files as source of truth for name source spans.
Since we started reusing `.hi` files, this exposes a bug where definitions
aren't available since a bad source span from the `.hi` file gets put into
the NameCache. We rectify by ensuring the span in the NameCache always matches
the one from the `.hie` file.
This has surfaced because an interaction between the commit which uses `.hi`
instead of retypechecking and the change to use the shared global NameCache
to read `.hie` files.
* Add test for missing definitions
Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
* Faster completions
* optimize withProgressVar
We never remove elements from the map so alter is unnecesary
* [ghcide-bench] accept ghcide options
* Expand completion tests suite
* hlints
* completions for local foreign decls
* Minor improvements for local completions
* Restore completion docs in legacy code path
* Compatibility with GHC < 8.8
* fix merge issue
* address review feedback
* Fix regression in SpanInfo haddocks for local modules
The regression was introduced in #630.
I added `GhcSessionDeps` with the idea of reusing the typecheck GHC session
for computing the SpanInfo, instead of rebuilding it from scratch.
But I forgot to actually reuse it, or maybe the change got lost during the merge.
* Add test