-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
upgrade lsp to 1.5 #3072
upgrade lsp to 1.5 #3072
Conversation
I see. In haskell-language-server/exe/Main.hs Lines 72 to 82 in 347a718
Then it goes into infinite recursion... So we should not enable debug logs in |
Hmm, I thought I had convinced myself that wasn't a problem :| I'm not 100% sure what to do about this. It's nice to be able to log the responses from LSP, but we do indeed have a loop problem if we then forward them on like this. |
And some other tests depend on the logs, I had to fix them one by one. This makes the PR harder than I initially thought. Currently I'm working on hlint tests |
Finally, the CI is almost green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, outstanding work!
instance Hashable Location | ||
instance Hashable Range | ||
instance Hashable Position | ||
instance Hashable UInt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instances have been added to lsp-types-1.5. This is not a question or complaint, just a note for the next reviewer
@@ -706,6 +706,7 @@ shakeRestart recorder IdeState{..} vfs reason acts = | |||
backlog <- readTVarIO $ dirtyKeys shakeExtras | |||
queue <- atomicallyNamed "actionQueue - peek" $ peekInProgress $ actionQueue shakeExtras | |||
|
|||
-- this log is required by tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
@@ -106,8 +109,15 @@ runLanguageServer options inH outH defaultConfig onConfigurationChange setup = d | |||
, LSP.options = modifyOptions options | |||
} | |||
|
|||
let lspCologAction :: MonadIO m2 => Colog.LogAction m2 (Colog.WithSeverity LspServerLog) | |||
lspCologAction = toCologActionWithPrio $ cfilter | |||
(\msg -> priority msg >= Info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to filter out the bad debug logs from lsp
right? I'd like to come up with a better solution there. Can you open a ticket in lsp
and link to it here, so we remember why we're doing this? At the moment this means that the low-level message logs won't even go to the file logging, which is bad since they're useful.
An alternative solution could be to change the log action in HLS that sends logs to the client to never send debug logs. But I guess that's also surprising :|
@@ -381,3 +380,14 @@ priorityToLsp = | |||
Info -> MtInfo | |||
Warning -> MtWarning | |||
Error -> MtError | |||
|
|||
toCologActionWithPrio :: (MonadIO m, HasCallStack) => Recorder (WithPriority msg) -> LogAction m (WithSeverity msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Worth checking if there's anywhere else doing this already? I can't remember if there is...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first time co-log-core
was introduced in HLS, so I think there isn't a existing function for this.
ghcide/test/exe/Main.hs
Outdated
pure (rope, range, replacement) | ||
monadicIO $ forAllM gen | ||
$ \(rope, range, replacement) -> do | ||
newRope <- liftIO $ applyChange (toCologActionWithPrio $ cmapWithPrio LogVfs recorder) rope (TextDocumentContentChangeEvent (Just range) Nothing replacement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not pass mempty :: LogAction Identity
here? then you don't need IO, and you'll just not get hte log messages which you don't care about anyway. Then I think you can keep the old code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good advice!
* upgrade lsp to 1.5 * fix stack.yaml * try fix tests * disable verbose logging in ghcide * fix more tests in ghcide * fix floskell test * disable debug log in func-test * disable debug log in lsp itself * Revert "disable debug log in func-test" This reverts commit 1fd6658. * remove unused import * fix hls test utils * upgrade lsp in nix * fix func-tests * Revert "fix func-tests" This reverts commit 2ecd76d. * fix waitForDiagnosticsFromSourceWithTimeout * use Null as dummy message in waitForDiagnosticsFromSourceWithTimeout * simplify a test case * add comment about lsp bad logs
This is a prerequisite of #3046