Skip to content
Draft
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
Next Next commit
Start work on PureScript IDE Information
  • Loading branch information
purefunctor committed Apr 9, 2022
commit 4f92adfa20b56e25a9703c3741f25f53122e129e
1 change: 1 addition & 0 deletions purescript.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ library
Language.PureScript.Ide.Types
Language.PureScript.Ide.Usage
Language.PureScript.Ide.Util
Language.PureScript.Ide.Psii
Language.PureScript.Interactive
Language.PureScript.Interactive.Completion
Language.PureScript.Interactive.Directive
Expand Down
28 changes: 28 additions & 0 deletions src/Language/PureScript/Ide/Psii.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- |
-- `psii` stands for `PureScript IDE Information`.
--
-- Q: How to read `psii`?
-- A: As in "psy" or "sai".
module Language.PureScript.Ide.Psii where

import Protolude

-- |
-- The verbosity of IDE information.
data PsiiVerbosity
-- | Include no information at all.
= PsiiNoInformation
-- | Include top-level information.
| PsiiOnlyTopLevel
-- | Include local information.
| PsiiWithLocal
deriving (Show, Eq, Ord)

-- |
-- The information entry to be emitted.
data PsiiInformation
-- | A declaration in a source file.
= PsiiDeclaration
-- | A reference to a declaration.
| PsiiReference
deriving (Show, Eq, Ord)
7 changes: 6 additions & 1 deletion src/Language/PureScript/TypeChecker/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import qualified Data.List.NonEmpty as NEL
import Language.PureScript.Crash (internalError)
import Language.PureScript.Environment
import Language.PureScript.Errors
import Language.PureScript.Ide.Psii
import Language.PureScript.Names
import Language.PureScript.Pretty.Types
import Language.PureScript.Pretty.Values
Expand Down Expand Up @@ -104,11 +105,15 @@ data CheckState = CheckState
, checkConstructorImportsForCoercible :: S.Set (ModuleName, Qualified (ProperName 'ConstructorName))
-- ^ Newtype constructors imports required to solve Coercible constraints.
-- We have to keep track of them so that we don't emit unused import warnings.
, checkPsiiVerbosity :: PsiiVerbosity
-- ^ The verbosity of IDE information to be collected.
, checkPsiiInformation :: S.Set (PsiiInformation)
-- ^ The IDE information collected through type-checking.
}

-- | Create an empty @CheckState@
emptyCheckState :: Environment -> CheckState
emptyCheckState env = CheckState env 0 0 0 Nothing [] emptySubstitution [] mempty
emptyCheckState env = CheckState env 0 0 0 Nothing [] emptySubstitution [] mempty PsiiNoInformation mempty

-- | Unification variables
type Unknown = Int
Expand Down