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

Update some documentation #631

Merged
merged 1 commit into from
Jun 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 44 additions & 40 deletions docs/Dispatch.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
# Dispatch architecture
```
Message from
client
+ + +
| | |
| +-----v-----+ |
| | | |
<-------+IdeRequest<----+ Reactor +------->GhcRequest+------->
| | | |
| +-----------+ |
| |
| |
IdeM IdeGhcM +--------+
| +----->IdeResponseDeferred | | |
| | + +---------> |
| | | | | ghc |
| + | | | mod |
+------->IdeResponse | Triggers<----+ <---------+ |
| + ^ | | | | | |
| | | +---v-------v--+ | | | |
| | | | | + | +--------+
| | +-----------+ RequestQueue | cacheModule<---+
| | | | |
| | +--------------+ |
| | |
| | +----------------------------------------------+
| v v |
| IdeResult |
| + + |
| v | |
| IdeResultFail | |
| v |
| IdeResultOk |
| + |
| v |
| RequestCallback |
v + v
v
Possibly respond to
client if needed
Message from
client
+ + +
| | |
| +-----v-----+ |
| | | |
<-------+IdeRequest<----+ Reactor +------->GhcRequest+------->
| | | |
| +-----------+ |
| |
| |
IdeM IdeGhcM +--------+
| +----->IdeResponseDeferred | | |
plugins <--+ | + +---------> |
| | | | | | ghc |
+-------> + | | | mod |
+------->IdeResponse | Triggers<----+ <---------+ |
| + ^ | | | | | |
| | | +---v-------v--+ | | | |
| | | | | + | +--------+
| | +-----------+ RequestQueue | cacheModule<---+
| | | | |
| | +--------------+ |
| | |
| | +----------------------------------------------+
| v v |
| IdeResult |
| + + |
| v | |
| IdeResultFail | |
| v |
| IdeResultOk |
| + |
| v |
| RequestCallback |
v + v
v
Possibly respond to
client if needed
```

## Reactor
Expand All @@ -55,6 +55,10 @@ The 2 threads are represented by 2 monads: `IdeM` and `IdeGhcM`.
to ghc-mod, since `IdeGhcM` is used mainly for typechecking modules and is
the most constrained resource.

## Requests
To get onto the threads, send an `IReq` or `GReq` to the dispatcher with
`makeRequest` inside `LspStdio.hs:reactor`.

## Responses
If you are on `IdeM` and need access to a cached module, consider using an
`IdeResponseDeferred`. You can provide it with a `FilePath` to a module you
Expand All @@ -67,4 +71,4 @@ helper functions instead.
## Results
An `IdeResponse` will eventually return an `IdeResult` at the end of the day,
which will hand back data to the Reactor. `IdeGhcM` skips the response part
and returns an `IdeResult` directly since it will never need to be deferred.
and returns an `IdeResult` directly since it will never need to be deferred.
1 change: 1 addition & 0 deletions docs/Hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
```
$ git clone https://github.com/haskell/haskell-ide-engine.git
$ cd haskell-ide-engine
$ git submodule update --init
$ stack build
```

Expand Down
55 changes: 55 additions & 0 deletions docs/Packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Packages

```
+----------------------------+
| |
| haskell-ide-engine |
| |
| +------------------------+ | +------------------+
| | | | | |
| | haskell-ide-engine-api | +----> haskell-lsp-test |
| | | | | |
| +------------------------+ | +-+----------------+
| | |
+--------------------+-------+ |
| |
| |
+----v--------------v---+
| |
| haskell-lsp |
| |
| +-------------------+ |
| | | |
| | haskell-lsp-types | |
| | | |
| +-------------------+ |
| |
+-----------------------+

```

HIE is built upon various separate repositories and packages:

## [haskell-lsp](https://github.com/alanz/haskell-lsp)
Provides core functions for running a LSP server:
- Sending messages
- Parsing and receiving messages to various handlers
- Mirroring client documents in a virtual file system (VFS)

### haskell-lsp-types
A separate package within haskell-lsp that provides all the types as described in the specification.
Includes lenses and some helper functions for converting between types.
The separate package prevents unnecessary rebuilds of the template haskell files (which can take a long time) when working on haskell-ide-engine or haskell-lsp.

## [haskell-ide-engine](https://github.com/haskell/haskell-ide-engine)
An executable server that routes LSP requests to various tools in the haskell ecosystem.
Builds on top of haskell-lsp.
Uses plugins to connect the tools into the server.
Add plugin functionality in the `plugins` directory, and then hook it up to an appropriate LSP feature in `LspStdio.hs`.

### hie-plugin-api
Types, monads and functions for the plugins in `haskell-ide-engine`.

## haskell-lsp-test
A testing framework for LSP servers where scenarios can be captured or described in terms of messages.
Used by HIE for functional tests.