Skip to content

Commit 73eef27

Browse files
committed
Rework features documentation
This does a few things: - Adds a clear listing of which LSP methods we support, and which we don't (requested a couple of times recently). - Lists every code action and code lens, which plugin provies them, their status, and code action kind where applicable (apart from Wingman because there are lots and I couldn't figure it all out). Possibly some of this information belongs elsewhere, e.g. perhaps instead of listing which versions don't have full support on this page, we should instead add a page to the GHC support page that lists which plugins work on which versions. Not sure.
1 parent 70bb0ab commit 73eef27

File tree

4 files changed

+256
-36
lines changed

4 files changed

+256
-36
lines changed

docs/_static/theme_overrides.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* Fix table wrapping https://github.com/readthedocs/sphinx_rtd_theme/issues/117 */
2+
@media screen and (min-width: 768px) {
3+
.wy-table-responsive table td, .wy-table-responsive table th {
4+
white-space: normal !important;
5+
}
6+
}

docs/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@
8686

8787
# Enable linking to an anchor of a relative page
8888
# See https://github.com/executablebooks/MyST-Parser/issues/443
89-
myst_heading_anchors = 2
89+
myst_heading_anchors = 3
90+
91+
# -- Custom Document processing ----------------------------------------------
92+
93+
def setup(app):
94+
app.add_css_file("theme_overrides.css")

docs/features.md

Lines changed: 243 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,266 @@
11
# Features
22

3-
You can watch demos for some of these features [below](#demos).
4-
5-
- Warning and error diagnostics from GHC
6-
- Type information and documentation on hover, [including your own comments](./configuration.md#how-to-show-local-documentation-on-hover).
7-
- Jump to definition: [for now only for local code definitions](https://github.com/haskell/haskell-language-server/issues/708)
8-
- Document symbols
9-
- Highlight references in document
10-
- Code completion
11-
- Formatting via [Brittany](https://github.com/lspitzner/brittany), [Floskell](https://github.com/ennocramer/floskell), [Fourmolu](https://github.com/fourmolu/fourmolu), [Ormolu](https://github.com/tweag/ormolu) or [Stylish Haskell](https://github.com/haskell/stylish-haskell)
12-
- [Code evaluation](#code-evaluation), see its [Tutorial](https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-eval-plugin/README.md)
13-
- [Integration with](#retrie-integration) [retrie](https://hackage.haskell.org/package/retrie), a powerful, easy-to-use codemodding tool
14-
- [Code lenses for explicit import lists](#explicit-import-lists)
15-
- [Generate functions from type signatures, and intelligently complete holes](#wingman) using [Wingman (tactics)](https://github.com/haskell/haskell-language-server/tree/master/plugins/hls-tactics-plugin)
16-
- [Integration](#hlint) with [hlint](https://github.com/ndmitchell/hlint), the most used haskell linter, to show diagnostics and apply hints via [apply-refact](https://github.com/mpickering/apply-refact)
17-
- [Module name suggestions](#module-names) for insertion or correction
18-
- [Call hierarchy support](#call-hierarchy)
19-
- [Qualify names from an import declaration](#qualify-imported-names) in your code
20-
- [Suggest alternate numeric formats](#alternate-number-formatting)
21-
22-
## Demos
23-
24-
### Code evaluation
3+
This table gives a summary of the features that HLS supports.
4+
Many of these are standard LSP features, but a lot of special features are provided as [code actions](#code-actions) and [code lenses](#code-lenses).
255

26-
![Eval Demo](https://raw.githubusercontent.com/haskell/haskell-language-server/master/plugins/hls-eval-plugin/demo.gif)
6+
| Feature | Status | [LSP method](./what-is-hls.md#lsp-terminology) |
7+
|-----------------------------------------------------|---------------------------------|---------------------------------------------------------------------------------------------------|
8+
| [Diagnostics](#diagnostics) | Limited on some versions of GHC | `textDocument/publishDiagnostics` |
9+
| [Hovers](#hovers) | Working | `textDocument/hover` |
10+
| [Jump to definition](#jump-to-definition) | Working | `textDocument/definition` |
11+
| [Jump to type definition](#jump-to-type-definition) | Working | `textDocument/typeDefinition` |
12+
| [Find references](#find-references) | Working | `textDocument/references` |
13+
| [Completions](#completions) | Working | `textDocument/completion` |
14+
| [Formatting](#formatting) | Limited on some versions of GHC | `textDocument/formatting`, `textDocument/rangeFormatting` |
15+
| [Document symbols](#document-symbols) | Working | `textDocument/documentSymbol` |
16+
| [Workspace symbols](#workspace-symbols) | Working | `workspace/symbol` |
17+
| [Call hierarchy](#call-hierarchy) | Working | `textDocument/prepareCallHierarchy`, `callHierarchy/incomingCalls`, `callHierarchy/outgoingCalls` |
18+
| [Highlight references](#highlight-references) | Working | `textDocument/documentHighlight` |
19+
| [Code actions](#code-actions) | Limited on some versions of GHC | `textDocument/codeAction` |
20+
| [Code lenses](#code-lenses) | Limited on some versions of GHC | `textDocument/codeLens` |
2721

28-
### Retrie integration
22+
The individual sections below also identify which [HLS plugin](./what-is-hls.md#hls-plugins) is responsible for providing the given functionality, which is useful if you want to raise an issue report or contribute!
2923

30-
![Retrie Demo](https://i.imgur.com/Ev7B87k.gif)
24+
## Diagnostics
3125

32-
### Explicit import lists
26+
### GHC compiler errors and warnings
27+
Provided by: `ghcide`
3328

34-
![Imports code lens Demo](https://imgur.com/pX9kvY4.gif)
29+
Provides errors and warnings from GHC as diagnostics.
3530

36-
### Wingman
31+
### Hlint hints
32+
Status: Not supported on GHC 9.2
3733

38-
![Wingman Demo](https://user-images.githubusercontent.com/307223/92657198-3d4be400-f2a9-11ea-8ad3-f541c8eea891.gif)
34+
Provided by: `hls-hlint-plugin`
3935

40-
### Hlint
36+
Provides hlint hints as diagnostics.
4137

42-
![Hlint Demo](https://user-images.githubusercontent.com/54035/110860028-8f9fa900-82bc-11eb-9fe5-6483d8bb95e6.gif)
38+
## Hovers
39+
Provided by: `ghcide`
4340

44-
### Module names
41+
Type information and documentation on hover, [including from local definitions](./configuration.md#how-to-show-local-documentation-on-hover).
4542

46-
![Module Name Demo](https://user-images.githubusercontent.com/54035/110860755-78ad8680-82bd-11eb-9845-9ea4b1cc1f76.gif)
43+
## Jump to definition
44+
Provided by: `ghcide`
45+
46+
Jump to definition, [for now only for local code definitions](https://github.com/haskell/haskell-language-server/issues/708).
47+
48+
## Jump to type definition
49+
Provided by: `ghcide`
50+
51+
## Find references
52+
Provided by: `ghcide`
53+
54+
Find references to a name within the project.
55+
56+
## Completions
4757

48-
### Call hierarchy
58+
### Code completions
59+
Provided by: `ghcide`
60+
61+
- Completion of names from qualified imports.
62+
- Completion of names from non-imported modules.
63+
64+
### Pragma completions
65+
Provided by: `hls-pragmas-plugin`
66+
67+
Completions for language pragmas.
68+
69+
## Formatting
70+
Format your code with various Haskell code formatters.
71+
72+
| Formatter | Status | Provided by |
73+
|-----------------|---------------------------------|------------------------------|
74+
| Brittany | Not supported on GHC 9.2 | `hls-brittany-plugin` |
75+
| Floskell | Working | `hls-floskell-plugin` |
76+
| Fourmolu | Working | `hls-fourmolu-plugin` |
77+
| Ormolu | Working | `hls-ormolu-plugin` |
78+
| Stylish Haskell | Not supported on GHC 9.0 or 9.2 | `hls-stylish-haskell-plugin` |
79+
80+
## Document symbols
81+
Provided by: `ghcide`
82+
83+
Provides listing of the symbols defined in a module, used to power outline displays.
84+
85+
## Workspace symbols
86+
Provided by: `ghcide`
87+
88+
Provides listing of the symbols defined in the project, used to power searches.
89+
90+
## Call hierarchy
91+
Provided by: `hls-call-hierarchy-plugin`
92+
93+
Shows ingoing and outgoing calls for a function.
4994

5095
![Call Hierarchy in VSCode](https://github.com/haskell/haskell-language-server/raw/2857eeece0398e1cd4b2ffb6069b05c4d2308b39/plugins/hls-call-hierarchy-plugin/call-hierarchy-in-vscode.gif)
5196

97+
## Highlight references
98+
Provided by: `ghcide`
99+
100+
Highlights references to a name in a document.
101+
102+
## Code actions
103+
104+
### Insert missing pragmas
105+
Provided by: `hls-pragma-plugin`
106+
107+
Code action kind: `quickfix`
108+
109+
Inserts missing pragmas needed by GHC.
110+
111+
### Apply Hlint fixes
112+
Status: Not supported on GHC 9.2
113+
114+
Provided by: `hls-hlint-plugin`
115+
116+
Code action kind: `quickfix`
117+
118+
Applies hints, either individually or for the whole file.
119+
Uses [apply-refact](https://github.com/mpickering/apply-refact).
120+
121+
![Hlint Demo](https://user-images.githubusercontent.com/54035/110860028-8f9fa900-82bc-11eb-9fe5-6483d8bb95e6.gif)
122+
123+
### Make import lists fully explicit
124+
Provided by: `hls-explicit-imports-plugin`
125+
126+
Code action kind: `quickfix.literals.style`
127+
128+
Make import lists fully explicit (same as the code lens).
129+
52130
### Qualify imported names
131+
Provided by: `hls-qualify-imported-names-plugin`
132+
133+
Code action kind: `quickfix`
134+
135+
Rewrites imported names to be qualified.
53136

54137
![Qualify Imported Names Demo](../plugins/hls-qualify-imported-names-plugin/qualify-imported-names-demo.gif)
55138

56-
### Alternate Number Formatting
139+
### Refine import
140+
Provided by: `hls-refine-imports-plugin`
141+
142+
Code action kind: `quickfix.import.refine`
143+
144+
Refines imports to more specific modules when names are re-exported (same as the code lens).
145+
146+
### Add missing class methods
147+
Status: Not supported on GHC 9.2
148+
149+
Provided by: `hls-class-plugin`
150+
151+
Code action kind: `quickfix`
152+
153+
Adds placeholders for missing class methods in a class instance definition.
154+
155+
### Unfold definition
156+
Status: Not supported on GHC 9.2
157+
158+
Provided by: `hls-retrie-plugin`
159+
160+
Code action kind: `refactor.extract`
161+
162+
Extracts a definition from the code.
163+
164+
### Fold definition
165+
Status: Not supported on GHC 9.2
166+
167+
Provided by: `hls-retrie-plugin`
168+
169+
Code action kind: `refactor.inline`
170+
171+
Inlines a definition from the code.
172+
173+
![Retrie Demo](https://i.imgur.com/Ev7B87k.gif)
174+
175+
### Insert contents of Template Haskell splice
176+
Status: Not supported on GHC 9.2
177+
178+
Provided by: `hls-splice-plugin`
179+
180+
Code action kind: `refactor.rewrite`
181+
182+
Evaluates a Template Haskell splice and inserts the resulting code in its place.
183+
184+
### Convert numbers to alternative formats
185+
Status: Not supported on GHC 9.2
186+
187+
Provided by: `hls-alternate-number-format-plugin`
188+
189+
Code action kind: `quickfix.literals.style`
190+
191+
Converts numeric literals to different formats.
57192

58193
![Alternate Number Format Demo](../plugins/hls-alternate-number-format-plugin/HLSAll.gif)
194+
195+
### Add Haddock comments
196+
Status: Not supported on GHC 9.2
197+
198+
Provided by: `hls-haddock-comments-plugin`
199+
200+
Code action kind: `quickfix`
201+
202+
Adds Haddock comments for function arguments.
203+
204+
### Wingman
205+
Status: Not supported on GHC 9.2
206+
207+
Provided by: `hls-tactics-plugin`
208+
209+
Provides a variety of code actions for interactive code development, see https://haskellwingman.dev/ for more details.
210+
211+
![Wingman Demo](https://user-images.githubusercontent.com/307223/92657198-3d4be400-f2a9-11ea-8ad3-f541c8eea891.gif)
212+
213+
## Code lenses
214+
215+
### Add type signature
216+
Provided by: `ghcide`
217+
218+
Shows the type signature for bindings without type signatures, and adds it with a click.
219+
220+
### Evaluation code snippets in comments
221+
Status: Not supported on GHC 9.2
222+
223+
Provided by: `hls-eval-plugin`
224+
225+
Evaluates code blocks in comments with a click. [Tutorial](https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-eval-plugin/README.md).
226+
227+
![Eval Demo](https://raw.githubusercontent.com/haskell/haskell-language-server/master/plugins/hls-eval-plugin/demo.gif)
228+
229+
### Make import lists fully explicit
230+
Provided by: `hls-explicit-imports-plugin`
231+
232+
Shows fully explicit import lists and rewrites them with a click (same as the code action).
233+
234+
![Imports code lens Demo](https://imgur.com/pX9kvY4.gif)
235+
236+
### Refine import
237+
Provided by: `hls-refine-imports-plugin`
238+
239+
Shows refined imports and applies them with a click (same as the code action).
240+
241+
### Fix module names
242+
Provided by: `hls-module-name-plugin`
243+
244+
Shows module name matching file path, and applies it with a click.
245+
246+
![Module Name Demo](https://user-images.githubusercontent.com/54035/110860755-78ad8680-82bd-11eb-9845-9ea4b1cc1f76.gif)
247+
248+
## Missing features
249+
250+
The following features are supported by the LSP specification but not implemented in HLS.
251+
Contributions welcome!
252+
253+
| Feature | Status | [LSP method](./what-is-hls.md#lsp-terminology) |
254+
|------------------------|------------------------------------------------------------------------------------------|-----------------------------------------------------|
255+
| Signature help | Unimplemented | `textDocument/signatureHelp` |
256+
| Jump to declaration | Unclear if useful | `textDocument/declaration` |
257+
| Jump to implementation | Unclear if useful | `textDocument/implementation` |
258+
| Renaming | [Parital implementation](https://github.com/haskell/haskell-language-server/issues/2193) | `textDocument/rename`, `textDocument/prepareRename` |
259+
| Folding | Unimplemented | `textDocument/foldingRange` |
260+
| Selection range | Unimplemented | `textDocument/selectionRange` |
261+
| Semantic tokens | Unimplemented | `textDocument/semanticTokens` |
262+
| Linked editing | Unimplemented | `textDocument/linkedEditingRange` |
263+
| Document links | Unimplemented | `textDocument/documentLink` |
264+
| Document color | Unclear if useful | `textDocument/documentColor` |
265+
| Color presentation | Unclear if useful | `textDocument/colorPresentation` |
266+
| Monikers | Unclear if useful | `textDocument/moniker` |

docs/what-is-hls.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Here are a few pieces of jargon that you may come across in the HLS docs or when
3333
- *Completion item*: An item that can be inserted into the text, including its metadata.
3434
- *Diagnostic*: Any information about the project that is shown in the editor, including errors, warnings, and hints from tools such as hlint.
3535
- *Semantic highlighting*: Special syntax highlighting performed by the server.
36+
- *Method*: A LSP method is a function in the LSP protocol that the client can invoke to perform some action, e.g. ask for completions at a point.
3637

3738
## haskell-language-server
3839

0 commit comments

Comments
 (0)