haskell-language-server-2.7.0.0: LSP server for GHC
Safe HaskellSafe-Inferred
LanguageGHC2021

Ide.Plugin.SemanticTokens.Mappings

Description

This module provides mappings to convert token type information in the Haskell IDE plugin. It includes functions for:

  1. Mapping semantic token type to and from the LSP default token type.
  2. Mapping from GHC type and tyThing to semantic token type.
  3. Mapping from hieAst identifier details to haskell semantic token type.
  4. Mapping from LSP tokens to SemanticTokenOriginal.
Synopsis

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

2. Mapping from GHC type and tyThing to semantic token type.

recoverFunMaskArray Source #

Arguments

:: Array TypeIndex HieTypeFlat

flat types

-> Array TypeIndex Bool

array of bool indicating whether the type is a function

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)