Skip to content

Commit 78354eb

Browse files
authored
Merge branch 'master' into optional-plugins
2 parents b08fff2 + b547d4e commit 78354eb

File tree

17 files changed

+472
-254
lines changed

17 files changed

+472
-254
lines changed

docs/features.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This table gives a summary of the features that HLS supports.
44
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).
55

66
| Feature | [LSP method](./what-is-hls.md#lsp-terminology) |
7-
|-----------------------------------------------------|---------------------------------------------------------------------------------------------------|
7+
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
88
| [Diagnostics](#diagnostics) | `textDocument/publishDiagnostics` |
99
| [Hovers](#hovers) | `textDocument/hover` |
1010
| [Jump to definition](#jump-to-definition) | `textDocument/definition` |
@@ -100,7 +100,7 @@ Completions for language pragmas.
100100
Format your code with various Haskell code formatters.
101101

102102
| Formatter | Provided by |
103-
|-----------------|------------------------------|
103+
| --------------- | ---------------------------- |
104104
| Brittany | `hls-brittany-plugin` |
105105
| Floskell | `hls-floskell-plugin` |
106106
| Fourmolu | `hls-fourmolu-plugin` |
@@ -261,6 +261,7 @@ Change/Update a type signature to match implementation.
261261
Status: Until GHC 9.4, the implementation is ad-hoc and relies on GHC error messages to create a new signature. Not all GHC error messages are supported.
262262

263263
Known Limitations:
264+
264265
- Not all GHC error messages are supported
265266
- Top-level and Function-local bindings with the same names can cause issues, such as incorrect signature changes or no code actions available.
266267

@@ -337,6 +338,16 @@ support.
337338

338339
![Selection range demo](https://user-images.githubusercontent.com/16440269/177240833-7dc8fe39-b446-477e-b5b1-7fc303608d4f.gif)
339340

341+
## Folding range
342+
343+
Provided by: `hls-code-range-plugin`
344+
345+
Provides haskell specific
346+
[Folding](https://code.visualstudio.com/docs/editor/codebasics#_folding)
347+
support.
348+
349+
![Folding range demo](https://user-images.githubusercontent.com/54478821/184468510-7c0d5182-c684-48ef-9b39-3866dc2309df.gif)
350+
340351
## Rename
341352

342353
Provided by: `hls-rename-plugin`
@@ -354,15 +365,14 @@ Known limitations:
354365
The following features are supported by the LSP specification but not implemented in HLS.
355366
Contributions welcome!
356367

357-
| Feature | Status | [LSP method](./what-is-hls.md#lsp-terminology) |
358-
|------------------------|------------------------------------------------------------------------------------------|-----------------------------------------------------|
359-
| Signature help | Unimplemented | `textDocument/signatureHelp` |
360-
| Jump to declaration | Unclear if useful | `textDocument/declaration` |
361-
| Jump to implementation | Unclear if useful | `textDocument/implementation` |
362-
| Folding | Unimplemented | `textDocument/foldingRange` |
363-
| Semantic tokens | Unimplemented | `textDocument/semanticTokens` |
364-
| Linked editing | Unimplemented | `textDocument/linkedEditingRange` |
365-
| Document links | Unimplemented | `textDocument/documentLink` |
366-
| Document color | Unclear if useful | `textDocument/documentColor` |
367-
| Color presentation | Unclear if useful | `textDocument/colorPresentation` |
368-
| Monikers | Unclear if useful | `textDocument/moniker` |
368+
| Feature | Status | [LSP method](./what-is-hls.md#lsp-terminology) |
369+
| ---------------------- | ----------------- | ---------------------------------------------- |
370+
| Signature help | Unimplemented | `textDocument/signatureHelp` |
371+
| Jump to declaration | Unclear if useful | `textDocument/declaration` |
372+
| Jump to implementation | Unclear if useful | `textDocument/implementation` |
373+
| Semantic tokens | Unimplemented | `textDocument/semanticTokens` |
374+
| Linked editing | Unimplemented | `textDocument/linkedEditingRange` |
375+
| Document links | Unimplemented | `textDocument/documentLink` |
376+
| Document color | Unclear if useful | `textDocument/documentColor` |
377+
| Color presentation | Unclear if useful | `textDocument/colorPresentation` |
378+
| Monikers | Unclear if useful | `textDocument/moniker` |

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ data PluginConfig =
132132
, plcCompletionOn :: !Bool
133133
, plcRenameOn :: !Bool
134134
, plcSelectionRangeOn :: !Bool
135+
, plcFoldingRangeOn :: !Bool
135136
, plcConfig :: !A.Object
136137
} deriving (Show,Eq)
137138

@@ -147,11 +148,12 @@ instance Default PluginConfig where
147148
, plcCompletionOn = True
148149
, plcRenameOn = True
149150
, plcSelectionRangeOn = True
151+
, plcFoldingRangeOn = True
150152
, plcConfig = mempty
151153
}
152154

153155
instance A.ToJSON PluginConfig where
154-
toJSON (PluginConfig g ch ca cl d h s c rn sr cfg) = r
156+
toJSON (PluginConfig g ch ca cl d h s c rn sr fr cfg) = r
155157
where
156158
r = object [ "globalOn" .= g
157159
, "callHierarchyOn" .= ch
@@ -163,6 +165,7 @@ instance A.ToJSON PluginConfig where
163165
, "completionOn" .= c
164166
, "renameOn" .= rn
165167
, "selectionRangeOn" .= sr
168+
, "foldingRangeOn" .= fr
166169
, "config" .= cfg
167170
]
168171

@@ -178,6 +181,7 @@ parsePluginConfig def= A.withObject "PluginConfig" $ \o -> PluginConfig
178181
<*> o .:? "completionOn" .!= plcCompletionOn def
179182
<*> o .:? "renameOn" .!= plcRenameOn def
180183
<*> o .:? "selectionRangeOn" .!= plcSelectionRangeOn def
184+
<*> o .:? "foldingRangeOn" .!= plcFoldingRangeOn def
181185
<*> o .:? "config" .!= plcConfig def
182186

183187
-- ---------------------------------------------------------------------

hls-plugin-api/src/Ide/Types.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,13 @@ instance PluginMethod Request TextDocumentSelectionRange where
431431
uri = msgParams ^. J.textDocument . J.uri
432432
pid = pluginId pluginDesc
433433

434+
instance PluginMethod Request TextDocumentFoldingRange where
435+
pluginEnabled _ msgParams pluginDesc conf = pluginResponsible uri pluginDesc
436+
&& pluginEnabledConfig plcFoldingRangeOn pid conf
437+
where
438+
uri = msgParams ^. J.textDocument . J.uri
439+
pid = pluginId pluginDesc
440+
434441
instance PluginMethod Request CallHierarchyIncomingCalls where
435442
-- This method has no URI parameter, thus no call to 'pluginResponsible'
436443
pluginEnabled _ _ pluginDesc conf = pluginEnabledConfig plcCallHierarchyOn pid conf
@@ -531,6 +538,9 @@ instance PluginRequestMethod TextDocumentPrepareCallHierarchy where
531538
instance PluginRequestMethod TextDocumentSelectionRange where
532539
combineResponses _ _ _ _ (x :| _) = x
533540

541+
instance PluginRequestMethod TextDocumentFoldingRange where
542+
combineResponses _ _ _ _ x = sconcat x
543+
534544
instance PluginRequestMethod CallHierarchyIncomingCalls where
535545

536546
instance PluginRequestMethod CallHierarchyOutgoingCalls where

plugins/hls-call-hierarchy-plugin/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Enabled by default. You can disable it in your editor settings whenever you like
2323
```
2424

2525
## Change log
26+
### 1.1.0.0
27+
- Support ghc-9.4.
28+
- Refactor code base and force four space indent.
2629
### 1.0.3.0
2730
Remove force update `HieDb` logic in queries.
2831
### 1.0.1.0

plugins/hls-call-hierarchy-plugin/hls-call-hierarchy-plugin.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ library
2727
build-depends:
2828
, aeson
2929
, base >=4.12 && <5
30-
, bytestring
3130
, containers
3231
, extra
33-
, ghc
3432
, ghcide ^>= 1.8
3533
, hiedb
3634
, hls-plugin-api ^>= 1.5

plugins/hls-call-hierarchy-plugin/src/Ide/Plugin/CallHierarchy.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import Language.LSP.Types
77

88
descriptor :: PluginDescriptor IdeState
99
descriptor = (defaultPluginDescriptor X.callHierarchyId)
10-
{ Ide.Types.pluginHandlers = mkPluginHandler STextDocumentPrepareCallHierarchy X.prepareCallHierarchy
11-
<> mkPluginHandler SCallHierarchyIncomingCalls X.incomingCalls
12-
<> mkPluginHandler SCallHierarchyOutgoingCalls X.outgoingCalls
13-
}
10+
{ Ide.Types.pluginHandlers =
11+
mkPluginHandler STextDocumentPrepareCallHierarchy X.prepareCallHierarchy
12+
<> mkPluginHandler SCallHierarchyIncomingCalls X.incomingCalls
13+
<> mkPluginHandler SCallHierarchyOutgoingCalls X.outgoingCalls
14+
}

0 commit comments

Comments
 (0)