haskell-language-server-2.9.0.0: LSP server for GHC

Safe Haskell | None
Language | GHC2021

Ide.Plugin.CodeRange.Rules

Contents

- Internal

Synopsis

- data CodeRange = CodeRange {
  - _codeRange_range :: !Range
  - _codeRange_children :: !(Vector CodeRange)
  - _codeRange_kind :: !CodeRangeKind
  }
- codeRange_range :: Lens' CodeRange Range
- codeRange_children :: Lens' CodeRange (Vector CodeRange)
- codeRange_kind :: Lens' CodeRange CodeRangeKind
- data CodeRangeKind
  - = CodeKindRegion
  - | CodeKindImports
  - | CodeKindComment
- data GetCodeRange = GetCodeRange
- codeRangeRule :: Recorder (WithPriority Log) -> Rules ()
- data Log
  - = LogShake Log
  - | LogNoAST
  - | LogFoundInterleaving CodeRange CodeRange
- removeInterleaving :: [CodeRange] -> Writer [Log] [CodeRange]
- simplify :: CodeRange -> CodeRange
- crkToFrk :: CodeRangeKind -> FoldingRangeKind

# Documentation

data CodeRange #

A tree representing code ranges in a file. This can be useful for features like selection range and folding range

Constructors

CodeRange |
Fields _codeRange_range :: !Range Range for current level _codeRange_children :: !(Vector CodeRange) A vector of children, sorted by their ranges in ascending order. Children are guaranteed not to interleave, but some gaps may exist among them. _codeRange_kind :: !CodeRangeKind

#### Instances

Instances details

NFData CodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods rnf :: CodeRange -> () #
Generic CodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Associated Types
type Rep CodeRange |
Instance details Defined in Ide.Plugin.CodeRange.Rules type Rep CodeRange = D1 ('MetaData "CodeRange" "Ide.Plugin.CodeRange.Rules" "haskell-language-server-2.9.0.0-7KkJNSYIcTsGEsKYGe9LR8-hls-code-range-plugin" 'False) (C1 ('MetaCons "CodeRange" 'PrefixI 'True) (S1 ('MetaSel ('Just "_codeRange_range") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Range) :*: (S1 ('MetaSel ('Just "_codeRange_children") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Vector CodeRange)) :*: S1 ('MetaSel ('Just "_codeRange_kind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CodeRangeKind))))
Methods from :: CodeRange -> Rep CodeRange x # to :: Rep CodeRange x -> CodeRange #
Show CodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods showsPrec :: Int -> CodeRange -> ShowS # show :: CodeRange -> String # showList :: [CodeRange] -> ShowS #
Eq CodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods (==) :: CodeRange -> CodeRange -> Bool # (/=) :: CodeRange -> CodeRange -> Bool #
Ord CodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods compare :: CodeRange -> CodeRange -> Ordering # (<) :: CodeRange -> CodeRange -> Bool # (<=) :: CodeRange -> CodeRange -> Bool # (>) :: CodeRange -> CodeRange -> Bool # (>=) :: CodeRange -> CodeRange -> Bool # max :: CodeRange -> CodeRange -> CodeRange # min :: CodeRange -> CodeRange -> CodeRange #
type Rep CodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules type Rep CodeRange = D1 ('MetaData "CodeRange" "Ide.Plugin.CodeRange.Rules" "haskell-language-server-2.9.0.0-7KkJNSYIcTsGEsKYGe9LR8-hls-code-range-plugin" 'False) (C1 ('MetaCons "CodeRange" 'PrefixI 'True) (S1 ('MetaSel ('Just "_codeRange_range") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Range) :*: (S1 ('MetaSel ('Just "_codeRange_children") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Vector CodeRange)) :*: S1 ('MetaSel ('Just "_codeRange_kind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CodeRangeKind))))

codeRange_range :: Lens' CodeRange Range #

codeRange_children :: Lens' CodeRange (Vector CodeRange) #

codeRange_kind :: Lens' CodeRange CodeRangeKind #

data CodeRangeKind #

`CodeKind` represents the kind of a code range

Constructors

CodeKindRegion | ordinary code
CodeKindImports | the group of imports
CodeKindComment | a comment

#### Instances

Instances details

NFData CodeRangeKind # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods rnf :: CodeRangeKind -> () #
Generic CodeRangeKind # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Associated Types
type Rep CodeRangeKind |
Instance details Defined in Ide.Plugin.CodeRange.Rules type Rep CodeRangeKind = D1 ('MetaData "CodeRangeKind" "Ide.Plugin.CodeRange.Rules" "haskell-language-server-2.9.0.0-7KkJNSYIcTsGEsKYGe9LR8-hls-code-range-plugin" 'False) (C1 ('MetaCons "CodeKindRegion" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CodeKindImports" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CodeKindComment" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: CodeRangeKind -> Rep CodeRangeKind x # to :: Rep CodeRangeKind x -> CodeRangeKind #
Show CodeRangeKind # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods showsPrec :: Int -> CodeRangeKind -> ShowS # show :: CodeRangeKind -> String # showList :: [CodeRangeKind] -> ShowS #
Eq CodeRangeKind # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods (==) :: CodeRangeKind -> CodeRangeKind -> Bool # (/=) :: CodeRangeKind -> CodeRangeKind -> Bool #
type Rep CodeRangeKind # |
Instance details Defined in Ide.Plugin.CodeRange.Rules type Rep CodeRangeKind = D1 ('MetaData "CodeRangeKind" "Ide.Plugin.CodeRange.Rules" "haskell-language-server-2.9.0.0-7KkJNSYIcTsGEsKYGe9LR8-hls-code-range-plugin" 'False) (C1 ('MetaCons "CodeKindRegion" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CodeKindImports" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CodeKindComment" 'PrefixI 'False) (U1 :: Type -> Type)))

data GetCodeRange #

Constructors

GetCodeRange |

#### Instances

Instances details

NFData GetCodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods rnf :: GetCodeRange -> () #
Generic GetCodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Associated Types
type Rep GetCodeRange |
Instance details Defined in Ide.Plugin.CodeRange.Rules type Rep GetCodeRange = D1 ('MetaData "GetCodeRange" "Ide.Plugin.CodeRange.Rules" "haskell-language-server-2.9.0.0-7KkJNSYIcTsGEsKYGe9LR8-hls-code-range-plugin" 'False) (C1 ('MetaCons "GetCodeRange" 'PrefixI 'False) (U1 :: Type -> Type))
Methods from :: GetCodeRange -> Rep GetCodeRange x # to :: Rep GetCodeRange x -> GetCodeRange #
Show GetCodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods showsPrec :: Int -> GetCodeRange -> ShowS # show :: GetCodeRange -> String # showList :: [GetCodeRange] -> ShowS #
Eq GetCodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods (==) :: GetCodeRange -> GetCodeRange -> Bool # (/=) :: GetCodeRange -> GetCodeRange -> Bool #
Hashable GetCodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods hashWithSalt :: Int -> GetCodeRange -> Int # hash :: GetCodeRange -> Int #
type Rep GetCodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules type Rep GetCodeRange = D1 ('MetaData "GetCodeRange" "Ide.Plugin.CodeRange.Rules" "haskell-language-server-2.9.0.0-7KkJNSYIcTsGEsKYGe9LR8-hls-code-range-plugin" 'False) (C1 ('MetaCons "GetCodeRange" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult GetCodeRange # |
Instance details Defined in Ide.Plugin.CodeRange.Rules type RuleResult GetCodeRange = CodeRange

codeRangeRule :: Recorder (WithPriority Log) -> Rules () #

data Log #

Constructors

LogShake Log |
LogNoAST |
LogFoundInterleaving CodeRange CodeRange |

#### Instances

Instances details

Show Log # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods showsPrec :: Int -> Log -> ShowS # show :: Log -> String # showList :: [Log] -> ShowS #
Pretty Log # |
Instance details Defined in Ide.Plugin.CodeRange.Rules Methods pretty :: Log -> Doc ann # prettyList :: [Log] -> Doc ann #

# Internal

removeInterleaving :: [CodeRange] -> Writer [Log] [CodeRange] #

Remove interleaving of the list of `CodeRange`s.

simplify :: CodeRange -> CodeRange #

Remove redundant nodes in `CodeRange` tree

crkToFrk :: CodeRangeKind -> FoldingRangeKind #

Maps type CodeRangeKind to FoldingRangeKind