Skip to content

Sending workspace/configuration request while handling Initilized #3745

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

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions ghcide/src/Development/IDE/LSP/Notifications.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Development.IDE.Types.Location
import Development.IDE.Types.Shake (toKey)
import Ide.Logger
import Ide.Types
import Language.LSP.Server (sendRequest)
import Numeric.Natural

data Log
Expand Down Expand Up @@ -127,6 +128,12 @@ descriptor recorder plId = (defaultPluginDescriptor plId) { pluginNotificationHa
setSomethingModified (VFSModified vfs) ide [toKey GetClientSettings emptyFilePath] "config change"

, mkPluginNotificationHandler LSP.SMethod_Initialized $ \ide _ _ _ -> do

let params = ConfigurationParams [ConfigurationItem Nothing (Just "haskell.formattingProvider")]
void $ sendRequest LSP.SMethod_WorkspaceConfiguration params $ \res -> do
liftIO $ logWarning (ideLogger ide) $ "zltest: " <> (Text.pack $ show res)
pure ()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably want to block waiting for the response to SMethod_WorkspaceConfiguration here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to. We have a default config, so we should always be able to operate and just update the config dynamically when we get the response, as we would if we got didChangeConfiguration.

--------- Initialize Shake session --------------------------------------------------------------------
liftIO $ shakeSessionInit (cmapWithPrio LogShake recorder) ide

Expand Down