@@ -92,13 +92,14 @@ codeLens
9292 -> CodeLensParams
9393 -> IO (Either ResponseError (List CodeLens))
9494codeLens _lsp ideState CodeLensParams{_textDocument=TextDocumentIdentifier uri} = do
95+ commandId <- makeLspCommandId "typesignature.add"
9596 fmap (Right . List) $ case uriToFilePath' uri of
9697 Just (toNormalizedFilePath' -> filePath) -> do
9798 _ <- runAction ideState $ runMaybeT $ useE TypeCheck filePath
9899 diag <- getDiagnostics ideState
99100 hDiag <- getHiddenDiagnostics ideState
100101 pure
101− [ CodeLens _range (Just (Command title "typesignature.add" (Just $ List [toJSON edit]))) Nothing
102+ [ CodeLens _range (Just (Command title commandId (Just $ List [toJSON edit]))) Nothing
102103 | (dFile, _, dDiag@Diagnostic{_range=_range}) <- diag ++ hDiag
103104 , dFile == filePath
104105 , (title, tedit) <- suggestSignature False dDiag
@@ -113,7 +114,11 @@ executeAddSignatureCommand
113114 -> ExecuteCommandParams
114115 -> IO (Either ResponseError Value, Maybe (ServerMethod, ApplyWorkspaceEditParams))
115116executeAddSignatureCommand _lsp _ideState ExecuteCommandParams{..}
116− | _command == "typesignature.add"
117+ -- _command is prefixed with a process ID, because certain clients
118+ -- have a global command registry, and all commands must be
119+ -- unique. And there can be more than one ghcide instance running
120+ -- at a time against the same client.
121+ | T.isSuffixOf "typesignature.add" _command
117122 , Just (List [edit]) <- _arguments
118123 , Success wedit <- fromJSON edit
119124 = return (Right Null, Just (WorkspaceApplyEdit, ApplyWorkspaceEditParams wedit))