Skip to content

Commit 681dc5b

Browse files
committed
Merge branch 'alternate-number-format' of github.com:drsooch/haskell-language-server into alternate-number-format
2 parents b424cfb + def9cac commit 681dc5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1108
-107
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'status: needs triage, type: bug'
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Before opening an issue, please take a look at the [troubleshooting guide](https://haskell-language-server.readthedocs.io/en/latest/troubleshooting.html). This explains some common issues and will also help you to find the information that the issue template asks for.
12+
13+
When filing an issue, please fill out as much of the information below as you can. This helps us to debug your issue, but is not required!
14+
-->
15+
16+
### Your environment
17+
18+
Which OS do you use:
19+
<!-- Windows, MacOS, Ubuntu, ArchLinux, etc... -->
20+
Which lsp-client do you use:
21+
<!-- Neovim, emacs, VS Codium, etc... -->
22+
Describe your project (alternative: link to the project):
23+
<!-- stack.yaml, package.yaml, *.cabal files, cabal.project, hie.yaml -->
24+
25+
### Steps to reproduce
26+
<!-- Tell us how to reproduce this issue. -->
27+
28+
### Expected behaviour
29+
<!-- Tell us what should happen. -->
30+
31+
### Actual behaviour
32+
<!-- Tell us what happens instead. -->
33+
34+
### Include debug information
35+
Execute in the root of your project the command `haskell-language-server-wrapper --debug .` and paste the logs here:
36+
(if you are using the vscode extension check the executable location [here](https://github.com/haskell/vscode-haskell#downloaded-binaries))
37+
<details>
38+
<summary>
39+
Debug output:
40+
</summary>
41+
42+
```
43+
<paste your logs here>
44+
```
45+
</details>
46+
47+
Paste the logs from the lsp-client, you can check instructions about for VS Code [here](https://github.com/haskell/vscode-haskell#troubleshooting)
48+
49+
<details>
50+
<summary>
51+
LSP logs:
52+
</summary>
53+
54+
```
55+
<paste your logs here>
56+
```
57+
</details>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'status: needs triage, type: enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
12+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
13+
14+
**Describe the solution you'd like**
15+
16+
<!-- A clear and concise description of what you want to happen. -->
17+
18+
**Describe alternatives you've considered**
19+
20+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
21+
22+
**Additional context**
23+
24+
<!-- Add any other context or screenshots about the feature request here. -->

.github/workflows/hackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
"hls-call-hierarchy-plugin",
2929
"haskell-language-server"]
3030
# Uncomment 9.0.1 when ghcide is buildable
31-
ghc: [ # "9.0.1",
31+
ghc: [ "9.0.1",
3232
"8.10.7",
3333
"8.8.4",
3434
"8.6.5"]

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ jobs:
139139
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
140140
src/**/*.hs exe/*.hs
141141
142+
# repeating builds to workaround segfaults in windows and ghc-8.8.4
142143
- name: Build
143-
run: cabal build
144+
run: cabal build || cabal build || cabal build
144145

145146
- name: Set test options
146147
run: |
@@ -238,8 +239,11 @@ jobs:
238239

239240
- if: matrix.test
240241
name: Test hls-alternate-number-format-plugin test suite
241-
run: cabal test hls-alternate-number-format-plugin --test-options="-j1 --rerun-update" || cabal test hls-alternate-number-format-plugin --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-alternate-number-format-plugin --test-options="-j1 --rerun"
242+
run: cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS"
242243

244+
- if: matrix.test
245+
name: Test hls-qualify-imported-names-plugin test suite
246+
run: cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" || cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS"
243247

244248
test_post_job:
245249
if: always()

cabal-ghc901.project

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ packages:
1919
./plugins/hls-retrie-plugin
2020
./plugins/hls-haddock-comments-plugin
2121
./plugins/hls-splice-plugin
22+
./plugins/hls-qualify-imported-names-plugin
2223
./plugins/hls-floskell-plugin
2324
./plugins/hls-pragmas-plugin
2425
./plugins/hls-module-name-plugin
@@ -34,23 +35,9 @@ package *
3435
ghc-options: -haddock
3536
test-show-details: direct
3637

37-
source-repository-package
38-
type: git
39-
location: https://github.com/mokus0/th-extras
40-
tag: 0d050b24ec5ef37c825b6f28ebd46787191e2a2d
41-
-- https://github.com/mokus0/th-extras/issues/10
42-
43-
44-
source-repository-package
45-
type: git
46-
location: https://github.com/fendor/dependent-sum
47-
tag: 5de03c38b0de4945f4e9bce1b026110e69dc8118
48-
subdir: dependent-sum-template
49-
-- https://github.com/obsidiansystems/dependent-sum/pull/59
50-
5138
write-ghc-environment-files: never
5239

53-
index-state: 2021-11-23T21:12:30Z
40+
index-state: 2021-11-29T08:11:07Z
5441

5542
constraints:
5643
-- These plugins don't work on GHC9 yet

cabal-ghc921.project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ packages:
1818
-- ./plugins/hls-retrie-plugin
1919
./plugins/hls-haddock-comments-plugin
2020
-- ./plugins/hls-splice-plugin
21+
./plugins/hls-qualify-imported-names-plugin
2122
./plugins/hls-floskell-plugin
2223
./plugins/hls-pragmas-plugin
2324
./plugins/hls-module-name-plugin
@@ -35,7 +36,7 @@ package *
3536

3637
write-ghc-environment-files: never
3738

38-
index-state: 2021-11-23T21:12:30Z
39+
index-state: 2021-11-29T08:11:07Z
3940

4041
constraints:
4142
-- These plugins doesn't work on GHC92 yet

cabal.project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ packages:
2525
./plugins/hls-ormolu-plugin
2626
./plugins/hls-call-hierarchy-plugin
2727
./plugins/hls-alternate-number-format-plugin
28+
./plugins/hls-qualify-imported-names-plugin
2829

2930
-- Standard location for temporary packages needed for particular environments
3031
-- For example it is used in the project gitlab mirror to help in the MAcOS M1 build script
@@ -39,7 +40,7 @@ package *
3940

4041
write-ghc-environment-files: never
4142

42-
index-state: 2021-11-23T21:12:30Z
43+
index-state: 2021-11-29T08:11:07Z
4344

4445
constraints:
4546
hyphenation +embed

docs/features.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ You can watch demos for some of these features [below](#demos).
1616
- [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)
1717
- [Module name suggestions](#module-names) for insertion or correction
1818
- [Call hierarchy support](#call-hierarchy)
19+
- [Qualify names from an import declaration](#qualify-imported-names) in your code
1920

2021
## Demos
2122

@@ -46,3 +47,7 @@ You can watch demos for some of these features [below](#demos).
4647
### Call hierarchy
4748

4849
![Call Hierarchy in VSCode](https://github.com/haskell/haskell-language-server/raw/2857eeece0398e1cd4b2ffb6069b05c4d2308b39/plugins/hls-call-hierarchy-plugin/call-hierarchy-in-vscode.gif)
50+
51+
### Qualify imported names
52+
53+
![Qualify Imported Names Demo](../plugins/hls-qualify-imported-names-plugin/qualify-imported-names-demo.gif)

exe/Plugins.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import Ide.Plugin.Example as Example
1212
import Ide.Plugin.Example2 as Example2
1313

1414
-- haskell-language-server optional plugins
15+
#if qualifyImportedNames
16+
import Ide.Plugin.QualifyImportedNames as QualifyImportedNames
17+
#endif
1518

1619
#if callHierarchy
1720
import Ide.Plugin.CallHierarchy as CallHierarchy
@@ -147,6 +150,9 @@ idePlugins includeExamples = pluginDescToIdePlugins allPlugins
147150
#if importLens
148151
ExplicitImports.descriptor "importLens" :
149152
#endif
153+
#if qualifyImportedNames
154+
QualifyImportedNames.descriptor "qualifyImportedNames" :
155+
#endif
150156
#if refineImports
151157
RefineImports.descriptor "refineImports" :
152158
#endif

ghcide/ghcide.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ executable ghcide-bench
442442
base,
443443
bytestring,
444444
containers,
445+
data-default,
445446
directory,
446447
extra,
447448
filepath,

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
462462
-> IO (IdeResult HscEnvEq, [FilePath])
463463
sessionOpts (hieYaml, file) = do
464464
v <- fromMaybe HM.empty . Map.lookup hieYaml <$> readVar fileToFlags
465-
cfp <- canonicalizePath file
465+
cfp <- makeAbsolute file
466466
case HM.lookup (toNormalizedFilePath' cfp) v of
467467
Just (opts, old_di) -> do
468468
deps_ok <- checkDependencyInfo old_di
@@ -483,7 +483,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
483483
-- before attempting to do so.
484484
let getOptions :: FilePath -> IO (IdeResult HscEnvEq, [FilePath])
485485
getOptions file = do
486-
ncfp <- toNormalizedFilePath' <$> canonicalizePath file
486+
ncfp <- toNormalizedFilePath' <$> makeAbsolute file
487487
cachedHieYamlLocation <- HM.lookup ncfp <$> readVar filesMap
488488
hieYaml <- cradleLoc file
489489
sessionOpts (join cachedHieYamlLocation <|> hieYaml, file) `Safe.catch` \e ->
@@ -553,11 +553,11 @@ fromTargetId is exts (GHC.TargetModule mod) env dep = do
553553
, i <- is
554554
, boot <- ["", "-boot"]
555555
]
556-
locs <- mapM (fmap toNormalizedFilePath' . canonicalizePath) fps
556+
locs <- mapM (fmap toNormalizedFilePath' . makeAbsolute) fps
557557
return [TargetDetails (TargetModule mod) env dep locs]
558558
-- For a 'TargetFile' we consider all the possible module names
559559
fromTargetId _ _ (GHC.TargetFile f _) env deps = do
560-
nf <- toNormalizedFilePath' <$> canonicalizePath f
560+
nf <- toNormalizedFilePath' <$> makeAbsolute f
561561
return [TargetDetails (TargetFile nf) env deps [nf]]
562562

563563
toFlagsMap :: TargetDetails -> [(NormalizedFilePath, (IdeResult HscEnvEq, DependencyInfo))]

ghcide/src/Development/IDE/Core/Rules.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ import Ide.Plugin.Config
138138
import qualified Language.LSP.Server as LSP
139139
import Language.LSP.Types (SMethod (SCustomMethod))
140140
import Language.LSP.VFS
141-
import System.Directory (canonicalizePath, makeAbsolute)
141+
import System.Directory (makeAbsolute)
142142
import Data.Default (def, Default)
143143
import Ide.Plugin.Properties (HasProperty,
144144
KeyNameProxy,
@@ -769,7 +769,7 @@ getModIfaceFromDiskAndIndexRule =
769769
hie_loc = Compat.ml_hie_file $ ms_location ms
770770
hash <- liftIO $ Util.getFileHash hie_loc
771771
mrow <- liftIO $ HieDb.lookupHieFileFromSource hiedb (fromNormalizedFilePath f)
772-
hie_loc' <- liftIO $ traverse (canonicalizePath . HieDb.hieModuleHieFile) mrow
772+
hie_loc' <- liftIO $ traverse (makeAbsolute . HieDb.hieModuleHieFile) mrow
773773
case mrow of
774774
Just row
775775
| hash == HieDb.modInfoHash (HieDb.hieModInfo row)

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,14 @@ instance IsIdeGlobal GlobalIdeOptions
308308
getIdeOptions :: Action IdeOptions
309309
getIdeOptions = do
310310
GlobalIdeOptions x <- getIdeGlobalAction
311-
return x
311+
env <- lspEnv <$> getShakeExtras
312+
case env of
313+
Nothing -> return x
314+
Just env -> do
315+
config <- liftIO $ LSP.runLspT env HLS.getClientConfig
316+
return x{optCheckProject = pure $ checkProject config,
317+
optCheckParents = pure $ checkParents config
318+
}
312319

313320
getIdeOptionsIO :: ShakeExtras -> IO IdeOptions
314321
getIdeOptionsIO ide = do

0 commit comments

Comments
 (0)