Skip to content

Commit 75343ef

Browse files
authored
Merge branch 'master' into wip/multi-loop-2
2 parents 7b9702e + 9b0699d commit 75343ef

File tree

52 files changed

+824
-683
lines changed

Some content is hidden

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

52 files changed

+824
-683
lines changed

.github/actions/setup-build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
sudo chown -R $USER /usr/local/.ghcup
3232
shell: bash
3333

34-
- uses: haskell-actions/setup@v2.6.3
34+
- uses: haskell-actions/setup@v2.7.1
3535
id: HaskEnvSetup
3636
with:
3737
ghc-version : ${{ inputs.ghc }}

.github/workflows/bench.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
example: ['cabal', 'lsp-types']
127127

128128
steps:
129-
- uses: haskell-actions/setup@v2.6.3
129+
- uses: haskell-actions/setup@v2.7.1
130130
with:
131131
ghc-version : ${{ matrix.ghc }}
132132
cabal-version: ${{ matrix.cabal }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
- if: needs.pre_job.outputs.should_skip_ghcide != 'true' && matrix.test
118118
name: Test ghcide
119119
# run the tests without parallelism to avoid running out of memory
120-
run: cabal test ghcide || cabal test ghcide
120+
run: cabal test ghcide-tests || cabal test ghcide-tests
121121

122122
- if: matrix.test
123123
name: Test hls-plugin-api

bench/Main.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ buildHls Cabal root out = actionBracket
202202
liftIO $ writeFile projectLocal $ unlines
203203
["package haskell-language-server"
204204
," ghc-options: -eventlog -rtsopts"
205-
,"package ghcide"
206-
," flags: +ekg"
207205
]
208206
return projectLocalExists)
209207
(\projectLocalExists -> do

cabal.project

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,3 @@ constraints:
4242
-- We want to be able to benefit from the performance optimisations
4343
-- in the future, thus: TODO: remove this flag.
4444
bitvec -simd
45-
46-
-- This is benign and won't affect our ability to release to Hackage,
47-
-- because we only depend on `ekg-json` when a non-default flag
48-
-- is turned on.
49-
-- DELETE MARKER FOR CI
50-
-- centos7 has an old version of git which cabal doesn't
51-
-- support. We delete these lines in gitlab ci to workaround
52-
-- this issue, as this is not necessary to build our binaries.
53-
source-repository-package
54-
type:git
55-
location: https://github.com/pepeiborra/ekg-json
56-
tag: 7a0af7a8fd38045fd15fb13445bdcc7085325460
57-
-- END DELETE
58-
59-
if impl(ghc >= 9.1)
60-
-- ekg packagess are old and unmaintained, but we
61-
-- don't rely on them for the mainline build, so
62-
-- this is okay
63-
allow-newer:
64-
ekg-json:base,
65-
ekg-wai:time,
66-
ekg-core:ghc-prim
67-
68-
if impl(ghc >= 9.7)
69-
-- ekg packagess are old and unmaintained, but we
70-
-- don't rely on them for the mainline build, so
71-
-- this is okay
72-
allow-newer:
73-
ekg-core:text,

docs/contributing/contributing.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,6 @@ See the [tutorial](./plugin-tutorial.md) on writing a plugin in HLS.
198198

199199
## Measuring, benchmarking and tracing
200200

201-
### Metrics
202-
203-
When ghcide is built with the `ekg` flag, HLS opens a metrics server on port 8999 exposing GC and ghcide metrics. The ghcide metrics currently exposed are:
204-
205-
- `ghcide.values_count` - count of build results in the store
206-
- `ghcide.database_count` - count of build keys in the store (these two would be the same in the absence of GC)
207-
- `ghcide.build_count` - build count. A key is GC'ed if it is dirty and older than 100 builds
208-
- `ghcide.dirty_keys_count` - non transitive count of dirty build keys
209-
- `ghcide.indexing_pending_count` - count of items in the indexing queue
210-
- `ghcide.exports_map_count` - count of identifiers in the exports map.
211-
212201
### Benchmarks
213202

214203
If you are touching performance sensitive code, take the time to run a differential

exe/Wrapper.hs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@ import qualified Data.Text as T
4141
import qualified Data.Text.IO as T
4242
import Development.IDE.LSP.LanguageServer (runLanguageServer)
4343
import qualified Development.IDE.Main as Main
44-
import GHC.Stack.Types (emptyCallStack)
45-
import Ide.Logger (Doc, Logger (Logger),
46-
Pretty (pretty),
47-
Recorder (logger_),
48-
WithPriority (WithPriority),
44+
import Ide.Logger (Doc, Pretty (pretty),
45+
Recorder, WithPriority,
4946
cmapWithPrio,
5047
makeDefaultStderrRecorder)
5148
import Ide.Plugin.Config (Config)
@@ -272,9 +269,7 @@ newtype ErrorLSPM c a = ErrorLSPM { unErrorLSPM :: (LspM c) a }
272269
-- to shut down the LSP.
273270
launchErrorLSP :: Recorder (WithPriority (Doc ())) -> T.Text -> IO ()
274271
launchErrorLSP recorder errorMsg = do
275-
let logger = Logger $ \p m -> logger_ recorder (WithPriority p emptyCallStack (pretty m))
276-
277-
let defaultArguments = Main.defaultArguments (cmapWithPrio pretty recorder) logger (IdePlugins [])
272+
let defaultArguments = Main.defaultArguments (cmapWithPrio pretty recorder) (IdePlugins [])
278273

279274
inH <- Main.argsHandleIn defaultArguments
280275

ghcide-bench/src/Experiments.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ import qualified Data.Text as T
4949
import Data.Version
5050
import Development.IDE.Plugin.Test
5151
import Development.IDE.Test.Diagnostic
52-
import Development.Shake (CmdOption (Cwd, FileStdout),
53-
cmd_)
52+
import Development.Shake (CmdOption (Cwd), cmd_)
5453
import Experiments.Types
5554
import Language.LSP.Protocol.Capabilities
5655
import qualified Language.LSP.Protocol.Lens as L
@@ -128,7 +127,7 @@ experiments =
128127
(\docs -> do
129128
hieYamlUri <- getDocUri "hie.yaml"
130129
liftIO $ appendFile (fromJust $ uriToFilePath hieYamlUri) "##\n"
131-
sendNotification SMethod_WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
130+
sendNotification SMethod_WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams
132131
[ FileEvent hieYamlUri FileChangeType_Changed ]
133132
flip allWithIdentifierPos docs $ \DocumentPositions{..} -> isJust <$> getHover doc (fromJust identifierP)
134133
),
@@ -210,7 +209,7 @@ experiments =
210209
( \docs -> do
211210
hieYamlUri <- getDocUri "hie.yaml"
212211
liftIO $ appendFile (fromJust $ uriToFilePath hieYamlUri) "##\n"
213-
sendNotification SMethod_WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
212+
sendNotification SMethod_WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams
214213
[ FileEvent hieYamlUri FileChangeType_Changed ]
215214
waitForProgressStart
216215
waitForProgressStart
@@ -777,7 +776,7 @@ setupDocumentContents config =
777776
findEndOfImports :: [DocumentSymbol] -> Maybe Position
778777
findEndOfImports (DocumentSymbol{_kind = SymbolKind_Module, _name = "imports", _range} : _) =
779778
Just $ Position (succ $ _line $ _end _range) 4
780-
findEndOfImports [DocumentSymbol{_kind = SymbolKind_File, _children = Just (cc)}] =
779+
findEndOfImports [DocumentSymbol{_kind = SymbolKind_File, _children = Just cc}] =
781780
findEndOfImports cc
782781
findEndOfImports (DocumentSymbol{_range} : _) =
783782
Just $ _range ^. L.start

ghcide/exe/Arguments.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ data Arguments = Arguments
2020
,argsVerbose :: Bool
2121
,argsCommand :: Command
2222
,argsConservativeChangeTracking :: Bool
23-
,argsMonitoringPort :: Int
2423
}
2524

2625
getArguments :: IdePlugins IdeState -> IO Arguments
@@ -43,7 +42,6 @@ arguments plugins = Arguments
4342
<*> switch (short 'd' <> long "verbose" <> help "Include internal events in logging output")
4443
<*> (commandP plugins <|> lspCommand <|> checkCommand)
4544
<*> switch (long "conservative-change-tracking" <> help "disable reactive change tracking (for testing/debugging)")
46-
<*> option auto (long "monitoring-port" <> metavar "PORT" <> value 8999 <> showDefault <> help "Port to use for EKG monitoring (if the binary is built with EKG)")
4745
where
4846
checkCommand = Check <$> many (argument str (metavar "FILES/DIRS..."))
4947
lspCommand = LSP <$ flag' True (long "lsp" <> help "Start talking to an LSP client")

ghcide/exe/Main.hs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ import Development.IDE (action)
1616
import Development.IDE.Core.OfInterest (kick)
1717
import Development.IDE.Core.Rules (mainRule)
1818
import qualified Development.IDE.Core.Rules as Rules
19-
import Development.IDE.Core.Tracing (withTelemetryLogger)
19+
import Development.IDE.Core.Tracing (withTelemetryRecorder)
2020
import qualified Development.IDE.Main as IDEMain
21-
import qualified Development.IDE.Monitoring.EKG as EKG
2221
import qualified Development.IDE.Monitoring.OpenTelemetry as OpenTelemetry
2322
import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
2423
import Development.IDE.Types.Options
25-
import GHC.Stack (emptyCallStack)
26-
import Ide.Logger (Logger (Logger),
27-
LoggingColumn (DataColumn, PriorityColumn),
24+
import Ide.Logger (LoggingColumn (DataColumn, PriorityColumn),
2825
Pretty (pretty),
2926
Priority (Debug, Error, Info),
3027
WithPriority (WithPriority, priority),
@@ -72,7 +69,7 @@ ghcideVersion = do
7269
<> gitHashSection
7370

7471
main :: IO ()
75-
main = withTelemetryLogger $ \telemetryLogger -> do
72+
main = withTelemetryRecorder $ \telemetryRecorder -> do
7673
-- stderr recorder just for plugin cli commands
7774
pluginCliRecorder <-
7875
cmapWithPrio pretty
@@ -110,23 +107,20 @@ main = withTelemetryLogger $ \telemetryLogger -> do
110107
(lspLogRecorder & cmapWithPrio (renderStrict . layoutPretty defaultLayoutOptions)
111108
& cfilter (\WithPriority{ priority } -> priority >= minPriority)) <>
112109
(lspMessageRecorder & cmapWithPrio (renderStrict . layoutPretty defaultLayoutOptions)
113-
& cfilter (\WithPriority{ priority } -> priority >= Error))
114-
115-
-- exists so old-style logging works. intended to be phased out
116-
let logger = Logger $ \p m -> Logger.logger_ docWithFilteredPriorityRecorder (WithPriority p emptyCallStack (pretty m))
110+
& cfilter (\WithPriority{ priority } -> priority >= Error)) <>
111+
telemetryRecorder
117112

118113
let recorder = docWithFilteredPriorityRecorder
119114
& cmapWithPrio pretty
120115

121116
let arguments =
122117
if argsTesting
123-
then IDEMain.testing (cmapWithPrio LogIDEMain recorder) logger hlsPlugins
124-
else IDEMain.defaultArguments (cmapWithPrio LogIDEMain recorder) logger hlsPlugins
118+
then IDEMain.testing (cmapWithPrio LogIDEMain recorder) hlsPlugins
119+
else IDEMain.defaultArguments (cmapWithPrio LogIDEMain recorder) hlsPlugins
125120

126121
IDEMain.defaultMain (cmapWithPrio LogIDEMain recorder) arguments
127122
{ IDEMain.argsProjectRoot = Just argsCwd
128123
, IDEMain.argCommand = argsCommand
129-
, IDEMain.argsLogger = IDEMain.argsLogger arguments <> pure telemetryLogger
130124
, IDEMain.argsHlsPlugins = IDEMain.argsHlsPlugins arguments <> pluginDescToIdePlugins [lspRecorderPlugin]
131125

132126
, IDEMain.argsRules = do
@@ -148,5 +142,5 @@ main = withTelemetryLogger $ \telemetryLogger -> do
148142
, optRunSubset = not argsConservativeChangeTracking
149143
, optVerifyCoreFile = argsVerifyCoreFile
150144
}
151-
, IDEMain.argsMonitoring = OpenTelemetry.monitoring <> EKG.monitoring logger argsMonitoringPort
145+
, IDEMain.argsMonitoring = OpenTelemetry.monitoring
152146
}

ghcide/ghcide.cabal

Lines changed: 0 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ source-repository head
2828
type: git
2929
location: https://github.com/haskell/haskell-language-server.git
3030

31-
flag ekg
32-
description:
33-
Enable EKG monitoring of the build graph and other metrics on port 8999
34-
35-
default: False
36-
manual: True
37-
3831
flag pedantic
3932
description: Enable -Werror
4033
default: False
@@ -178,7 +171,6 @@ library
178171
Development.IDE.LSP.Server
179172
Development.IDE.Main
180173
Development.IDE.Main.HeapStats
181-
Development.IDE.Monitoring.EKG
182174
Development.IDE.Monitoring.OpenTelemetry
183175
Development.IDE.Plugin
184176
Development.IDE.Plugin.Completions
@@ -218,13 +210,6 @@ library
218210
ghc-options:
219211
-Werror
220212

221-
if flag(ekg)
222-
build-depends:
223-
, ekg-core
224-
, ekg-wai
225-
226-
cpp-options: -DMONITORING_EKG
227-
228213
flag test-exe
229214
description: Build the ghcide-test-preprocessor executable
230215
default: True
@@ -312,101 +297,3 @@ library ghcide-test-utils
312297
OverloadedStrings
313298
RecordWildCards
314299
ViewPatterns
315-
316-
test-suite ghcide-tests
317-
import: warnings
318-
type: exitcode-stdio-1.0
319-
default-language: GHC2021
320-
build-tool-depends:
321-
, ghcide:ghcide
322-
, ghcide:ghcide-test-preprocessor
323-
, implicit-hie:gen-hie
324-
325-
build-depends:
326-
, aeson
327-
, async
328-
, base
329-
, containers
330-
, data-default
331-
, directory
332-
, enummapset
333-
, extra
334-
, filepath
335-
, fuzzy
336-
, ghcide
337-
, ghcide:ghcide-test-utils
338-
, hls-plugin-api
339-
, lens
340-
, list-t
341-
, lsp
342-
, lsp-test ^>=0.17.0.0
343-
, lsp-types
344-
, monoid-subclasses
345-
, mtl
346-
, network-uri
347-
, QuickCheck
348-
, random
349-
, regex-tdfa ^>=1.3.1
350-
, row-types
351-
, shake
352-
, sqlite-simple
353-
, stm
354-
, stm-containers
355-
, tasty
356-
, tasty-expected-failure
357-
, tasty-hunit >=0.10
358-
, tasty-quickcheck
359-
, tasty-rerun
360-
, text
361-
, text-rope
362-
, unordered-containers
363-
364-
if impl(ghc <9.3)
365-
build-depends: ghc-typelits-knownnat
366-
367-
hs-source-dirs: test/exe
368-
ghc-options: -threaded -O0
369-
370-
main-is: Main.hs
371-
other-modules:
372-
AsyncTests
373-
BootTests
374-
ClientSettingsTests
375-
CodeLensTests
376-
CompletionTests
377-
CPPTests
378-
CradleTests
379-
DependentFileTest
380-
DiagnosticTests
381-
ExceptionTests
382-
FindDefinitionAndHoverTests
383-
FuzzySearch
384-
GarbageCollectionTests
385-
HaddockTests
386-
HieDbRetry
387-
HighlightTests
388-
IfaceTests
389-
InitializeResponseTests
390-
LogType
391-
NonLspCommandLine
392-
OpenCloseTest
393-
OutlineTests
394-
PluginSimpleTests
395-
PositionMappingTests
396-
PreprocessorTests
397-
Progress
398-
ReferenceTests
399-
RootUriTests
400-
SafeTests
401-
SymlinkTests
402-
TestUtils
403-
THTests
404-
UnitTests
405-
WatchedFileTests
406-
407-
-- Tests that have been pulled out of the main file
408-
default-extensions:
409-
LambdaCase
410-
OverloadedStrings
411-
RecordWildCards
412-
ViewPatterns

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ import Development.IDE.Types.Location
4242
import Development.IDE.Types.Options (IdeTesting (..))
4343
import GHC.TypeLits (KnownSymbol)
4444
import Ide.Logger (Pretty (pretty),
45+
Priority (..),
4546
Recorder,
4647
WithPriority,
4748
cmapWithPrio,
48-
logDebug)
49+
logWith)
4950
import qualified Language.LSP.Protocol.Message as LSP
5051
import qualified Language.LSP.Server as LSP
5152

@@ -110,16 +111,16 @@ addFileOfInterest state f v = do
110111
pure (new, (prev, new))
111112
when (prev /= Just v) $ do
112113
join $ atomically $ recordDirtyKeys (shakeExtras state) IsFileOfInterest [f]
113-
logDebug (ideLogger state) $
114-
"Set files of interest to: " <> T.pack (show files)
114+
logWith (ideLogger state) Debug $
115+
LogSetFilesOfInterest (HashMap.toList files)
115116

116117
deleteFileOfInterest :: IdeState -> NormalizedFilePath -> IO ()
117118
deleteFileOfInterest state f = do
118119
OfInterestVar var <- getIdeGlobalState state
119120
files <- modifyVar' var $ HashMap.delete f
120121
join $ atomically $ recordDirtyKeys (shakeExtras state) IsFileOfInterest [f]
121-
logDebug (ideLogger state) $ "Set files of interest to: " <> T.pack (show files)
122-
122+
logWith (ideLogger state) Debug $
123+
LogSetFilesOfInterest (HashMap.toList files)
123124
scheduleGarbageCollection :: IdeState -> IO ()
124125
scheduleGarbageCollection state = do
125126
GarbageCollectVar var <- getIdeGlobalState state

0 commit comments

Comments
 (0)