Skip to content

Rename the configuration section from languageServerHaskell => haskell #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ Then issue `:CocConfig` and add the following to your Coc config file.
"haskell"
],
"initializationOptions": {
"languageServerHaskell": {
"haskell": {
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Ide/Plugin/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ instance Default Config where
-- TODO: Add API for plugins to expose their own LSP config options
instance A.FromJSON Config where
parseJSON = A.withObject "Config" $ \v -> do
s <- v .: "languageServerHaskell"
s <- v .: "haskell"
flip (A.withObject "Config.settings") s $ \o -> Config
<$> o .:? "hlintOn" .!= hlintOn def
<*> o .:? "diagnosticsOnChange" .!= diagnosticsOnChange def
Expand All @@ -81,17 +81,17 @@ instance A.FromJSON Config where
<*> o .:? "formatOnImportOn" .!= formatOnImportOn def
<*> o .:? "formattingProvider" .!= formattingProvider def

-- 2017-10-09 23:22:00.710515298 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"languageServerHaskell":{"maxNumberOfProblems":100,"hlintOn":true}}}}
-- 2017-10-09 23:22:00.710515298 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"haskell":{"maxNumberOfProblems":100,"hlintOn":true}}}}
-- 2017-10-09 23:22:00.710667381 [ThreadId 15] - reactor:got didChangeConfiguration notification:
-- NotificationMessage
-- {_jsonrpc = "2.0"
-- , _method = WorkspaceDidChangeConfiguration
-- , _params = DidChangeConfigurationParams
-- {_settings = Object (fromList [("languageServerHaskell",Object (fromList [("hlintOn",Bool True)
-- ,("maxNumberOfProblems",Number 100.0)]))])}}
-- {_settings = Object (fromList [("haskell",Object (fromList [("hlintOn",Bool True)
-- ,("maxNumberOfProblems",Number 100.0)]))])}}

instance A.ToJSON Config where
toJSON (Config h diag m d l c f fp) = object [ "languageServerHaskell" .= r ]
toJSON (Config h diag m d l c f fp) = object [ "haskell" .= r ]
where
r = object [ "hlintOn" .= h
, "diagnosticsOnChange" .= diag
Expand Down
4 changes: 2 additions & 2 deletions test/functional/Completion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ tests = testGroup "completions" [
-- doc <- openDoc "Completion.hs" "haskell"
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics

-- let config = object [ "languageServerHaskell" .= (object ["completionSnippetsOn" .= False])]
-- let config = object [ "haskell" .= (object ["completionSnippetsOn" .= False])]

-- sendNotification WorkspaceDidChangeConfiguration
-- (DidChangeConfigurationParams config)
Expand Down Expand Up @@ -393,4 +393,4 @@ contextTests = testGroup "contexts" [
compls `shouldContainCompl` x =
filter ((== x) . (^. label)) compls `shouldNotSatisfy` null
compls `shouldNotContainCompl` x =
filter ((== x) . (^. label)) compls `shouldSatisfy` null
filter ((== x) . (^. label)) compls `shouldSatisfy` null
4 changes: 2 additions & 2 deletions test/functional/Format.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ ormoluTests :: TestTree
ormoluTests = testGroup "ormolu" [
goldenVsStringDiff "formats correctly" goldenGitDiff ("test/testdata/Format.ormolu." ++ ormoluGoldenSuffix ++ ".hs") $ runSession hieCommand fullCaps "test/testdata" $ do
let formatLspConfig provider =
object [ "languageServerHaskell" .= object ["formattingProvider" .= (provider :: Value)] ]
object [ "haskell" .= object ["formattingProvider" .= (provider :: Value)] ]
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu"))
doc <- openDoc "Format.hs" "haskell"
formatDoc doc (FormattingOptions 2 True)
Expand All @@ -129,7 +129,7 @@ ormoluTests = testGroup "ormolu" [


formatLspConfig :: Value -> Value
formatLspConfig provider = object [ "languageServerHaskell" .= object ["formattingProvider" .= (provider :: Value)] ]
formatLspConfig provider = object [ "haskell" .= object ["formattingProvider" .= (provider :: Value)] ]

formatConfig :: Value -> SessionConfig
formatConfig provider = defaultConfig { lspConfig = Just (formatLspConfig provider) }
Expand Down