|
1 | 1 | # Features
|
2 | 2 |
|
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). |
25 | 5 |
|
26 |
| - |
| 6 | +| Feature | [LSP method](./what-is-hls.md#lsp-terminology) | |
| 7 | +|-----------------------------------------------------|---------------------------------------------------------------------------------------------------| |
| 8 | +| [Diagnostics](#diagnostics) | `textDocument/publishDiagnostics` | |
| 9 | +| [Hovers](#hovers) | `textDocument/hover` | |
| 10 | +| [Jump to definition](#jump-to-definition) | `textDocument/definition` | |
| 11 | +| [Jump to type definition](#jump-to-type-definition) | `textDocument/typeDefinition` | |
| 12 | +| [Find references](#find-references) | `textDocument/references` | |
| 13 | +| [Completions](#completions) | `textDocument/completion` | |
| 14 | +| [Formatting](#formatting) | `textDocument/formatting`, `textDocument/rangeFormatting` | |
| 15 | +| [Document symbols](#document-symbols) | `textDocument/documentSymbol` | |
| 16 | +| [Workspace symbols](#workspace-symbols) | `workspace/symbol` | |
| 17 | +| [Call hierarchy](#call-hierarchy) | `textDocument/prepareCallHierarchy`, `callHierarchy/incomingCalls`, `callHierarchy/outgoingCalls` | |
| 18 | +| [Highlight references](#highlight-references) | `textDocument/documentHighlight` | |
| 19 | +| [Code actions](#code-actions) | `textDocument/codeAction` | |
| 20 | +| [Code lenses](#code-lenses) | `textDocument/codeLens` | |
27 | 21 |
|
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! |
| 23 | +Additionally, not all plugins are supported on all versions of GHC, see the [GHC version support page](supported-versions.md) for details. |
29 | 24 |
|
30 |
| - |
| 25 | +## Diagnostics |
31 | 26 |
|
32 |
| -### Explicit import lists |
| 27 | +### GHC compiler errors and warnings |
| 28 | +Provided by: `ghcide` |
33 | 29 |
|
34 |
| - |
| 30 | +Provides errors and warnings from GHC as diagnostics. |
35 | 31 |
|
36 |
| -### Wingman |
| 32 | +### Hlint hints |
| 33 | +Provided by: `hls-hlint-plugin` |
37 | 34 |
|
38 |
| - |
| 35 | +Provides hlint hints as diagnostics. |
39 | 36 |
|
40 |
| -### Hlint |
| 37 | +## Hovers |
| 38 | +Provided by: `ghcide` |
41 | 39 |
|
42 |
| - |
| 40 | +Type information and documentation on hover, [including from local definitions](./configuration.md#how-to-show-local-documentation-on-hover). |
43 | 41 |
|
44 |
| -### Module names |
| 42 | +## Jump to definition |
| 43 | +Provided by: `ghcide` |
45 | 44 |
|
46 |
| - |
| 45 | +Jump to the definition of a name. |
| 46 | + |
| 47 | +Known limitations: |
| 48 | +- Only works for [local definitions](https://github.com/haskell/haskell-language-server/issues/708). |
| 49 | + |
| 50 | +## Jump to type definition |
| 51 | +Provided by: `ghcide` |
| 52 | + |
| 53 | +Known limitations: |
| 54 | +- Only works for [local definitions](https://github.com/haskell/haskell-language-server/issues/708). |
| 55 | + |
| 56 | +## Find references |
| 57 | +Provided by: `ghcide` |
| 58 | + |
| 59 | +Find references to a name within the project. |
| 60 | + |
| 61 | +## Completions |
| 62 | + |
| 63 | +### Code completions |
| 64 | +Provided by: `ghcide` |
| 65 | + |
| 66 | +- Completion of names from qualified imports. |
| 67 | +- Completion of names from non-imported modules. |
| 68 | + |
| 69 | +### Pragma completions |
| 70 | +Provided by: `hls-pragmas-plugin` |
| 71 | + |
| 72 | +Completions for language pragmas. |
| 73 | + |
| 74 | +## Formatting |
| 75 | +Format your code with various Haskell code formatters. |
| 76 | + |
| 77 | +| Formatter | Provided by | |
| 78 | +|-----------------|------------------------------| |
| 79 | +| Brittany | `hls-brittany-plugin` | |
| 80 | +| Floskell | `hls-floskell-plugin` | |
| 81 | +| Fourmolu | `hls-fourmolu-plugin` | |
| 82 | +| Ormolu | `hls-ormolu-plugin` | |
| 83 | +| Stylish Haskell | `hls-stylish-haskell-plugin` | |
| 84 | + |
| 85 | +## Document symbols |
| 86 | +Provided by: `ghcide` |
| 87 | + |
| 88 | +Provides listing of the symbols defined in a module, used to power outline displays. |
| 89 | + |
| 90 | +## Workspace symbols |
| 91 | +Provided by: `ghcide` |
| 92 | + |
| 93 | +Provides listing of the symbols defined in the project, used to power searches. |
47 | 94 |
|
48 |
| -### Call hierarchy |
| 95 | +## Call hierarchy |
| 96 | +Provided by: `hls-call-hierarchy-plugin` |
| 97 | + |
| 98 | +Shows ingoing and outgoing calls for a function. |
49 | 99 |
|
50 | 100 | 
|
51 | 101 |
|
| 102 | +## Highlight references |
| 103 | +Provided by: `ghcide` |
| 104 | + |
| 105 | +Highlights references to a name in a document. |
| 106 | + |
| 107 | +## Code actions |
| 108 | + |
| 109 | +### Insert missing pragmas |
| 110 | +Provided by: `hls-pragma-plugin` |
| 111 | + |
| 112 | +Code action kind: `quickfix` |
| 113 | + |
| 114 | +Inserts missing pragmas needed by GHC. |
| 115 | + |
| 116 | +### Apply Hlint fixes |
| 117 | +Provided by: `hls-hlint-plugin` |
| 118 | + |
| 119 | +Code action kind: `quickfix` |
| 120 | + |
| 121 | +Applies hints, either individually or for the whole file. |
| 122 | +Uses [apply-refact](https://github.com/mpickering/apply-refact). |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | +Known limitations: |
| 127 | +- May have strange behaviour in files with CPP, since `apply-refact` does not support CPP. |
| 128 | + |
| 129 | +### Make import lists fully explicit |
| 130 | +Provided by: `hls-explicit-imports-plugin` |
| 131 | + |
| 132 | +Code action kind: `quickfix.literals.style` |
| 133 | + |
| 134 | +Make import lists fully explicit (same as the code lens). |
| 135 | + |
52 | 136 | ### Qualify imported names
|
| 137 | +Provided by: `hls-qualify-imported-names-plugin` |
| 138 | + |
| 139 | +Code action kind: `quickfix` |
| 140 | + |
| 141 | +Rewrites imported names to be qualified. |
53 | 142 |
|
54 | 143 | 
|
| 144 | + |
| 145 | +For usage see the . |
| 146 | + |
| 147 | +### Refine import |
| 148 | +Provided by: `hls-refine-imports-plugin` |
| 149 | + |
| 150 | +Code action kind: `quickfix.import.refine` |
| 151 | + |
| 152 | +Refines imports to more specific modules when names are re-exported (same as the code lens). |
| 153 | + |
| 154 | +### Add missing class methods |
| 155 | +Provided by: `hls-class-plugin` |
55 | 156 |
|
56 |
| -### Alternate Number Formatting |
| 157 | +Code action kind: `quickfix` |
| 158 | + |
| 159 | +Adds placeholders for missing class methods in a class instance definition. |
| 160 | + |
| 161 | +### Unfold definition |
| 162 | +Provided by: `hls-retrie-plugin` |
| 163 | + |
| 164 | +Code action kind: `refactor.extract` |
| 165 | + |
| 166 | +Extracts a definition from the code. |
| 167 | + |
| 168 | +### Fold definition |
| 169 | +Provided by: `hls-retrie-plugin` |
| 170 | + |
| 171 | +Code action kind: `refactor.inline` |
| 172 | + |
| 173 | +Inlines a definition from the code. |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | +### Insert contents of Template Haskell splice |
| 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 | +Provided by: `hls-alternate-number-format-plugin` |
| 186 | + |
| 187 | +Code action kind: `quickfix.literals.style` |
| 188 | + |
| 189 | +Converts numeric literals to different formats. |
57 | 190 |
|
58 | 191 | 
|
| 192 | + |
| 193 | +### Add Haddock comments |
| 194 | +Provided by: `hls-haddock-comments-plugin` |
| 195 | + |
| 196 | +Code action kind: `quickfix` |
| 197 | + |
| 198 | +Adds Haddock comments for function arguments. |
| 199 | + |
| 200 | +### Wingman |
| 201 | +Status: Not supported on GHC 9.2 |
| 202 | + |
| 203 | +Provided by: `hls-tactics-plugin` |
| 204 | + |
| 205 | +Provides a variety of code actions for interactive code development, see https://haskellwingman.dev/ for more details. |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | +## Code lenses |
| 210 | + |
| 211 | +### Add type signature |
| 212 | +Provided by: `ghcide` |
| 213 | + |
| 214 | +Shows the type signature for bindings without type signatures, and adds it with a click. |
| 215 | + |
| 216 | +### Evaluation code snippets in comments |
| 217 | +Provided by: `hls-eval-plugin` |
| 218 | + |
| 219 | +Evaluates code blocks in comments with a click. [Tutorial](https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-eval-plugin/README.md). |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | +### Make import lists fully explicit |
| 224 | +Provided by: `hls-explicit-imports-plugin` |
| 225 | + |
| 226 | +Shows fully explicit import lists and rewrites them with a click (same as the code action). |
| 227 | + |
| 228 | + |
| 229 | + |
| 230 | +### Refine import |
| 231 | +Provided by: `hls-refine-imports-plugin` |
| 232 | + |
| 233 | +Shows refined imports and applies them with a click (same as the code action). |
| 234 | + |
| 235 | +### Fix module names |
| 236 | +Provided by: `hls-module-name-plugin` |
| 237 | + |
| 238 | +Shows module name matching file path, and applies it with a click. |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | +## Missing features |
| 243 | + |
| 244 | +The following features are supported by the LSP specification but not implemented in HLS. |
| 245 | +Contributions welcome! |
| 246 | + |
| 247 | +| Feature | Status | [LSP method](./what-is-hls.md#lsp-terminology) | |
| 248 | +|------------------------|------------------------------------------------------------------------------------------|-----------------------------------------------------| |
| 249 | +| Signature help | Unimplemented | `textDocument/signatureHelp` | |
| 250 | +| Jump to declaration | Unclear if useful | `textDocument/declaration` | |
| 251 | +| Jump to implementation | Unclear if useful | `textDocument/implementation` | |
| 252 | +| Renaming | [Parital implementation](https://github.com/haskell/haskell-language-server/issues/2193) | `textDocument/rename`, `textDocument/prepareRename` | |
| 253 | +| Folding | Unimplemented | `textDocument/foldingRange` | |
| 254 | +| Selection range | Unimplemented | `textDocument/selectionRange` | |
| 255 | +| Semantic tokens | Unimplemented | `textDocument/semanticTokens` | |
| 256 | +| Linked editing | Unimplemented | `textDocument/linkedEditingRange` | |
| 257 | +| Document links | Unimplemented | `textDocument/documentLink` | |
| 258 | +| Document color | Unclear if useful | `textDocument/documentColor` | |
| 259 | +| Color presentation | Unclear if useful | `textDocument/colorPresentation` | |
| 260 | +| Monikers | Unclear if useful | `textDocument/moniker` | |
0 commit comments