Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module provides mappings to convert token type information in the Haskell IDE plugin. It includes functions for:
- Mapping semantic token type to and from the LSP default token type.
- Mapping from GHC type and tyThing to semantic token type.
- Mapping from hieAst identifier details to haskell semantic token type.
- Mapping from LSP tokens to SemanticTokenOriginal.
Synopsis
- nameInfixOperator :: Name -> Maybe HsSemanticTokenType
- toLspTokenType :: SemanticTokensConfig -> HsSemanticTokenType -> SemanticTokenTypes
- lspTokenReverseMap :: SemanticTokensConfig -> Map SemanticTokenTypes HsSemanticTokenType
- lspTokenTypeHsTokenType :: SemanticTokensConfig -> SemanticTokenTypes -> Maybe HsSemanticTokenType
- tyThingSemantic :: TyThing -> Maybe HsSemanticTokenType
- tyThingSemantic' :: TyThing -> Maybe HsSemanticTokenType
- expandTypeSyn :: Type -> Type
- isFunType :: Type -> Bool
- hieKindFunMasksKind :: HieKind a -> HieFunMaskKind a
- recoverFunMaskArray :: Array TypeIndex HieTypeFlat -> Array TypeIndex Bool
- typeSemantic :: HieFunMaskKind hType -> hType -> Maybe HsSemanticTokenType
- infoTokenType :: ContextInfo -> Maybe HsSemanticTokenType
- recoverSemanticTokens :: SemanticTokensConfig -> VirtualFile -> SemanticTokens -> Either Text [SemanticTokenOriginal HsSemanticTokenType]
- lspTokenHsToken :: SemanticTokensConfig -> SemanticTokenOriginal SemanticTokenTypes -> SemanticTokenOriginal HsSemanticTokenType
- recoverLspSemanticTokens :: VirtualFile -> SemanticTokens -> Either Text [SemanticTokenOriginal SemanticTokenTypes]
0. Mapping name to Hs semantic token type.
1. Mapping semantic token type to and from the LSP default token type.
toLspTokenType :: SemanticTokensConfig -> HsSemanticTokenType -> SemanticTokenTypes Source #
map from haskell semantic token type to LSP default token type
lspTokenReverseMap :: SemanticTokensConfig -> Map SemanticTokenTypes HsSemanticTokenType Source #
lspTokenTypeHsTokenType :: SemanticTokensConfig -> SemanticTokenTypes -> Maybe HsSemanticTokenType Source #
2. Mapping from GHC type and tyThing to semantic token type.
tyThingSemantic :: TyThing -> Maybe HsSemanticTokenType Source #
tyThingSemantic
expandTypeSyn :: Type -> Type Source #
hieKindFunMasksKind :: HieKind a -> HieFunMaskKind a Source #
typeSemantic :: HieFunMaskKind hType -> hType -> Maybe HsSemanticTokenType Source #
3. Mapping from hieAst ContextInfo to haskell semantic token type.
4. Mapping from LSP tokens to SemanticTokenOriginal.
recoverSemanticTokens :: SemanticTokensConfig -> VirtualFile -> SemanticTokens -> Either Text [SemanticTokenOriginal HsSemanticTokenType] Source #
recoverSemanticTokens
for debug and test.
this function is used to recover the original tokens(with token in haskell token type zoon)
from the lsp semantic tokens(with token in lsp token type zoon)
the SemanticTokensConfig
used should be a map with bijection property
lspTokenHsToken :: SemanticTokensConfig -> SemanticTokenOriginal SemanticTokenTypes -> SemanticTokenOriginal HsSemanticTokenType Source #
lspTokenHsToken
for debug and test.
use the SemanticTokensConfig
to convert lsp token type to haskell token type
the SemanticTokensConfig
used should be a map with bijection property
recoverLspSemanticTokens :: VirtualFile -> SemanticTokens -> Either Text [SemanticTokenOriginal SemanticTokenTypes] Source #
recoverLspSemanticTokens for debug and test. this function is used to recover the original tokens(with token in standard lsp token type zoon) from the lsp semantic tokens(with token in lsp token type zoon)