Skip to content

Commit 7a75f91

Browse files
authored
Merge branch 'master' into fix-win-cache
2 parents 54ada8b + e766971 commit 7a75f91

File tree

25 files changed

+740
-326
lines changed

25 files changed

+740
-326
lines changed

.github/workflows/nix.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
- uses: cachix/cachix-action@v8
2222
with:
2323
name: haskell-language-server
24-
authToken: '${{ secrets.HLS_CACHIX_AUTH_TOKEN }}'
24+
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
2525
- run: nix-shell --argstr compiler ${{ matrix.ghc }} --run "cabal update && cabal build"

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ background](https://neilmitchell.blogspot.com/2020/01/one-haskell-ide-to-rule-th
2727
- [Building](#building)
2828
- [Install via cabal](#install-via-cabal)
2929
- [Install specific GHC Version](#install-specific-ghc-version)
30+
- [Installation from Hackage](#installation-from-hackage)
3031
- [Configuring haskell-language-server](#configuring-haskell-language-server)
3132
- [Configuring your project build](#configuring-your-project-build)
3233
- [Configuring your editor](#configuring-your-editor)
@@ -245,6 +246,12 @@ If your desired ghc has been found, you use it to install haskell-language-serve
245246
./cabal-hls-install hls-8.6.5
246247
```
247248

249+
### Installation from Hackage
250+
251+
Direct installation from Hackage, while possible via `cabal install haskell-language-server`, is not recommended for most people.
252+
Said command builds the `haskell-language-server` binary and installs it in the default Cabal binaries folder,
253+
but the binary will only work with projects that use the same GHC version that built it.
254+
248255
## Configuring `haskell-language-server`
249256

250257
Language servers like `haskell-language-server` expose most of their configuration via the client (i.e. the editor).

ghcide/bench/config.yaml

+12-9
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,23 @@ examples:
1414
# Medium-sized project without TH
1515
- name: Cabal
1616
version: 3.0.0.0
17-
module: Distribution/Simple.hs
17+
modules:
18+
- Distribution/Simple.hs
19+
- Distribution/Types/Module.hs
1820
# Small-sized project with TH
19-
- name: haskell-lsp-types
20-
version: 0.22.0.0
21-
module: src/Language/Haskell/LSP/Types/Lens.hs
22-
# - path: path-to-example
23-
# module: path-to-module
21+
- name: lsp-types
22+
version: 1.0.0.1
23+
modules:
24+
- src/Language/LSP/VFS.hs
25+
- src/Language/LSP/Types/Lens.hs
2426

2527
# The set of experiments to execute
2628
experiments:
27-
- hover
28-
- edit
29-
- getDefinition
29+
- "edit"
30+
- "hover"
3031
- "hover after edit"
32+
- "getDefinition"
33+
- "getDefinition after edit"
3134
- "completions after edit"
3235
- "code actions"
3336
- "code actions after edit"

ghcide/bench/exe/Main.hs

+11-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,23 @@
3737
import Control.Exception.Safe
3838
import Experiments
3939
import Options.Applicative
40+
import System.IO
41+
import Control.Monad
42+
43+
optsP :: Parser (Config, Bool)
44+
optsP = (,) <$> configP <*> switch (long "no-clean")
4045

4146
main :: IO ()
4247
main = do
43-
config <- execParser $ info (configP <**> helper) fullDesc
48+
hSetBuffering stdout LineBuffering
49+
hSetBuffering stderr LineBuffering
50+
(config, noClean) <- execParser $ info (optsP <**> helper) fullDesc
4451
let ?config = config
4552

53+
hPrint stderr config
54+
4655
output "starting test"
4756

4857
SetupResult{..} <- setup
4958

50-
runBenchmarks experiments `finally` cleanUp
59+
runBenchmarks experiments `finally` unless noClean cleanUp

ghcide/bench/hist/Main.hs

+10-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import Experiments.Types (Example, exampleToOptions)
5151
import qualified Experiments.Types as E
5252
import GHC.Generics (Generic)
5353
import Numeric.Natural (Natural)
54+
import Development.Shake.Classes
5455

5556

5657
config :: FilePath
@@ -70,7 +71,7 @@ main = shakeArgs shakeOptions {shakeChange = ChangeModtimeAndDigest} $ do
7071
configStatic <- liftIO $ readConfigIO config
7172
let build = outputFolder configStatic
7273
buildRules build ghcideBuildRules
73-
benchRules build resource (MkBenchRules (benchGhcide $ samples configStatic) "ghcide")
74+
benchRules build resource (MkBenchRules (askOracle $ GetSamples ()) benchGhcide "ghcide")
7475
csvRules build
7576
svgRules build
7677
action $ allTargets build
@@ -98,14 +99,18 @@ createBuildSystem userRules = do
9899

99100
_ <- addOracle $ \GetExperiments {} -> experiments <$> readConfig config
100101
_ <- addOracle $ \GetVersions {} -> versions <$> readConfig config
101-
_ <- addOracle $ \GetExamples{} -> examples <$> readConfig config
102-
_ <- addOracle $ \(GetExample name) -> find (\e -> getExampleName e == name) . examples <$> readConfig config
102+
_ <- versioned 1 $ addOracle $ \GetExamples{} -> examples <$> readConfig config
103+
_ <- versioned 1 $ addOracle $ \(GetExample name) -> find (\e -> getExampleName e == name) . examples <$> readConfig config
103104
_ <- addOracle $ \GetBuildSystem {} -> buildTool <$> readConfig config
105+
_ <- addOracle $ \GetSamples{} -> samples <$> readConfig config
104106

105107
benchResource <- newResource "ghcide-bench" 1
106108

107109
userRules benchResource
108110

111+
newtype GetSamples = GetSamples () deriving newtype (Binary, Eq, Hashable, NFData, Show)
112+
type instance RuleResult GetSamples = Natural
113+
109114
--------------------------------------------------------------------------------
110115

111116
buildGhcide :: BuildSystem -> [CmdOption] -> FilePath -> Action ()
@@ -130,9 +135,10 @@ buildGhcide Stack args out =
130135

131136
benchGhcide
132137
:: Natural -> BuildSystem -> [CmdOption] -> BenchProject Example -> Action ()
133-
benchGhcide samples buildSystem args BenchProject{..} =
138+
benchGhcide samples buildSystem args BenchProject{..} = do
134139
command_ args "ghcide-bench" $
135140
[ "--timeout=3000",
141+
"--no-clean",
136142
"-v",
137143
"--samples=" <> show samples,
138144
"--csv=" <> outcsv,

0 commit comments

Comments
 (0)