Skip to content

Typo fixes #3325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,5 @@ This returns an error in HLS if `tasty-discover` is not in the path: `could not

Due to some limitations in the interaction between HLS and `stack`, there are [issues](https://github.com/haskell/haskell-language-server/issues/366) in projects with multiple components (i.e. a main library and executables, test suites or benchmarks):

- The project has to be built succesfully *before* loading it with HLS to get components other than the library work.
- The project has to be built successfully *before* loading it with HLS to get components other than the library work.
- Changes in the library are not automatically propagated to other components, especially in the presence of errors in the library. So you have to restart HLS in order for those components to be loaded correctly. The usual symptom is the editor showing errors like `Could not load module ...` or `Cannot satisfy -package ...`.
2 changes: 1 addition & 1 deletion ghcide-bench/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
number of iterations. There is ample room for improvement:
- Statistical analysis to detect outliers and auto infer the number of iterations needed
- GC stats analysis (currently -S is printed as part of the experiment)
- Analyisis of performance over the commit history of the project
- Analysis of performance over the commit history of the project

How to run:
1. `cabal exec cabal run ghcide-bench -- -- ghcide-bench-options`
Expand Down
4 changes: 2 additions & 2 deletions ghcide/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Progress reporting improvements (#1784) - Pepe Iborra
* Unify session loading using implicit-hie (#1783) - fendor
* Fix remove constraint (#1578) - Kostas Dermentzis
* Fix wrong extend import while type constuctor and data constructor have the same name (#1775) - Lei Zhu
* Imporve vscode extension schema generation (#1742) - Potato Hatsue
* Fix wrong extend import while type constructor and data constructor have the same name (#1775) - Lei Zhu
* Improve vscode extension schema generation (#1742) - Potato Hatsue
* Add hls-graph abstracting over shake (#1748) - Neil Mitchell
* Tease apart the custom SYB from ExactPrint (#1746) - Sandy Maguire
* fix class method completion (#1741) - Lei Zhu
Expand Down
2 changes: 1 addition & 1 deletion ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ runWithDb recorder fp k = do

withHieDb fp $ \writedb -> do
-- the type signature is necessary to avoid concretizing the tyvar
-- e.g. `withWriteDbRetrable initConn` without type signature will
-- e.g. `withWriteDbRetryable initConn` without type signature will
-- instantiate tyvar `a` to `()`
let withWriteDbRetryable :: WithHieDb
withWriteDbRetryable = makeWithHieDbRetryable recorder rng writedb
Expand Down
26 changes: 13 additions & 13 deletions ghcide/src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ typecheckModule (IdeDefer defer) hsc tc_helpers pm = do
tcRnModule session tc_helpers $ demoteIfDefer pm{pm_mod_summary = mod_summary''}
let errorPipeline = unDefer . hideDiag dflags . tagDiag
diags = map errorPipeline warnings
deferedError = any fst diags
deferredError = any fst diags
case etcm of
Left errs -> return (map snd diags ++ errs, Nothing)
Right tcm -> return (map snd diags, Just $ tcm{tmrDeferedError = deferedError})
Right tcm -> return (map snd diags, Just $ tcm{tmrDeferredError = deferredError})
where
demoteIfDefer = if defer then demoteTypeErrorsToWarnings else id

Expand Down Expand Up @@ -494,7 +494,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
writeBinCoreFile fp core_file
-- We want to drop references to guts and read in a serialized, compact version
-- of the core file from disk (as it is deserialised lazily)
-- This is because we don't want to keep the guts in memeory for every file in
-- This is because we don't want to keep the guts in memory for every file in
-- the project as it becomes prohibitively expensive
-- The serialized file however is much more compact and only requires a few
-- hundred megabytes of memory total even in a large project with 1000s of
Expand All @@ -503,7 +503,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
pure $ assert (core_hash1 == core_hash2)
$ Just (core_file, fingerprintToBS core_hash2)

-- Verify core file by rountrip testing and comparison
-- Verify core file by roundtrip testing and comparison
IdeOptions{optVerifyCoreFile} <- getIdeOptionsIO se
case core_file of
Just (core, _) | optVerifyCoreFile -> do
Expand Down Expand Up @@ -773,7 +773,7 @@ generateHieAsts hscEnv tcm =
-- These varBinds use unitDataConId but it could be anything as the id name is not used
-- during the hie file generation process. It's a workaround for the fact that the hie modules
-- don't export an interface which allows for additional information to be added to hie files.
let fake_splice_binds = Util.listToBag (map (mkVarBind unitDataConId) (spliceExpresions $ tmrTopLevelSplices tcm))
let fake_splice_binds = Util.listToBag (map (mkVarBind unitDataConId) (spliceExpressions $ tmrTopLevelSplices tcm))
real_binds = tcg_binds $ tmrTypechecked tcm
#if MIN_VERSION_ghc(9,0,1)
ts = tmrTypechecked tcm :: TcGblEnv
Expand Down Expand Up @@ -801,8 +801,8 @@ generateHieAsts hscEnv tcm =
#endif
#endif

spliceExpresions :: Splices -> [LHsExpr GhcTc]
spliceExpresions Splices{..} =
spliceExpressions :: Splices -> [LHsExpr GhcTc]
spliceExpressions Splices{..} =
DL.toList $ mconcat
[ DL.fromList $ map fst exprSplices
, DL.fromList $ map fst patSplices
Expand All @@ -812,7 +812,7 @@ spliceExpresions Splices{..} =
]

-- | In addition to indexing the `.hie` file, this function is responsible for
-- maintaining the 'IndexQueue' state and notfiying the user about indexing
-- maintaining the 'IndexQueue' state and notifying the user about indexing
-- progress.
--
-- We maintain a record of all pending index operations in the 'indexPending'
Expand Down Expand Up @@ -1409,7 +1409,7 @@ instance NFData IdeLinkable where
ml_core_file :: ModLocation -> FilePath
ml_core_file ml = ml_hi_file ml <.> "core"

-- | Retuns an up-to-date module interface, regenerating if needed.
-- | Returns an up-to-date module interface, regenerating if needed.
-- Assumes file exists.
-- Requires the 'HscEnv' to be set up with dependencies
-- See Note [Recompilation avoidance in the presence of TH]
Expand Down Expand Up @@ -1437,7 +1437,7 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
-- The source is modified if it is newer than the destination (iface file)
-- A more precise check for the core file is performed later
let sourceMod = case mb_dest_version of
Nothing -> SourceModified -- desitination file doesn't exist, assume modified source
Nothing -> SourceModified -- destination file doesn't exist, assume modified source
Just dest_version
| source_version <= dest_version -> SourceUnmodified
| otherwise -> SourceModified
Expand Down Expand Up @@ -1466,7 +1466,7 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
Just (old_hir, _)
| isNothing linkableNeeded || isJust (hirCoreFp old_hir)
-> do
-- Peform the fine grained recompilation check for TH
-- Perform the fine grained recompilation check for TH
maybe_recomp <- checkLinkableDependencies get_linkable_hashes (hsc_mod_graph sessionWithMsDynFlags) (hirRuntimeModules old_hir)
case maybe_recomp of
Just msg -> do_regenerate msg
Expand All @@ -1478,7 +1478,7 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
let runtime_deps
| not (mi_used_th iface) = emptyModuleEnv
| otherwise = parseRuntimeDeps (md_anns details)
-- Peform the fine grained recompilation check for TH
-- Perform the fine grained recompilation check for TH
maybe_recomp <- checkLinkableDependencies get_linkable_hashes (hsc_mod_graph sessionWithMsDynFlags) runtime_deps
case maybe_recomp of
Just msg -> do_regenerate msg
Expand Down Expand Up @@ -1598,7 +1598,7 @@ coreFileToLinkable linkableType session ms iface details core_file t = do
--- and leads to fun errors like "Cannot continue after interface file error".
getDocsBatch
:: HscEnv
-> Module -- ^ a moudle where the names are in scope
-> Module -- ^ a module where the names are in scope
-> [Name]
#if MIN_VERSION_ghc(9,3,0)
-> IO [Either String (Maybe [HsDoc GhcRn], IntMap (HsDoc GhcRn))]
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Core/RuleTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ data TcModuleResult = TcModuleResult
, tmrTypechecked :: TcGblEnv
, tmrTopLevelSplices :: Splices
-- ^ Typechecked splice information
, tmrDeferedError :: !Bool
, tmrDeferredError :: !Bool
-- ^ Did we defer any type errors for this module?
, tmrRuntimeModules :: !(ModuleEnv ByteString)
-- ^ Which modules did we need at runtime while compiling this file?
Expand Down
10 changes: 5 additions & 5 deletions ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do
let inLoadOrder = map (\HiFileResult{..} -> HomeModInfo hirModIface hirModDetails Nothing) ifaces
#if MIN_VERSION_ghc(9,3,0)
-- On GHC 9.4+, the module graph contains not only ModSummary's but each `ModuleNode` in the graph
-- also points to all the direct descendents of the current module. To get the keys for the descendents
-- also points to all the direct descendants of the current module. To get the keys for the descendants
-- we must get their `ModSummary`s
!final_deps <- do
dep_mss <- map msrModSummary <$> uses_ GetModSummaryWithoutTimestamps deps
Expand Down Expand Up @@ -950,7 +950,7 @@ getModIfaceRule recorder = defineEarlyCutoff (cmapWithPrio LogShake recorder) $
hiDiags <- case hiFile of
Just hiFile
| OnDisk <- status
, not (tmrDeferedError tmr) -> liftIO $ writeHiFile se hsc hiFile
, not (tmrDeferredError tmr) -> liftIO $ writeHiFile se hsc hiFile
_ -> pure []
return (fp, (diags++hiDiags, hiFile))
NotFOI -> do
Expand Down Expand Up @@ -1022,9 +1022,9 @@ regenerateHiFile sess f ms compNeeded = do
wDiags <- forM masts $ \asts ->
liftIO $ writeAndIndexHieFile hsc se (tmrModSummary tmr) f (tcg_exports $ tmrTypechecked tmr) asts source

-- We don't write the `.hi` file if there are defered errors, since we won't get
-- We don't write the `.hi` file if there are deferred errors, since we won't get
-- accurate diagnostics next time if we do
hiDiags <- if not $ tmrDeferedError tmr
hiDiags <- if not $ tmrDeferredError tmr
then liftIO $ writeHiFile se hsc hiFile
else pure []

Expand Down Expand Up @@ -1057,7 +1057,7 @@ getClientSettingsRule recorder = defineEarlyCutOffNoFile (cmapWithPrio LogShake
settings <- clientSettings <$> getIdeConfiguration
return (LBS.toStrict $ B.encode $ hash settings, settings)

-- | Returns the client configurarion stored in the IdeState.
-- | Returns the client configuration stored in the IdeState.
-- You can use this function to access it from shake Rules
getClientConfigAction :: Config -- ^ default value
-> Action Config
Expand Down
10 changes: 5 additions & 5 deletions ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ data ShakeExtras = ShakeExtras
-- ^ Map from a text document version to a PositionMapping that describes how to map
-- positions in a version of that document to positions in the latest version
-- First mapping is delta from previous version and second one is an
-- accumlation of all previous mappings.
-- accumulation of all previous mappings.
,progress :: ProgressReporting
,ideTesting :: IdeTesting
-- ^ Whether to enable additional lsp messages used by the test suite for checking invariants
Expand All @@ -280,12 +280,12 @@ data ShakeExtras = ShakeExtras
, withHieDb :: WithHieDb -- ^ Use only to read.
, hiedbWriter :: HieDbWriter -- ^ use to write
, persistentKeys :: TVar (KeyMap GetStalePersistent)
-- ^ Registery for functions that compute/get "stale" results for the rule
-- ^ Registry for functions that compute/get "stale" results for the rule
-- (possibly from disk)
, vfsVar :: TVar VFS
-- ^ A snapshot of the current state of the virtual file system. Updated on shakeRestart
-- VFS state is managed by LSP. However, the state according to the lsp library may be newer than the state of the current session,
-- leaving us vulnerable to suble race conditions. To avoid this, we take a snapshot of the state of the VFS on every
-- leaving us vulnerable to subtle race conditions. To avoid this, we take a snapshot of the state of the VFS on every
-- restart, so that the whole session sees a single consistent view of the VFS.
-- We don't need a STM.Map because we never update individual keys ourselves.
, defaultConfig :: Config
Expand Down Expand Up @@ -662,7 +662,7 @@ getStateKeys = (fmap.fmap) fst . atomically . ListT.toList . STM.listT . state
-- | Must be called in the 'Initialized' handler and only once
shakeSessionInit :: Recorder (WithPriority Log) -> IdeState -> IO ()
shakeSessionInit recorder ide@IdeState{..} = do
-- Take a snapshot of the VFS - it should be empty as we've recieved no notifications
-- Take a snapshot of the VFS - it should be empty as we've received no notifications
-- till now, but it can't hurt to be in sync with the `lsp` library.
vfs <- vfsSnapshot (lspEnv shakeExtras)
initSession <- newSession recorder shakeExtras (VFSModified vfs) shakeDb [] "shakeSessionInit"
Expand Down Expand Up @@ -831,7 +831,7 @@ instantiateDelayedAction (DelayedAction _ s p a) = do
b <- newBarrier
let a' = do
-- work gets reenqueued when the Shake session is restarted
-- it can happen that a work item finished just as it was reenqueud
-- it can happen that a work item finished just as it was reenqueued
-- in that case, skipping the work is fine
alreadyDone <- liftIO $ isJust <$> waitBarrierMaybe b
unless alreadyDone $ do
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/GHC/Compat/CPP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-- Copied from https://github.com/ghc/ghc/blob/master/compiler/main/DriverPipeline.hs on 14 May 2019
-- Requested to be exposed at https://gitlab.haskell.org/ghc/ghc/merge_requests/944.
-- Update the above MR got merged to master on 31 May 2019. When it becomes avialable to ghc-lib, this file can be removed.
-- Update the above MR got merged to master on 31 May 2019. When it becomes available to ghc-lib, this file can be removed.

{- HLINT ignore -} -- since copied from upstream

Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/GHC/Compat/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE PatternSynonyms #-}
{-# HLINT ignore "Unused LANGUAGE pragma" #-}

-- | Parser compaibility module.
-- | Parser compatibility module.
module Development.IDE.GHC.Compat.Parser (
initParserOpts,
initParserState,
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Import/FindImports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ notFoundErr env modName reason =
mkError' = diagFromString "not found" DsError (Compat.getLoc modName)
modName0 = unLoc modName
ppr' = showSDoc dfs
-- We convert the lookup result to a find result to reuse GHC's cannotFindMoudle pretty printer.
-- We convert the lookup result to a find result to reuse GHC's cannotFindModule pretty printer.
lookupToFindResult =
\case
LookupFound _m _pkgConfig ->
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Main/HeapStats.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ heapStatsThread l = forever $ do
threadDelay heapStatsInterval
logHeapStats l

-- | A helper function which lauches the 'heapStatsThread' and kills it
-- appropiately when the inner action finishes. It also checks to see
-- | A helper function which launches the 'heapStatsThread' and kills it
-- appropriately when the inner action finishes. It also checks to see
-- if `-T` is enabled.
withHeapStats :: Recorder (WithPriority Log) -> IO r -> IO r
withHeapStats l k = do
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Plugin/Completions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ produceCompletions recorder = do
_ -> return ([], Nothing)
define (cmapWithPrio LogShake recorder) $ \NonLocalCompletions file -> do
-- For non local completions we avoid depending on the parsed module,
-- synthetizing a fake module with an empty body from the buffer
-- synthesizing a fake module with an empty body from the buffer
-- in the ModSummary, which preserves all the imports
ms <- fmap fst <$> useWithStale GetModSummaryWithoutTimestamps file
sess <- fmap fst <$> useWithStale GhcSessionDeps file
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ cacheDataProducer uri env curMod globalEnv inScopeEnv limports = do
asNamespace :: ImportDecl GhcPs -> ModuleName
asNamespace imp = maybe (iDeclToModName imp) GHC.unLoc (ideclAs imp)
-- Full canonical names of imported modules
importDeclerations = map unLoc limports
importDeclarations = map unLoc limports


-- The given namespaces for the imported modules (ie. full name, or alias if used)
allModNamesAsNS = map (showModName . asNamespace) importDeclerations
allModNamesAsNS = map (showModName . asNamespace) importDeclarations

rdrElts = globalRdrEnvElts globalEnv

Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Spans/Documentation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ getDocumentation
-- TODO : Build a version of GHC exactprint to extract this information
-- more accurately.
-- TODO : Implement this for GHC 9.2 with in-tree annotations
-- (alternatively, just remove it and rely soley on GHC's parsing)
-- (alternatively, just remove it and rely solely on GHC's parsing)
getDocumentation sources targetName = fromMaybe [] $ do
#if MIN_VERSION_ghc(9,2,0)
Nothing
Expand All @@ -137,7 +137,7 @@ getDocumentation sources targetName = fromMaybe [] $ do
targetNameSpan <- realSpan $ getLoc targetName
tc <-
find ((==) (Just $ srcSpanFile targetNameSpan) . annotationFileName)
$ reverse sources -- TODO : Is reversing the list here really neccessary?
$ reverse sources -- TODO : Is reversing the list here really necessary?

-- Top level names bound by the module
let bs = [ n | let L _ HsModule{hsmodDecls} = pm_parsed_source tc
Expand Down
10 changes: 5 additions & 5 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ diagnosticTests = testGroup "diagnostics"
[ ( "Foo.hs"
-- The test is to make sure that warnings contain unqualified names
-- where appropriate. The warning should use an unqualified name 'Ord', not
-- sometihng like 'GHC.Classes.Ord'. The choice of redundant-constraints to
-- something like 'GHC.Classes.Ord'. The choice of redundant-constraints to
-- test this is fairly arbitrary.
, [(DsWarning, (2, if ghcVersion >= GHC94 then 7 else 0), "Redundant constraint: Ord a")
]
Expand Down Expand Up @@ -2593,7 +2593,7 @@ simpleMultiTest3 =
checkDefs locs (pure [fooL])
expectNoMoreDiagnostics 0.5

-- Like simpleMultiTest but open the files in component 'a' in a seperate session
-- Like simpleMultiTest but open the files in component 'a' in a separate session
simpleMultiDefTest :: TestTree
simpleMultiDefTest = testCase "simple-multi-def-test" $ runWithExtraFiles "multi" $ \dir -> do
let aPath = dir </> "a/A.hs"
Expand Down Expand Up @@ -2670,7 +2670,7 @@ ifaceTHTest = testCase "iface-th-test" $ runWithExtraFiles "TH" $ \dir -> do
-- Change [TH]a from () to Bool
liftIO $ writeFileUTF8 aPath (unlines $ init (lines $ T.unpack aSource) ++ ["th_a = [d| a = False|]"])

-- Check that the change propogates to C
-- Check that the change propagates to C
changeDoc cdoc [TextDocumentContentChangeEvent Nothing Nothing cSource]
expectDiagnostics
[("THC.hs", [(DsError, (4, 4), "Couldn't match expected type '()' with actual type 'Bool'")])
Expand All @@ -2694,11 +2694,11 @@ ifaceErrorTest = testCase "iface-error-test-1" $ runWithExtraFiles "recomp" $ \d

-- Change y from Int to B
changeDoc bdoc [TextDocumentContentChangeEvent Nothing Nothing $ T.unlines ["module B where", "y :: Bool", "y = undefined"]]
-- save so that we can that the error propogates to A
-- save so that we can that the error propagates to A
sendNotification STextDocumentDidSave (DidSaveTextDocumentParams bdoc Nothing)


-- Check that the error propogates to A
-- Check that the error propagates to A
expectDiagnostics
[("A.hs", [(DsError, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'")])]

Expand Down
Loading