Skip to content

Commit 769a274

Browse files
jneiramergify[bot]
authored andcommitted
Add missing config options in documentation (haskell#2203)
* Add missing config options ... diagnosticsDebounceDuration, checkProject, checkParents Aldo add link to the issue about liquid haskell * Section about generic plugin configuration * Add plugin specific config * Mark haskell.completionSnippetsOn as deprecated * Remove unused diagnosticsDebounceDuration * Correct typos * Change tone of using hie.yaml suggestion To make clear the default should be let hls detect it automatically * Update exclude list precommit hook * Remove diagnosticsDebounceDuration from source code * Correct typo Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent e280571 commit 769a274

File tree

3 files changed

+50
-24
lines changed

3 files changed

+50
-24
lines changed

docs/configuration.md

+40-10
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,45 @@ This option obviously would not make sense for language servers for other langua
4040

4141
Here is a list of the additional settings currently supported by `haskell-language-server`, along with their setting key (you may not need to know this) and default:
4242

43-
- Formatting provider (`haskell.formattingProvider`, default `ormolu`): what formatter to use; one of `floskell`, `ormolu`, `fourmolu`, `stylish-haskell`, or `brittany` (if compiled with the brittany plugin)
44-
- Format on imports (`haskell.formatOnImportOn`, default true): whether to format after adding an import
45-
- Diagnostics on change (`haskell.diagnosticsOnChange`, default true): (currently unused)
46-
- Completion snippets (`haskell.completionSnippetsOn`, default true): whether to support completion snippets
47-
- Liquid Haskell (`haskell.liquidOn`, default false): whether to enable Liquid Haskell support (currently unused until the Liquid Haskell support is functional again)
48-
- Hlint (`haskell.hlintOn`, default true): whether to enable Hlint support
43+
- Formatting provider (`haskell.formattingProvider`, default `ormolu`): what formatter to use; one of `floskell`, `ormolu`, `fourmolu`, `stylish-haskell`, or `brittany` (if compiled with the brittany plugin).
44+
- Format on imports (`haskell.formatOnImportOn`, default true): whether to format after adding an import.
45+
- Diagnostics on change (`haskell.diagnosticsOnChange`, default true): (currently unused).
46+
- Completion snippets (`haskell.completionSnippetsOn`, default true): whether to support completion snippets. *Deprecated* as it is equivalent to `haskell.plugin.ghcide-completions.config.snippetsOn`.
47+
- Liquid Haskell (`haskell.liquidOn`, default false): whether to enable Liquid Haskell support (currently unused until the Liquid Haskell support is functional again, see <https://github.com/haskell/haskell-language-server/issues/367>).
48+
- Hlint (`haskell.hlintOn`, default true): whether to enable Hlint support. *Deprecated* as it is equivalen to `haskell.plugin.hlint.globalOn`
4949
- Max completions (`haskell.maxCompletions`, default 40): maximum number of completions sent to the LSP client.
50-
50+
- Check project (`haskell.checkProject`, default true): whether to typecheck the entire project on load. As it is activated by default could drive to bad perfomance in large projects.
51+
- Check parents (`haskell.checkParents`, default `CheckOnSaveAndClose`): when to typecheck reverse dependencies of a file; one of `NeverCheck`, `CheckOnClose`, `CheckOnSaveAndClose`, or `AlwaysCheck`.
52+
53+
#### Generic plugin configuration
54+
55+
Plugins have a generic config to control their behaviour. The schema of such config is:
56+
57+
- `haskell.plugin.${pluginName}.globalOn`: usually with default true. Whether the plugin is enabled at runtime or it is not. That is the option you might use if you want to disable completely a plugin.
58+
- Actual plugin names are: `ghcide-code-actions-fill-holes`, `ghcide-completions`, `ghcide-hover-and-symbols`, `ghcide-type-lenses`, `ghcide-code-actions-type-signatures`, `ghcide-code-actions-bindings`, `ghcide-code-actions-imports-exports`, `eval`, `moduleName`, `pragmas`, `refineImports`, `importLens`, `class`, `tactics` (aka wingman), `hlint`, `haddockComments`, `retrie`, `splice`.
59+
- So to disable the import lens with an explicit list of module definitions you could set `haskell.plugin.importLens.globalOn: false`
60+
- `haskell.plugin.${pluginName}.${lspCapability}On`: usually with default true. Whether a concrete plugin capability is enabled.
61+
- Capabilities are the different ways a lsp server can interact with the editor. The current available capabilities of the server are: `callHierarchy`, `codeActions`, `codeLens`, `diagnostics`, `hover`, `symbols`, `completion`, `rename`.
62+
- Note that usually plugins don't provide all capabilities but some of them or even only one.
63+
- So to disable code changes suggestions from the `hlint` plugin (but no diagnostics) you could set `haskell.plugin.hlint.codeActionsOn: false`
64+
- Plugin specific configuration:
65+
- `tactic` (aka wingman):
66+
- `haskell.plugin.tactics.config.auto_gas`, default 4: The depth of the search tree when performing "Attempt to fill hole". Bigger values will be able to derive more solutions, but will take exponentially more time.
67+
- `haskell.plugin.tactics.config.timeout_duration`, default 2: The timeout for Wingman actions, in seconds.
68+
- `haskell.plugin.tactics.config.hole_severity`, default empty: The severity to use when showing hole diagnostics. These are noisy, but some editors don't allow jumping to all severities. One of `error`, `warning`, `info`, `hint`, `none`.
69+
- `haskell.plugin.tactics.config.max_use_ctor_actions`, default 5: Maximum number of `Use constructor <x>` code actions that can appear.
70+
- `haskell.plugin.tactics.config.proofstate_styling`, default true: Should Wingman emit styling markup when showing metaprogram proof states?
71+
- `ghcide-completions`:
72+
- `haskell.plugin.ghcide-completions.config.snippetsOn`, default true: Inserts snippets when using code completions.
73+
- `haskell.plugin.ghcide-completions.config.autoExtendOn`, default true: Extends the import list automatically when completing a out-of-scope identifier.
74+
- `ghcide-type-lenses`:
75+
- `haskell.plugin.ghcide-type-lenses.config.mode`, default `always`: Control how type lenses are shown. One of `always`, `exported`, `diganostics`.
76+
- `hlint`:
77+
- `haskell.plugin.hlint.config.flags`, default empty: List of flags used by hlint.
78+
This reference of configuration can be outdated at any time but we can query the `haskell-server-executable` about what configuration is effectively used:
79+
- `haskell-language-server generate-default-config`: will print the json configuration with all default values. It can be used as template to modify it.
80+
- `haskell-language-server vscode-extension-schema`: will print a json schema used to setup the haskell vscode extension. But it is useful to see what range of values can an option take and a description about it.
81+
5182
Settings like this are typically provided by the language-specific LSP client support for your editor, for example in Emacs by `lsp-haskell`.
5283

5384
### Client options
@@ -63,10 +94,9 @@ This is handled by the [`hie-bios`](https://github.com/mpickering/hie-bios) proj
6394

6495
**For a full explanation of how `hie-bios` determines the project build configuration, and how to configure it manually, refer to the [`hie-bios` README](https://github.com/mpickering/hie-bios/blob/master/README.md).**
6596

66-
At the moment, `haskell-language-server` has some limited support to automatically detect your project build configuration.
67-
The plan is to improve it to handle most use cases.
97+
At the moment, `haskell-language-server` has support to automatically detect your project build configuration to handle most use cases.
6898

69-
However, for now, the most reliable way is to manually configure `hie-bios` using a `hie.yaml` file in the root of the workspace.
99+
However, if the automatic detection fails you can configure `hie-bios` using a `hie.yaml` file in the root of the workspace.
70100
A `hie.yaml` file **explicitly** describes how to setup the environment to compile the various parts of your project.
71101
For that you need to know what *components* your project has, and the path associated with each one.
72102
So you will need some knowledge about

docs/contributing/contributing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ If you don't want to use [nix](https://nixos.org/guides/install-nix.html), you c
158158
"hooks": [
159159
{
160160
"entry": "stylish-haskell --inplace",
161-
"exclude": "(^Setup.hs$|test/testdata/.*$|test/data/.*$|^hie-compat/.*$|^plugins/hls-tactics-plugin/.*$)",
161+
"exclude": "(^Setup.hs$|test/testdata/.*$|test/data/.*$|test/manual/lhs/.*$|^hie-compat/.*$|^plugins/hls-tactics-plugin/.*$|^ghcide/src/Development/IDE/GHC/Compat.hs$|^plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs$|^ghcide/test/exe/Main.hs$|ghcide/src/Development/IDE/Core/Rules.hs|^hls-test-utils/src/Test/Hls/Util.hs$)"
162162
"files": "\\.l?hs$",
163163
"id": "stylish-haskell",
164164
"language": "system",

hls-plugin-api/src/Ide/Plugin/Config.hs

+9-13
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@ data CheckParents
4848
-- will be surprises relating to config options being ignored, initially though.
4949
data Config =
5050
Config
51-
{ checkParents :: CheckParents
52-
, checkProject :: !Bool
53-
, hlintOn :: !Bool
54-
, diagnosticsOnChange :: !Bool
55-
, diagnosticsDebounceDuration :: !Int
56-
, liquidOn :: !Bool
57-
, formatOnImportOn :: !Bool
58-
, formattingProvider :: !T.Text
59-
, maxCompletions :: !Int
60-
, plugins :: !(Map.Map T.Text PluginConfig)
51+
{ checkParents :: CheckParents
52+
, checkProject :: !Bool
53+
, hlintOn :: !Bool
54+
, diagnosticsOnChange :: !Bool
55+
, liquidOn :: !Bool
56+
, formatOnImportOn :: !Bool
57+
, formattingProvider :: !T.Text
58+
, maxCompletions :: !Int
59+
, plugins :: !(Map.Map T.Text PluginConfig)
6160
} deriving (Show,Eq)
6261

6362
instance Default Config where
@@ -66,7 +65,6 @@ instance Default Config where
6665
, checkProject = True
6766
, hlintOn = True
6867
, diagnosticsOnChange = True
69-
, diagnosticsDebounceDuration = 350000
7068
, liquidOn = False
7169
, formatOnImportOn = True
7270
-- , formattingProvider = "brittany"
@@ -90,7 +88,6 @@ parseConfig defValue = A.withObject "Config" $ \v -> do
9088
<*> (o .:? "checkProject" <|> v .:? "checkProject") .!= checkProject defValue
9189
<*> o .:? "hlintOn" .!= hlintOn defValue
9290
<*> o .:? "diagnosticsOnChange" .!= diagnosticsOnChange defValue
93-
<*> o .:? "diagnosticsDebounceDuration" .!= diagnosticsDebounceDuration defValue
9491
<*> o .:? "liquidOn" .!= liquidOn defValue
9592
<*> o .:? "formatOnImportOn" .!= formatOnImportOn defValue
9693
<*> o .:? "formattingProvider" .!= formattingProvider defValue
@@ -105,7 +102,6 @@ instance A.ToJSON Config where
105102
, "checkProject" .= checkProject
106103
, "hlintOn" .= hlintOn
107104
, "diagnosticsOnChange" .= diagnosticsOnChange
108-
, "diagnosticsDebounceDuration" .= diagnosticsDebounceDuration
109105
, "liquidOn" .= liquidOn
110106
, "formatOnImportOn" .= formatOnImportOn
111107
, "formattingProvider" .= formattingProvider

0 commit comments

Comments
 (0)