File tree 2 files changed +8
-3
lines changed
plugins/hls-semantic-tokens-plugin
src/Ide/Plugin/SemanticTokens
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
module Ide.Plugin.SemanticTokens.SemanticConfig where
9
9
10
+ import Data.Char (toLower )
10
11
import Data.Default (def )
11
12
import qualified Data.Set as S
12
13
import qualified Data.Text as T
@@ -35,6 +36,10 @@ lspTokenTypeDescriptions =
35
36
allHsTokenTypes :: [HsSemanticTokenType ]
36
37
allHsTokenTypes = enumFrom minBound
37
38
39
+ lowerFirst :: String -> String
40
+ lowerFirst [] = []
41
+ lowerFirst (x: xs) = toLower x : xs
42
+
38
43
allHsTokenNameStrings :: [String ]
39
44
allHsTokenNameStrings = map (drop 1 . show ) allHsTokenTypes
40
45
@@ -60,9 +65,9 @@ mkSemanticConfigFunctions = do
60
65
let semanticConfigPropertiesName = mkName " semanticConfigProperties"
61
66
let useSemanticConfigActionName = mkName " useSemanticConfigAction"
62
67
let
63
- allLabels = map LabelE allHsTokenNameStrings
68
+ allLabels = map ( LabelE . lowerFirst) allHsTokenNameStrings
64
69
allFieldsNames = map (mkName . toConfigName) allHsTokenNameStrings
65
- allVariableNames = map (mkName . (" variable_ " <> ) . toConfigName) allHsTokenNameStrings
70
+ allVariableNames = map (mkName . (" _variable_ " <> ) . toConfigName) allHsTokenNameStrings
66
71
-- <- useSemanticConfigAction label pid config
67
72
mkGetProperty (variable, label) =
68
73
BindS
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ semanticTokensConfigTest = testGroup "semantic token config test" [
141
141
testCase " function to variable" $ do
142
142
let content = Text. unlines [" module Hello where" , " go _ = 1" ]
143
143
let fs = mkFs $ directFile " Hello.hs" content
144
- let funcVar = object [" Function " .= var]
144
+ let funcVar = object [" function " .= var]
145
145
var :: String
146
146
var = " variable"
147
147
do
You can’t perform that action at this time.
0 commit comments