* Preventively switch to uninterruptible mask in withMVar'
withMVar' is used to update the shakeSession var and it's crucial that the
third argument is not interrupted.
'mask' can still be interrupted for I/O actions and, while we were careful to
ensure none was used, if it ever breaks it will lead to very hard to debug
problems.
* refactor: move to RuleTypes
* Add a TestRequest to wait for arbitrary ide actions
Closes#955
* expectCurrentDiagnostics
* Add a test suite for cancellation
* Introduce --test-no-kick to fix cancellation tests reliability
* delete unsafeClearDiagnostics (unused)
* GetModSummaryWithoutTimestamps - remove StringBuffer
Since the contents of the buffer are not tracked by the fingerprint.
* Fix diagnostics bug
Given a FOI F with non null typechecking diagnostics D, imagine the following scenario:
1. An edit notification for F is received, creating a new version
2. GetModTime is executed, producing 0 diagnostics.
2.1 updateFileDiagnostics is called
2.2 setStageDiagnostics is called
2.3 LSP.updateDiagnostics is called with a new version, resetting all the
diagnostics for F
2.4 newDiags=[] in updateFileDiagnostics, which is different from D (the last
published diagnostics), which enqueues a new publishDiagnostics [] in the
Debouncer
3. An edit notification for F is received before typechecking has a chance to
run which undoes the previous edit
4. The debouncer publishes the empty set of diagnostics after waiting 0.1s
5. GetFileContents runs and since the contents of the file haven't changed since
the last time it ran, early cutoff skips everything donwstream
Since TypeCheck is skipped, the empty set of diagnostics stays published until
another edit comes.
The goal of this change is to prevent setStageDiagnostics from losing
diagnostics from other stages. To achieve this, we recover the old diagnostics
for all stages and merge them with the new stage.
* Fix hlint
* Use Map.insert for clarity
* Fix redundant imports
* Fix "code actions after edit" experiment"
* Use qualified module name from diagnostics in suggestNewImport
* Update tests
* Add newline
* Use qualified module name from diagnostics in suggestNewImport
* Update tests
* Add newline
* Remove unused renderImport
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
In an effort to move Completions into its own hls-plugin package we have a dependency to access the getDocumentation function exposed in this module. Therefore, can we expose this module so that we will be able to access that function.
* Trace rule errors
* Disable check parents in command line script
* Fix expectDiagnostics []
* Add a test
* remove uses of stale info within rules
The use of stale information should be limited to the leaves of the processing
tree, otherwise it becomes impossible to reason about the semantics of diagnostics
* Use stale info in the NeedsCompilation rule
* Use stale data in GetDocMap
* Fix tests that relied on unsupported behaviour of expectDiagnostics
* Remove language extension completions.
* Remove code actions for language pragma extensions.
* Remove unused defintions and imports
* Remove test defintion use
* Update comment describing why we return an empty list
* Extend CI matrix with all the GHC minor versions supported by HLS
* Adding a new job for windows: ghc-8.10.2.2
* Use GADTs for all ghc versions in Development.IDE.Plugin.Completions.Logic
* Fix ghc-8.8.2 and ghc-8.8.3 builds
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
* [bench-hist] break down in rule functions
* Extract the benchmarking Shake rules to a shake-bench package
There's some room for reusing the rules used in the historic benchmarking suite
in other projects. This change makes that a bit easier and improves the
documentation and code structure.
The new structure is:
- lib:shake-bench - a Cabal library with functions to generate Shake rules
- ghcide:bench:benchHist - the ghcide instantiation of the above Shake rules
That's not to say that shake-bench is completely decoupled from ghcide -
there are still plenty of assumptions on how the benchmarks are organized, their
outputs, etc. But with a little bit of effort, it should be easy to make
these rules more reusable
* Fix nix build
* Fix license
* hlints and redundant imports
* more hlints
* Exclude shake-bench from the stack build
* Use exports map
* Use exports map in suggestExtendImport
* Update test
* Support extend constructor
* Revert format changes
* Support extending constructors
* Fix multi line
* Move tracing functions to own module
* Bump opentelemetry to 0.6.0
* Write Values map size to OpenTelemetry metric
* Trace all requests and notifications
Instead of doing it in `HoverDefinition`, do it in
with{Response,Notification,...}. These wrap all handlers, so this should
cover everything. It also means that the span covers the entire
processing time for the request, where before we missed the setup
happening in the with* functions.
* Add flag for OpenTelemetry profiling
Run GC regularly with --ot-profiling
* Add flag to enable OT profiling in benchmark
* Use heapsize instead of ghc-datasize
I renamed the fork to distringuish from the original.
It is still being pulled from git using stack. This will be addressed
once I can push the fork to hackage.
* Bump opentelemetry to 0.6.1 - fixes 8.6 build
* Use heapsize from hackage
* Address HLint messages
* Record size of each key independently
* Refactor `startTelemetry` function
* Remove delay between measuring memory loops
* Each key in values map gets own OT instrument
* Measure values map length more rarely
* Rename --ot-profiling to --ot-memory-profiling
* Add docs for how to use the opentelemetry output
* Add instructions to build release version of tracy
* Clarify dependencies in opentelemetry instructions
* Fix LSP traces
* otTraced: delete unused
* Extract types out of D.IDE.Core.Shake
to avoid circular module dependencies
* Extract startTelemetry out of D.IDE.Shake and upgrade to 0.2
No more segfaults
* [nix] install opentelemetry
* [nix] install tracy
* Fix merge wibble
* Measure recursive sizes with sharing
* Sort keys for cost attribution
* Remove debug traces
* Allocate less, group keys, clean up hlints
* Add -A4G to the flags used for --ot-memory-profiling
* Modularize D.IDE.Core.Tracing
I want to reuse this code more directly in the non lsp driver
* Direct driver: report closure sizes when --ot-memory-profiling
An eventlog memory analysis doesnt' seem so relevant since this mode is not
interactive, but we could easily produce both if wanted to
* Everything is reachable from GhcSessionIO, so compute it last
I suspect the ShakeExtras record is reachable from GhcSessionIO
* bound recursion and use logger
* hlint suggestions
* Fix 8.6 build
* Format imports
* Do the memory analysis with full sharing. GhcSessionIO last
* Fail fast in the memory analysis
* error handling
* runHeapsize now takes initSize as an input argument
* Trace Shake sessions
* Reduced frequency for sampling values length
* Drop the -fexternal-interpreter flag in the Windows stack build
* Produce more benchmark artifacts
* Fix stack descriptors to use heapsize-0.2 from Hackage
* Bump to heapsize-0.3.0
* Record completions snippets (#900)
* Add field for RecordSnippets to CachcedCompletion
* Initial version of local record snippets
* Supprt record snippet completion for non local declarations.
* Better integration of local completions with current implementation
* Clean up non-local completions.
* Remove commented code.
* Switch from String to Text
* Remove ununsed definition
* Treat only Records and leave other defintions as is.
* Differentiate Records from Data constructors for external declaration
* Update test to include snippet in local record completions expected list.
* Update completionTest to also compare insertText.
* Add test for record snippet completion for imported records.
* Hlint fixes
* Hlint fixes
* Hlint suggestions.
* Update type.
* Consolidate imports
* Unpack tuple with explicit names
* Idiomatic changes
* Remove unused variable
* Better variable name
* Hlint suggestions
* Handle exhaustive pattern warning
* Add _ to snippet field name suggestions
* Remove type information passed around but not used
* Update to list comprehension style
* Eliminate intermediate function
* HLint suggestions.
* Idiomatic list comprehension
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
* [nix] use gitignore.nix (#920)
* Ignore import list while producing completions (#919)
* Drop any items in explicit import list
* Test if imports not included in explicit list show up in completions
* Update README.md (#924)
* Custom cradle loading (#928)
When using ghcide as a library, it may be desirable to host the hie.yaml file
in a location other than the project root, or even avoid the file system altogether
* Favor `lookupPathToId` over `pathToId` (#926)
* Favor `lookupPathToId` over `pathToId`
* Fix `typecheckParentsAction`
* Fix `needsCompilationRule`
* Return completion snippets only when client supports it (#929)
* Use the real client capabilities on completions
* Return completion snippets only when supported by the client
Restored from https://github.com/haskell/ghcide/pull/900
* Redundant import
* Fix stack windows build
Co-authored-by: Michalis Pardalos <m.pardalos@gmail.com>
Co-authored-by: Michalis Pardalos <mpardalos@gmail.com>
Co-authored-by: Guru Devanla <gdevanla@users.noreply.github.com>
Co-authored-by: Samuel Ainsworth <skainsworth@gmail.com>
The Stack Windows build is problematic:
https://github.com/haskell/ghcide/pull/922
Stack is already covered by the Azure CI
Windows is already covered by the Github Actions CI
* Drop any items in explicit import list
* Test if imports not included in explicit list show up in completions
* Update CompItem to hold additionalTextEdit
* Add placeholder value for additionalTextEdit field
* Improvement completion tests.
* Use explicit fields while constructing CompletionItem
* Add function that will extend an import list
* Use externalImports to extend import list
* Make import list information available
* First working prototype of extending import list.
* Pass the original importDecl to cacheDataProducer
* Add tests for completions with addtional text edits
* Hlinting
* Refine function name and signature
* Pass the original importDecl to cacheDataProducer
* Refactor code to use gaurds
* Exhaust patterns
* Handle empty import list
* Use correct pattern
* Update expected values in TextEdit
* Add test adding imports to empty list
* Remove old code
* Handle names with underscore
* Exhaust patterns
* Improve storing of import map
* Add trailing comma to import list completions.
* Add support for Record snippets
* Add 8.8.4 support
* Code cleanup.
* Use the real client capabilities on completions
* Return completion snippets only when supported by the client
Restored from https://github.com/haskell/ghcide/pull/900
When using ghcide as a library, it may be desirable to host the hie.yaml file
in a location other than the project root, or even avoid the file system altogether
* Add field for RecordSnippets to CachcedCompletion
* Initial version of local record snippets
* Supprt record snippet completion for non local declarations.
* Better integration of local completions with current implementation
* Clean up non-local completions.
* Remove commented code.
* Switch from String to Text
* Remove ununsed definition
* Treat only Records and leave other defintions as is.
* Differentiate Records from Data constructors for external declaration
* Update test to include snippet in local record completions expected list.
* Update completionTest to also compare insertText.
* Add test for record snippet completion for imported records.
* Hlint fixes
* Hlint fixes
* Hlint suggestions.
* Update type.
* Consolidate imports
* Unpack tuple with explicit names
* Idiomatic changes
* Remove unused variable
* Better variable name
* Hlint suggestions
* Handle exhaustive pattern warning
* Add _ to snippet field name suggestions
* Remove type information passed around but not used
* Update to list comprehension style
* Eliminate intermediate function
* HLint suggestions.
* Idiomatic list comprehension
Co-authored-by: Pepe Iborra <pepeiborra@me.com>
* Add an action to build and cache the nix-shell
* [nix] ghc-paths must always be in the package set
Otherwise ghc-check will not get the Nix libdir and fail at compile time
* [nix] extract the nixpkgs instantiation to nix/default.nix
* [nix] niv init
* [nix] switch to haskell-updates
* Mention the Cachix binary cache in the README
* [nix] pin the version used to set up Cachix
* [nix] disable tests and jailbreak 8.10.x packages
* [nix] rely on cabal2nix to enumerate the dependencies
* [nix] install haskell tools from the Nix cache
* Add support for extending import list when multiple options are available
* Add function to module export list to make it available for testing
* Fix typo
* Add doc strings
* Add tests for testing regex used to parse multiple choices for import suggestions.
* Add test group
* Remove trailing spaces
* Hlint suggestions
* Remove not used variable
* Remove temporary code
* Reuse matchRegExUnifySpaces
* Fix test input.
* Use testCase instead of testSession
* Update extend import tests to assert on multiple actions.
* Extend extendImports to use multiple modules for setup
* Hlint changes
* Add github test action
* Disable unreliable test
Does not work reliably on all platforms.
Reenable when #861 lands
* Add hlint and -Werror
* Explicit timeout
6h is the default and also the maximum:
https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration
* Experiment tests to use Cabal instead of Stack
* Fix an unreliable test
* Trim down matrix
* Add ghc-lib to the test matrix
* Address broken hie-compat ghc-lib build
* Drop stack descriptor family
We keep two stack descriptors:
- One for Nightly
- One for Windows (stuck in GHC 8.10.1)
To ensure that `stack test` doesn't break, we keep running the stack tests in CI
* Update README to point end users to HLS
* Drop support for `stack test`
* Avoid calling kick explicitly
Leverages that rules are rerun by shakeRunDatabase.
Allows users of ghcide as a library to use their own kick
* Tweak doc comment
* Fix plugin tests for 'cabal test'
* Check for Haddocks on Int instead of Text
The text package may have been installed without documentation, in which case
the test will fail. base is always installed with documentation
* Fix test in Mac OS
* Ignore plugin tests in GHC 8.10.1
The changelog is a trimmed down summary of the git log.
I have removed several non-user visible changes while making sure that
everyone who contributed is listed at least once.
* Compatibility with fbghc
Rather than forking ghcide, we use conditional compilation to build with https://github.com/facebook/fbghc hopefully only until certain changes have been upstreamed.
* Reexport DynFlags from Compat.GHC
* Add a link to the fbghc repo