Skip to content

Commit dd57399

Browse files
committed
Merge remote-tracking branch 'ghcide/merge'
2 parents 5f0e7aa + d5789dd commit dd57399

File tree

160 files changed

+29021
-0
lines changed

Some content is hidden

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

160 files changed

+29021
-0
lines changed

.hlint.yaml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# HLint configuration file
2+
# https://github.com/ndmitchell/hlint
3+
##########################
4+
5+
# To run HLint do:
6+
# $ hlint --git -j4
7+
8+
# Warnings currently triggered by our code
9+
- ignore: {name: "Use <$>"}
10+
- ignore: {name: "Use :"}
11+
- ignore: {name: "Redundant do"}
12+
- ignore: {name: "Avoid lambda"}
13+
- ignore: {name: "Use newtype instead of data"}
14+
- ignore: {name: "Use fromMaybe"}
15+
- ignore: {name: "Use unless"}
16+
- ignore: {name: "Move brackets to avoid $"}
17+
- ignore: {name: "Eta reduce"}
18+
- ignore: {name: "Parse error"}
19+
- ignore: {name: "Reduce duplication"}
20+
- ignore: {name: "Use ++"}
21+
- ignore: {name: "Use $>"}
22+
- ignore: {name: "Use section"}
23+
- ignore: {name: "Use record patterns"}
24+
- ignore: {name: "Use camelCase"}
25+
- ignore: {name: "Use uncurry"}
26+
- ignore: {name: "Avoid lambda using `infix`"}
27+
28+
# Off by default hints we like
29+
- warn: {name: Use module export list}
30+
31+
# Condemn nub and friends
32+
- warn: {lhs: nub (sort x), rhs: Data.List.Extra.nubSort x}
33+
- warn: {lhs: nub, rhs: Data.List.Extra.nubOrd}
34+
- warn: {lhs: nubBy, rhs: Data.List.Extra.nubOrdBy}
35+
- warn: {lhs: Data.List.Extra.nubOn, rhs: Data.List.Extra.nubOrdOn}
36+
37+
# DA specific hints
38+
- warn: {lhs: Data.Text.pack (DA.Pretty.renderPlain x), rhs: DA.Pretty.renderPlain x}
39+
- warn: {lhs: Data.Text.Extended.pack (DA.Pretty.renderPlain x), rhs: DA.Pretty.renderPlain x}
40+
- warn: {lhs: DA.Pretty.renderPlain (DA.Pretty.pretty x), rhs: DA.Pretty.renderPretty x}
41+
- warn: {lhs: Data.Text.readFile, rhs: Data.Text.Extended.readFileUtf8}
42+
- warn: {lhs: Data.Text.writeFile, rhs: Data.Text.Extended.writeFileUtf8}
43+
- warn: {lhs: Data.Text.Lazy.readFile, rhs: Data.Text.Extended.readFileUtf8}
44+
- warn: {lhs: Data.Text.Lazy.writeFile, rhs: Data.Text.Extended.writeFileUtf8}
45+
- warn: {lhs: System.Environment.setEnv, rhs: System.Environment.Blank.setEnv}
46+
47+
# Specify additional command line arguments
48+
#
49+
- arguments: ["--cpp-include=include"]
50+
51+
- extensions:
52+
- default: true
53+
54+
# Extensions enabled by `bazel` and `da-ghci` by default. We ban them here
55+
# to avoid useless pragmas piling up on the top of files.
56+
- {name: BangPatterns, within: []}
57+
- {name: DeriveDataTypeable, within: []}
58+
- {name: DeriveFoldable, within: []}
59+
- {name: DeriveFunctor, within: []}
60+
- {name: DeriveGeneric, within: []}
61+
- {name: DeriveTraversable, within: []}
62+
- {name: FlexibleContexts, within: []}
63+
- {name: GeneralizedNewtypeDeriving, within: []}
64+
- {name: LambdaCase, within: []}
65+
- {name: NamedFieldPuns, within: []}
66+
- {name: PackageImports, within: []}
67+
- {name: RecordWildCards, within: []}
68+
- {name: ScopedTypeVariables, within: []}
69+
- {name: StandaloneDeriving, within: []}
70+
- {name: TupleSections, within: []}
71+
- {name: TypeApplications, within: []}
72+
- {name: ViewPatterns, within: []}
73+
74+
# Shady extensions
75+
- name: CPP
76+
within:
77+
- Development.IDE.Compat
78+
- Development.IDE.Core.FileStore
79+
- Development.IDE.Core.Compile
80+
- Development.IDE.Core.Rules
81+
- Development.IDE.GHC.Compat
82+
- Development.IDE.GHC.Orphans
83+
- Development.IDE.GHC.Util
84+
- Development.IDE.Import.FindImports
85+
- Development.IDE.LSP.Outline
86+
- Development.IDE.Spans.Calculate
87+
- Development.IDE.Spans.Documentation
88+
- Development.IDE.Spans.Common
89+
- Development.IDE.Plugin.CodeAction
90+
- Development.IDE.Plugin.Completions
91+
- Development.IDE.Plugin.Completions.Logic
92+
- Main
93+
94+
- flags:
95+
- default: false
96+
- {name: [-Wno-missing-signatures, -Wno-orphans, -Wno-overlapping-patterns, -Wno-incomplete-patterns, -Wno-missing-fields, -Wno-unused-matches]}
97+
- {name: [-Wno-dodgy-imports,-Wno-incomplete-uni-patterns], within: [Main, Development.IDE.GHC.Compat]}
98+
# - modules:
99+
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
100+
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
101+
#
102+
- functions:
103+
# Things that are unsafe in Haskell base library
104+
- {name: unsafeInterleaveIO, within: []}
105+
- {name: unsafeDupablePerformIO, within: []}
106+
- {name: unsafeCoerce, within: []}
107+
# Things that are a bit dangerous in the GHC API
108+
- {name: nameModule, within: []}
109+
110+
# Add custom hints for this project
111+
#
112+
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
113+
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
114+
115+
# Turn on hints that are off by default
116+
#
117+
# Ban "module X(module X) where", to require a real export list
118+
# - warn: {name: Use explicit module export list}
119+
#
120+
# Replace a $ b $ c with a . b $ c
121+
# - group: {name: dollar, enabled: true}
122+
#
123+
# Generalise map to fmap, ++ to <>
124+
# - group: {name: generalise, enabled: true}
125+
126+
# Ignore some builtin hints
127+
# - ignore: {name: Use let}
128+
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
129+
130+
# Define some custom infix operators
131+
# - fixity: infixr 3 ~^#^~

ghcide/.azure/linux-stack.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
jobs:
2+
- job: ghcide_stack_linux
3+
timeoutInMinutes: 60
4+
pool:
5+
vmImage: 'ubuntu-latest'
6+
variables:
7+
STACK_ROOT: $(Pipeline.Workspace)/.stack
8+
steps:
9+
- checkout: self
10+
- task: Cache@2
11+
inputs:
12+
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal
13+
path: $(STACK_ROOT)
14+
cacheHitVar: STACK_ROOT_CACHE_RESTORED
15+
displayName: "Cache stack root"
16+
- task: Cache@2
17+
inputs:
18+
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal
19+
path: .stack-work
20+
cacheHitVar: STACK_WORK_CACHE_RESTORED
21+
displayName: "Cache stack work"
22+
- bash: |
23+
./fmt.sh
24+
displayName: "HLint via ./fmt.sh"
25+
- bash: |
26+
sudo add-apt-repository ppa:hvr/ghc
27+
sudo apt-get update
28+
sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make zlib1g-dev cabal-install-3.2
29+
if ! which stack >/dev/null 2>&1; then
30+
curl -sSL https://get.haskellstack.org/ | sh
31+
fi
32+
mkdir -p $STACK_ROOT
33+
displayName: 'Install Stack'
34+
- bash: stack setup
35+
displayName: 'stack setup'
36+
- bash: cabal update # some tests use Cabal cradles
37+
displayName: 'cabal update'
38+
- bash: stack build --test --no-run-tests
39+
displayName: 'stack build --test --no-run-tests'

ghcide/.azure/windows-stack.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
jobs:
2+
- job: ghcide_stack_windows
3+
timeoutInMinutes: 120
4+
pool:
5+
vmImage: 'windows-2019'
6+
variables:
7+
STACK_ROOT: "C:\\sr"
8+
steps:
9+
- checkout: self
10+
- task: Cache@2
11+
inputs:
12+
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
13+
path: $(STACK_ROOT)
14+
cacheHitVar: STACK_ROOT_CACHE_RESTORED
15+
displayName: "Cache stack root"
16+
- task: Cache@2
17+
inputs:
18+
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
19+
path: .stack-work
20+
cacheHitVar: STACK_WORK_CACHE_RESTORED
21+
displayName: "Cache stack work"
22+
- bash: |
23+
./fmt.sh
24+
displayName: "HLint via ./fmt.sh"
25+
- bash: |
26+
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip
27+
unzip -o /usr/bin/stack.zip -d /usr/bin/
28+
mkdir -p "$STACK_ROOT"
29+
displayName: 'Install Stack'
30+
- bash: stack setup --stack-yaml stack-windows.yaml
31+
displayName: 'stack setup'
32+
- bash: |
33+
# Installing happy and alex standalone to avoid error "strip.exe: unable to rename ../*.exe; reason: File exists"
34+
stack install happy --stack-yaml stack-windows.yaml
35+
stack install alex --stack-yaml stack-windows.yaml
36+
choco install -y cabal --version=$CABAL_VERSION
37+
$(cygpath $ProgramData)/chocolatey/bin/RefreshEnv.cmd
38+
# GHC 8.10.1 fails with ghc segfaults, using -fexternal-interpreter seems to make it working
39+
# There are other transient errors like timeouts downloading from stackage so we retry 3 times
40+
stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter"
41+
displayName: 'stack build --test'

ghcide/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at https://EditorConfig.org
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = LF
8+
indent_style = space
9+
indent_size = 4
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true

ghcide/.ghci

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
:set -Wunused-binds -Wunused-imports -Worphans -Wunused-matches -Wincomplete-patterns
2+
3+
:set -XBangPatterns
4+
:set -XDeriveFunctor
5+
:set -XDeriveGeneric
6+
:set -XGeneralizedNewtypeDeriving
7+
:set -XLambdaCase
8+
:set -XNamedFieldPuns
9+
:set -XOverloadedStrings
10+
:set -XRecordWildCards
11+
:set -XScopedTypeVariables
12+
:set -XStandaloneDeriving
13+
:set -XTupleSections
14+
:set -XTypeApplications
15+
:set -XViewPatterns
16+
17+
:set -package=ghc
18+
:set -ignore-package=ghc-lib-parser
19+
:set -DGHC_STABLE
20+
:set -Iinclude
21+
:set -idist/build/autogen
22+
:set -isrc
23+
:set -isession-loader
24+
:set -iexe
25+
26+
:set -isrc-ghc88
27+
:set -idist-newstyle/build/x86_64-osx/ghc-8.8.3/ghcide-0.2.0/build/autogen
28+
29+
:load Main

ghcide/.github/workflows/bench.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Benchmark
2+
3+
on: [pull_request]
4+
jobs:
5+
bench:
6+
runs-on: ${{ matrix.os }}
7+
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
ghc: ['8.10.2', '8.8.4', '8.6.5']
12+
os: [ubuntu-latest, macOS-latest]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- run: git fetch origin master # check the master branch for benchmarking
17+
- uses: actions/setup-haskell@v1
18+
with:
19+
ghc-version: ${{ matrix.ghc }}
20+
cabal-version: '3.2'
21+
enable-stack: false
22+
23+
- name: Cache Cabal
24+
uses: actions/cache@v2
25+
with:
26+
path: |
27+
~/.cabal/packages
28+
~/.cabal/store
29+
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-bench
30+
31+
- run: cabal update
32+
33+
- run: cabal configure --enable-benchmarks
34+
35+
- name: Build
36+
shell: bash
37+
# Retry it three times to workaround compiler segfaults in windows
38+
run: cabal build || cabal build || cabal build
39+
40+
- name: Bench
41+
shell: bash
42+
# run the tests without parallelism, otherwise tasty will attempt to run
43+
# all test cases simultaneously which causes way too many hls
44+
# instances to be spun up for the poor github actions runner to handle
45+
run: cabal bench
46+
47+
- name: Display results
48+
shell: bash
49+
run: |
50+
column -s, -t < bench-results/results.csv | tee bench-results/results.txt
51+
52+
- name: Archive benchmarking artifacts
53+
uses: actions/upload-artifact@v2
54+
with:
55+
name: bench-results-${{ runner.os }}-${{ matrix.ghc }}
56+
path: |
57+
bench-results/results.*
58+
bench-results/**/*.svg

ghcide/.github/workflows/nix.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Nix
2+
3+
on: [pull_request]
4+
jobs:
5+
nix:
6+
runs-on: ${{ matrix.os }}
7+
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
ghc: ['default', 'ghc8102', 'ghc884', 'ghc865']
12+
os: [ubuntu-latest, macOS-latest]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: cachix/install-nix-action@v12
17+
with:
18+
nix_path: nixpkgs=channel:nixos-20.03
19+
- uses: cachix/cachix-action@v7
20+
with:
21+
name: haskell-ghcide
22+
signingKey: '${{ secrets.GHCIDE_CACHIX_SIGNING_KEY }}'
23+
- run: nix-shell --argstr compiler ${{ matrix.ghc }} --run "cabal update && cabal build"

0 commit comments

Comments
 (0)