File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
plugins/hls-semantic-tokens-plugin
src/Ide/Plugin/SemanticTokens Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 77
88module Ide.Plugin.SemanticTokens.SemanticConfig where
99
10+ import Data.Char (toLower )
1011import Data.Default (def )
1112import qualified Data.Set as S
1213import qualified Data.Text as T
@@ -35,6 +36,10 @@ lspTokenTypeDescriptions =
3536allHsTokenTypes :: [HsSemanticTokenType ]
3637allHsTokenTypes = enumFrom minBound
3738
39+ lowerFirst :: String -> String
40+ lowerFirst [] = []
41+ lowerFirst (x: xs) = toLower x : xs
42+
3843allHsTokenNameStrings :: [String ]
3944allHsTokenNameStrings = map (drop 1 . show ) allHsTokenTypes
4045
@@ -60,9 +65,9 @@ mkSemanticConfigFunctions = do
6065 let semanticConfigPropertiesName = mkName " semanticConfigProperties"
6166 let useSemanticConfigActionName = mkName " useSemanticConfigAction"
6267 let
63- allLabels = map LabelE allHsTokenNameStrings
68+ allLabels = map ( LabelE . lowerFirst) allHsTokenNameStrings
6469 allFieldsNames = map (mkName . toConfigName) allHsTokenNameStrings
65- allVariableNames = map (mkName . (" variable_ " <> ) . toConfigName) allHsTokenNameStrings
70+ allVariableNames = map (mkName . (" _variable_ " <> ) . toConfigName) allHsTokenNameStrings
6671 -- <- useSemanticConfigAction label pid config
6772 mkGetProperty (variable, label) =
6873 BindS
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ semanticTokensConfigTest = testGroup "semantic token config test" [
141141 testCase " function to variable" $ do
142142 let content = Text. unlines [" module Hello where" , " go _ = 1" ]
143143 let fs = mkFs $ directFile " Hello.hs" content
144- let funcVar = object [" Function " .= var]
144+ let funcVar = object [" function " .= var]
145145 var :: String
146146 var = " variable"
147147 do
You can’t perform that action at this time.
0 commit comments