-
Notifications
You must be signed in to change notification settings - Fork 200
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
eglot commands don't work unless reconnect #1051
Comments
And can we have a link to this simple git repo> The point of these questions are not to drill you, but to obtain information on how the problem can be reproduced on this side. Maybe I can to reproduce this, even though haskell-language-server on my arch machine will eat about 1Gig which I can't really spare right now. |
This is very odd. In the log you posted I see two renames, and they both seem to succeed. I don't see the error message in the transcript. Please try again, and edit the transcript to show the events spanning the two renames including the purportedly erronous rename. Also note that before asking the server to rename again, you normally have to give it some time to process the changes proceeding from the first rename. |
Thank you for your quick reply. The repo can be found here: https://codeberg.org/lukacsf/haskellcatthy I tried it again, this time with Debugger entered--Lisp error: (jsonrpc-error "Edits on ‘ends-coends.hs’ require version 0, you h..." (jsonrpc-error-code . 32603) (jsonrpc-error-message . "Edits on ‘ends-coends.hs’ require version 0, you h..."))
signal(jsonrpc-error ("Edits on ‘ends-coends.hs’ require version 0, you h..." (jsonrpc-error-code . 32603) (jsonrpc-error-message . "Edits on ‘ends-coends.hs’ require version 0, you h...")))
jsonrpc-error("Edits on `%s' require version %d, you have %d" #<buffer ends-coends.hs> 0 2)
eglot--apply-text-edits([(:newText "valamiMas :: (a -> b) -> [a] -> MyList b\nvalamiMas..." :range (:end (:character 28 :line 173) :start (:character 0 :line 172)))] 0)
eglot--apply-workspace-edit((:documentChanges [(:edits [(:newText "valamiMas :: (a -> b) -> [a] -> MyList b\nvalamiMas..." :range (:end (:character 28 :line 173) :start (:character 0 :line 172)))] :textDocument (:uri "file:///home/lukacsf/code/haskellcatthy/ends-coend..." :version 0))]) nil)
eglot-rename("valamiMas")
funcall-interactively(eglot-rename "valamiMas")
call-interactively(eglot-rename record nil)
command-execute(eglot-rename record)
execute-extended-command(nil "eglot-rename" "eglot-ren")
funcall-interactively(execute-extended-command nil "eglot-rename" "eglot-ren")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command) I tried waiting, but unless I run
I'm not entirely sure what you mean by this, but I ran everything again, and this is what came out. I only performed 2 LSP actions, both of them were renames (of two different function names) and the second one failed. I can't find anything that looks like an error in the transcript either, nonetheless I do get the error I included above, and the renaming doesn't take place. [internal] Tue Sep 20 20:04:09 2022:
(:message "Running language server: (haskell-language-server-wrapper --lsp)")
[client-request] (id:1) Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:processId 349863 :rootPath "/home/lukacsf/code/haskellcatthy/" :rootUri "file:///home/lukacsf/code/haskellcatthy" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
())
:capabilities
(:workspace
(:applyEdit t :executeCommand
(:dynamicRegistration :json-false)
:workspaceEdit
(:documentChanges t)
:didChangeWatchedFiles
(:dynamicRegistration t)
:symbol
(:dynamicRegistration :json-false)
:configuration t :workspaceFolders t)
:textDocument
(:synchronization
(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
:completion
(:dynamicRegistration :json-false :completionItem
(:snippetSupport :json-false :deprecatedSupport t :tagSupport
(:valueSet
[1]))
:contextSupport t)
:hover
(:dynamicRegistration :json-false :contentFormat
["markdown" "plaintext"])
:signatureHelp
(:dynamicRegistration :json-false :signatureInformation
(:parameterInformation
(:labelOffsetSupport t)
:activeParameterSupport t))
:references
(:dynamicRegistration :json-false)
:definition
(:dynamicRegistration :json-false :linkSupport t)
:declaration
(:dynamicRegistration :json-false :linkSupport t)
:implementation
(:dynamicRegistration :json-false :linkSupport t)
:typeDefinition
(:dynamicRegistration :json-false :linkSupport t)
:documentSymbol
(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
(:valueSet
[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
:documentHighlight
(:dynamicRegistration :json-false)
:codeAction
(:dynamicRegistration :json-false :codeActionLiteralSupport
(:codeActionKind
(:valueSet
["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
:isPreferredSupport t)
:formatting
(:dynamicRegistration :json-false)
:rangeFormatting
(:dynamicRegistration :json-false)
:rename
(:dynamicRegistration :json-false)
:publishDiagnostics
(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
(:valueSet
[1 2])))
:experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))
:workspaceFolders
[(:uri "file:///home/lukacsf/code/haskellcatthy" :name "~/code/haskellcatthy/")]))
[stderr] nil
[stderr] No 'hie.yaml' found. Try to discover the project type!
[stderr] Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.7.0.0 x86_64 ghc-9.0.2
[stderr] Current directory: /home/lukacsf/code/haskellcatthy
[stderr] Operating system: linux
[stderr] Arguments: ["--lsp"]
[stderr] Cradle directory: /home/lukacsf/code/haskellcatthy
[stderr] Cradle type: Default
[stderr]
[stderr]
[stderr] Tool versions found on the $PATH
[stderr] cabal: Not found
[stderr] stack: Not found
[stderr] ghc: 9.0.2
[stderr]
[stderr]
[stderr] Consulting the cradle to get project GHC version...
[stderr] Project GHC version: 9.0.2
[stderr] haskell-language-server exe candidates: ["haskell-language-server-9.0.2","haskell-language-server"]
[stderr] Launching haskell-language-server exe at:/run/current-system/sw/bin/haskell-language-server-9.0.2
[stderr] nil
[stderr] 2022-09-20T18:04:09.544492Z | Info | No log file specified; using stderr.
[stderr] 2022-09-20T18:04:09.544866Z | Info | haskell-language-server version: 1.7.0.0 (GHC: 9.0.2) (PATH: /nix/store/v4rc5ddym0lsmczl07yiqsa8pnid32j4-haskell-language-server-1.7.0.0/bin/haskell-language-server)
[stderr] 2022-09-20T18:04:09.545648Z | Info | Directory: /home/lukacsf/code/haskellcatthy
[stderr] 2022-09-20T18:04:09.545978Z | Info | Starting (haskell-language-server) LSP server...
[stderr] GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
[stderr] PluginIds: [ pragmas
[stderr] , floskell
[stderr] , fourmolu
[stderr] , ormolu
[stderr] , rename
[stderr] , retrie
[stderr] , callHierarchy
[stderr] , class
[stderr] , haddockComments
[stderr] , eval
[stderr] , importLens
[stderr] , qualifyImportedNames
[stderr] , refineImports
[stderr] , moduleName
[stderr] , hlint
[stderr] , splice
[stderr] , alternateNumberFormat
[stderr] , selectionRange
[stderr] , changeTypeSignature
[stderr] , ghcide-hover-and-symbols
[stderr] , ghcide-code-actions-imports-exports
[stderr] , ghcide-code-actions-type-signatures
[stderr] , ghcide-code-actions-bindings
[stderr] , ghcide-code-actions-fill-holes
[stderr] , ghcide-completions
[stderr] , ghcide-type-lenses
[stderr] , ghcide-core
[stderr] , LSPRecorderCallback ]
[stderr] 2022-09-20T18:04:09.549376Z | Info | Logging heap statistics every 60.00s
[stderr] 2022-09-20T18:04:09.552650Z | Info | Staring LSP server...
[stderr] If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
[stderr] 2022-09-20T18:04:09.554212Z | Info | Started LSP server in 0.00s
[stderr] 2022-09-20T18:04:09.626804Z | Warning | Currently, HLS supports GHC 9 only partially. See [issue #297](https://github.com/haskell/haskell-language-server/issues/297) for more detail.
[server-reply] (id:1) Tue Sep 20 20:04:09 2022:
(:id 1 :jsonrpc "2.0" :result
(:capabilities
(:callHierarchyProvider t :codeActionProvider t :codeLensProvider
(:resolveProvider :json-false :workDoneProgress :json-false)
:colorProvider :json-false :completionProvider
(:resolveProvider :json-false :triggerCharacters
["."])
:declarationProvider :json-false :definitionProvider t :documentFormattingProvider t :documentHighlightProvider t :documentRangeFormattingProvider t :documentSymbolProvider t :executeCommandProvider
(:commands
["350907:retrie:retrieCommand" "350907:class:addMinimalMethodPlaceholders" "350907:eval:evalCommand" "350907:importLens:ImportLensCommand" "350907:refineImports:RefineImportLensCommand" "350907:moduleName:updateModuleName" "350907:hlint:applyOne" "350907:hlint:applyAll" "350907:splice:expandTHSpliceInplace" "350907:ghcide-completions:extendImport" "350907:ghcide-type-lenses:typesignature.add"])
:foldingRangeProvider :json-false :hoverProvider t :implementationProvider :json-false :referencesProvider t :renameProvider t :selectionRangeProvider t :semanticTokensProvider
(:legend
(:tokenModifiers
["declaration" "definition" "readonly" "static" "deprecated" "abstract" "async" "modification" "documentation" "defaultLibrary"]
:tokenTypes
["type" "class" "enum" "interface" "struct" "typeParameter" "parameter" "variable" "property" "enumMember" "event" "function" "method" "macro" "keyword" "modifier" "comment" "string" "number" "regexp" "operator"]))
:textDocumentSync
(:change 2 :openClose t :save nil)
:typeDefinitionProvider t :workspace
(:workspaceFolders
(:changeNotifications t :supported t))
:workspaceSymbolProvider t)))
[client-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))
[client-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs" :version 0 :languageId "haskell" :text "{-# LANGUAGE GADTs #-}\n{-# LANGUAGE RankNTypes #-}\n{-# LANGUAGE TupleSections #-}\n\n-- Ends and Coends\n\nclass Profunctor f where\n dimap :: (a' -> a) -> (b -> b') -> (f a b -> f a' b')\n\ninstance Profunctor (->) where\n dimap f g h = g . h . f\n\n-- We want to be able to compose profunctors\n-- Composition in this case means the following. Given two profunctors P and\n-- Q, the set P<a,b> is the proposition that a and b are related via P. Similarly\n-- for Q. Consequently, the set (PQ)(<a,b>) means that a and b are related via the\n-- two profunctors. So basically we are dealing with composition of relations.\n-- Now given two relations, P and Q, we have a(PQ)b iff there exists an x such\n-- that aPxQb.\n\n-- This is an existential type, meaning that in fact we are looking for an x st.\n-- q a x and p x b make sense, i.e. the types are nonempty\ndata Procompose p q a b where\n -- To construct the composite, we need witness that the aforementioned x exists.\n Procompose :: q a x -> p x b -> Procompose p q a b\n\n-- This is indeed results in a Profunctor\ninstance (Profunctor q, Profunctor p) => Profunctor (Procompose p q) where\n dimap l r (Procompose qax pxb) = Procompose (dimap l id qax) (dimap id r pxb)\n\n-- This is similar to the mapOut function of the sum type: there we needed a\n-- function for each member of the sum, then a finite amount. Here, the situation\n-- is the same, but for infinitely many members.\nmapOut :: (forall x. q a x -> p x b -> c) -> (Procompose p q a b -> c)\nmapOut f (Procompose qax pxb) = f qax pxb\n\ndata Coend p where\n Coend :: p x x -> Coend p\n\n-- Ex. 12.2.1.\nnewtype ProPair q p a b x y = ProPair (q a y, p x b)\n\ninstance (Profunctor p, Profunctor q) => Profunctor (ProPair q p a b) where\n dimap l r (ProPair (qay, pxb)) = ProPair (dimap id r qay, dimap l id pxb)\n\n-- Ex. 17.2.2.\nnewtype CoEndCompose p q a b = CoEndCompose (Coend (ProPair q p a b))\n\ninstance (Profunctor p, Profunctor q) => Profunctor (CoEndCompose p q) where\n -- Coend (ProPair q p a b) = ProPair q p a b x x = ProPair (q a x, p x b)\n dimap l r (CoEndCompose (Coend (ProPair (qax, pxb)))) =\n CoEndCompose $ Coend $ ProPair (dimap l id qax, dimap id r pxb)\n\n-- Ends\n\ntype End p = forall x. p x x\n\nnewtype ProF f g a b = ProF (f a -> g b)\n\ninstance (Functor f, Functor g) => Profunctor (ProF f g) where\n dimap l r (ProF h) = ProF $ fmap r . h . fmap l\n\n-- This is in fact category theoretically correct:\n-- myHead :: End (ProF [] Maybe)\n-- myHead [] = Nothing\n-- myHead (x : xs) = Just x\n\nnewtype Yo f a x y = Yo ((a -> x) -> f y)\n\nyoneda :: Functor f => End (Yo f a) -> f a\nyoneda (Yo alpha) = alpha id\n\nyonedaInv :: Functor f => f a -> End (Yo f a)\nyonedaInv fa = Yo (\\h -> fmap h fa)\n\ndata CoY f a x y = CoY (x -> a) (f y)\n\ncoyoneda :: Functor f => Coend (CoY f a) -> f a\ncoyoneda (Coend (CoY g fa)) = fmap g fa\n\ncoyonedaInv :: Functor f => f a -> Coend (CoY f a)\ncoyonedaInv fa = Coend (CoY id fa)\n\n-- Ex 17.7.1.\ndata Day f g x where\n Day :: ((a, b) -> x) -> f a -> g b -> Day f g x\n\ninstance (Functor f, Functor g) => Functor (Day f g) where\n fmap f (Day h fa gb) = Day (f . h) fa gb\n\n-- Free Applicatives\n\ndata FreeA f x where\n DoneA :: x -> FreeA f x\n MoreA :: ((a, b) -> x) -> f a -> FreeA f b -> FreeA f x\n\nclass Monoidal f where\n unit :: f ()\n (>*<) :: f a -> f b -> f (a, b)\n\ninstance Functor f => Monoidal (FreeA f) where\n unit = DoneA ()\n (DoneA x) >*< fry = fmap (x,) fry\n (MoreA abx fa frb) >*< fry = MoreA (reassoc abx) fa (frb >*< fry)\n\nreassoc :: ((a, b) -> x) -> (a, (b, y)) -> (x, y)\nreassoc abx (a, (b, y)) = (abx (a, b), y)\n\ninstance Functor f => Applicative (FreeA f) where\n pure = DoneA\n ff <*> fx = fmap app (ff >*< fx)\n\napp :: (a -> b, a) -> b\napp (f, x) = f x\n\ninstance Functor f => Functor (FreeA f) where\n fmap f (DoneA x) = DoneA $ f x\n fmap f (MoreA abx fa frb) = MoreA (f . abx) fa frb\n\n-- Monads in the bicategory of profunctors\nclass Profunctor p => PreArrow p where\n (>>>) :: p a x -> p x b -> p a b\n arr :: (a -> b) -> p a b\n\n-- Lenses\n\ndata Lens' s a where\n Lens' :: (s -> (c, a), (c, a) -> s) -> Lens' s a\n\ntoGet' :: Lens' s a -> (s -> a)\ntoGet' (Lens' (l, r)) = snd . l\n\ntoSet' :: Lens' s a -> (s -> a -> s)\ntoSet' (Lens' (l, r)) s a = r (fst $ l s, a)\n\n-- Type-changing lens\ndata Lens s t a b where\n Lens :: (s -> (c, a)) -> ((c, b) -> t) -> Lens s t a b\n\ntoGet :: Lens s t a b -> (s -> a)\ntoGet (Lens l r) = snd . l\n\ntoSet :: Lens s t a b -> (s -> b -> t)\ntoSet (Lens l r) s b = r (fst $ l s, b)\n\nprodLens :: Lens (c, a) (c, b) a b\nprodLens = Lens id id\n\ncompLens :: Lens a b a' b' -> Lens s t a b -> Lens s t a' b'\ncompLens (Lens l1 r1) (Lens l2 r2) = Lens l3 r3\n where\n l3 = assoc' . bimap id l1 . l2\n r3 = r2 . bimap id r1 . assoc\n\n-- The associators of the product functor\nassoc :: ((c, c'), b') -> (c, (c', b'))\nassoc ((c, c'), b') = (c, (c', b'))\n\nassoc' :: (c, (c', a')) -> ((c, c'), a')\nassoc' (c, (c', a')) = ((c, c'), a')\n\nclass Bifunctor f where\n bimap :: (a -> a') -> (b -> b') -> f a b -> f a' b'\n\ninstance Bifunctor (,) where\n bimap f g (a, b) = (f a, g b)\n\ndata MyList a = Empty | Cons a (MyList a)\n\nfromList :: forall a. [a] -> MyList a\nfromList = foldr Cons Empty\n\nvalami :: (a -> b) -> [a] -> MyList b\nvalami f = fromList . fmap f\n")))
[client-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
(:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
())))
[stderr] 2022-09-20T18:04:09.627239Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-2564608804569318620) "file:///home/lukacsf/code/haskellcatthy"], clientSettings = hashed (Just (Object (fromList [])))}
[stderr] 2022-09-20T18:04:09.637583Z | Info | Cradle path: ends-coends.hs
[stderr] 2022-09-20T18:04:09.637766Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for ends-coends.hs.
[stderr] Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
[stderr] You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
[server-request] (id:0) Tue Sep 20 20:04:09 2022:
(:id 0 :jsonrpc "2.0" :method "client/registerCapability" :params
(:registrations
[(:id "globalFileWatches" :method "workspace/didChangeWatchedFiles" :registerOptions
(:watchers
[(:globPattern "**/*.hs" :kind 7)
(:globPattern "**/*.hs-boot" :kind 7)
(:globPattern "**/*.lhs" :kind 7)
(:globPattern "**/*.lhs-boot" :kind 7)]))]))
[client-reply] (id:0) Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :id 0 :result nil)
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "haskell-language-server version: 1.7.0.0 (GHC: 9.0.2) (PATH: /nix/store/v4rc5ddym0lsmczl07yiqsa8pnid32j4-haskell-language-server-1.7.0.0/bin/haskell-language-server)" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Directory: /home/lukacsf/code/haskellcatthy" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Starting (haskell-language-server) LSP server...\n GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}\n PluginIds: [ pragmas\n , floskell\n , fourmolu\n , ormolu\n , rename\n , retrie\n , callHierarchy\n , class\n , haddockComments\n , eval\n , importLens\n , qualifyImportedNames\n , refineImports\n , moduleName\n , hlint\n , splice\n , alternateNumberFormat\n , selectionRange\n , changeTypeSignature\n , ghcide-hover-and-symbols\n , ghcide-code-actions-imports-exports\n , ghcide-code-actions-type-signatures\n , ghcide-code-actions-bindings\n , ghcide-code-actions-fill-holes\n , ghcide-completions\n , ghcide-type-lenses\n , ghcide-core\n , LSPRecorderCallback ]" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Logging heap statistics every 60.00s" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Staring LSP server...\nIf you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Started LSP server in 0.00s" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Currently, HLS supports GHC 9 only partially. See [issue #297](https://github.com/haskell/haskell-language-server/issues/297) for more detail." :type 2))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-2564608804569318620) \"file:///home/lukacsf/code/haskellcatthy\"], clientSettings = hashed (Just (Object (fromList [])))}" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Cradle path: ends-coends.hs" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for ends-coends.hs.\nProceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\nYou should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error." :type 2))
[stderr] 2022-09-20T18:04:09.830934Z | Info | Interface files cache directory: /home/lukacsf/.cache/ghcide/main-da39a3ee5e6b4b0d3255bfef95601890afd80709
[stderr] 2022-09-20T18:04:09.831170Z | Info | Making new HscEnv. In-place unit ids: [main]
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Interface files cache directory: /home/lukacsf/.cache/ghcide/main-da39a3ee5e6b4b0d3255bfef95601890afd80709" :type 3))
[server-notification] Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:message "Making new HscEnv. In-place unit ids: [main]" :type 3))
[client-request] (id:2) Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :id 2 :method "textDocument/hover" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 0 :character 0)))
[client-request] (id:3) Tue Sep 20 20:04:09 2022:
(:jsonrpc "2.0" :id 3 :method "textDocument/documentHighlight" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 0 :character 0)))
[server-reply] (id:3) Tue Sep 20 20:04:09 2022:
(:id 3 :jsonrpc "2.0" :result
[])
[server-reply] (id:2) Tue Sep 20 20:04:09 2022:
(:id 2 :jsonrpc "2.0" :result nil)
[server-request] (id:1) Tue Sep 20 20:04:10 2022:
(:id 1 :jsonrpc "2.0" :method "window/workDoneProgress/create" :params
(:token "14"))
[client-reply] (id:1) Tue Sep 20 20:04:10 2022:
(:jsonrpc "2.0" :id 1 :result nil)
[server-notification] Tue Sep 20 20:04:10 2022:
(:jsonrpc "2.0" :method "$/progress" :params
(:token "14" :value
(:kind "begin" :title "Indexing")))
[server-notification] Tue Sep 20 20:04:10 2022:
(:jsonrpc "2.0" :method "$/progress" :params
(:token "14" :value
(:kind "report" :message " (0/1)...")))
[server-notification] Tue Sep 20 20:04:10 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
(:diagnostics
[(:code "refact:Avoid lambda using `infix`" :message "Avoid lambda using `infix`\nFound:\n (\\ h -> fmap h fa)\nWhy not:\n (`fmap` fa)\n" :range
(:end
(:character 35 :line 73)
:start
(:character 18 :line 73))
:severity 3 :source "hlint")
(:code "refact:Use second" :message "Use second\nFound:\n bimap id l1\nWhy not:\n second l1\n" :range
(:end
(:character 29 :line 151)
:start
(:character 18 :line 151))
:severity 3 :source "hlint")
(:code "refact:Use second" :message "Use second\nFound:\n bimap id r1\nWhy not:\n second r1\n" :range
(:end
(:character 25 :line 152)
:start
(:character 14 :line 152))
:severity 3 :source "hlint")]
:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs" :version 0))
[server-notification] Tue Sep 20 20:04:10 2022:
(:jsonrpc "2.0" :method "$/progress" :params
(:token "14" :value
(:kind "end" :message "Finished indexing 1 files")))
[client-request] (id:4) Tue Sep 20 20:04:10 2022:
(:jsonrpc "2.0" :id 4 :method "textDocument/hover" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 174 :character 0)))
[client-request] (id:5) Tue Sep 20 20:04:10 2022:
(:jsonrpc "2.0" :id 5 :method "textDocument/documentHighlight" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 174 :character 0)))
[server-reply] (id:4) Tue Sep 20 20:04:10 2022:
(:id 4 :jsonrpc "2.0" :result nil)
[server-reply] (id:5) Tue Sep 20 20:04:10 2022:
(:id 5 :jsonrpc "2.0" :result
[])
[client-request] (id:6) Tue Sep 20 20:04:12 2022:
(:jsonrpc "2.0" :id 6 :method "textDocument/hover" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[client-request] (id:7) Tue Sep 20 20:04:12 2022:
(:jsonrpc "2.0" :id 7 :method "textDocument/documentHighlight" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[server-reply] (id:6) Tue Sep 20 20:04:12 2022:
(:id 6 :jsonrpc "2.0" :result
(:contents
(:kind "markdown" :value "\n```haskell\nfromList :: forall a. [a] -> MyList a\n```\n\n*Defined at /home/lukacsf/code/haskellcatthy/ends-coends.hs:171:1*\n")
:range
(:end
(:character 8 :line 169)
:start
(:character 0 :line 169))))
[server-reply] (id:7) Tue Sep 20 20:04:12 2022:
(:id 7 :jsonrpc "2.0" :result
[(:kind 2 :range
(:end
(:character 8 :line 169)
:start
(:character 0 :line 169)))
(:kind 3 :range
(:end
(:character 8 :line 170)
:start
(:character 0 :line 170)))
(:kind 2 :range
(:end
(:character 19 :line 173)
:start
(:character 11 :line 173)))])
[client-request] (id:8) Tue Sep 20 20:04:19 2022:
(:jsonrpc "2.0" :id 8 :method "textDocument/rename" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)
:newName "toMyList"))
[server-reply] (id:8) Tue Sep 20 20:04:19 2022:
(:id 8 :jsonrpc "2.0" :result
(:documentChanges
[(:edits
[(:newText "toMyList :: forall a. [a] -> MyList a\ntoMyList = foldr Cons Empty" :range
(:end
(:character 27 :line 170)
:start
(:character 0 :line 169)))
(:newText "valami f = toMyList . fmap f" :range
(:end
(:character 28 :line 173)
:start
(:character 0 :line 173)))]
:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs" :version 0))]))
[internal] (id:9) Tue Sep 20 20:04:19 2022:
(:deferring :textDocument/hover :id 9 :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[internal] (id:10) Tue Sep 20 20:04:19 2022:
(:deferring :textDocument/documentHighlight :id 10 :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[client-notification] Tue Sep 20 20:04:20 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs" :version 2)
:contentChanges
[(:range
(:start
(:line 173 :character 0)
:end
(:line 173 :character 28))
:rangeLength 28 :text "valami f = toMyList . fmap f")
(:range
(:start
(:line 169 :character 0)
:end
(:line 170 :character 27))
:rangeLength 65 :text "toMyList :: forall a. [a] -> MyList a\ntoMyList = foldr Cons Empty")]))
[internal] Tue Sep 20 20:04:20 2022:
(:maybe-run-deferred
(9 10))
[client-request] (id:9) Tue Sep 20 20:04:20 2022:
(:jsonrpc "2.0" :id 9 :method "textDocument/hover" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[client-request] (id:10) Tue Sep 20 20:04:20 2022:
(:jsonrpc "2.0" :id 10 :method "textDocument/documentHighlight" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[server-reply] (id:9) Tue Sep 20 20:04:20 2022:
(:id 9 :jsonrpc "2.0" :result nil)
[server-reply] (id:10) Tue Sep 20 20:04:20 2022:
(:id 10 :jsonrpc "2.0" :result
[])
[client-request] (id:11) Tue Sep 20 20:04:21 2022:
(:jsonrpc "2.0" :id 11 :method "textDocument/hover" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 172 :character 0)))
[client-request] (id:12) Tue Sep 20 20:04:21 2022:
(:jsonrpc "2.0" :id 12 :method "textDocument/documentHighlight" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 172 :character 0)))
[server-reply] (id:12) Tue Sep 20 20:04:21 2022:
(:id 12 :jsonrpc "2.0" :result
[(:kind 2 :range
(:end
(:character 6 :line 172)
:start
(:character 0 :line 172)))
(:kind 3 :range
(:end
(:character 6 :line 173)
:start
(:character 0 :line 173)))])
[server-reply] (id:11) Tue Sep 20 20:04:21 2022:
(:id 11 :jsonrpc "2.0" :result
(:contents
(:kind "markdown" :value "\n```haskell\nvalami :: forall a b. (a -> b) -> [a] -> MyList b\n```\n\n*Defined at /home/lukacsf/code/haskellcatthy/ends-coends.hs:174:1*\n")
:range
(:end
(:character 6 :line 172)
:start
(:character 0 :line 172))))
[internal] (id:9) Tue Sep 20 20:04:29 2022:
(:timed-out :textDocument/hover :id 9 :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[internal] (id:10) Tue Sep 20 20:04:29 2022:
(:timed-out :textDocument/documentHighlight :id 10 :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 169 :character 0)))
[client-request] (id:13) Tue Sep 20 20:04:39 2022:
(:jsonrpc "2.0" :id 13 :method "textDocument/rename" :params
(:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs")
:position
(:line 172 :character 0)
:newName "valamiMas"))
[server-reply] (id:13) Tue Sep 20 20:04:39 2022:
(:id 13 :jsonrpc "2.0" :result
(:documentChanges
[(:edits
[(:newText "valamiMas :: (a -> b) -> [a] -> MyList b\nvalamiMas f = toMyList . fmap f" :range
(:end
(:character 28 :line 173)
:start
(:character 0 :line 172)))]
:textDocument
(:uri "file:///home/lukacsf/code/haskellcatthy/ends-coends.hs" :version 0))])) |
Sorry, my bad. This error is being sprung by Eglot, because the server says that the edits apply to
Looking closer at this, it makes sense that "you have [version] 2" because you did exactly two edits to the file since it was open (at version 0). So I don't understand why the server says |
So I should just complain to the hls devs? Is there an easy way to make eglot less strict about this stuff? |
Not necessarily complain, but ask them to clarify or at least make them aware of this situation. Take the below example taken from
Probably sending the
|
The "easy way", for now, is to patch diff --git a/eglot.el b/eglot.el
index 718a42dbd7..4cd7e97808 100644
--- a/eglot.el
+++ b/eglot.el
@@ -3002,9 +3002,9 @@ Returns a list as described in docstring of `imenu--index-alist'."
(defun eglot--apply-text-edits (edits &optional version)
"Apply EDITS for current buffer if at VERSION, or if it's nil."
- (unless (or (not version) (equal version eglot--versioned-identifier))
- (jsonrpc-error "Edits on `%s' require version %d, you have %d"
- (current-buffer) version eglot--versioned-identifier))
+ ;; (unless (or (not version) (equal version eglot--versioned-identifier))
+ ;; (jsonrpc-error "Edits on `%s' require version %d, you have %d"
+ ;; (current-buffer) version eglot--versioned-identifier))
(atomic-change-group
(let* ((change-group (prepare-change-group))
(howmany (length edits)) |
@eth0rnhill did you mention this to the HLS devs? |
Ran into this in Omnisharp Roslyn (OmniSharp/omnisharp-roslyn#2375), where the server resets the version to 0 on |
@jameschensmith just to reply to your comment: I did not work on omnisharp-roslyn for a long time by now and I cannot provide you with a PR, omnisharp-roslyn devs should do the fix,–sorry. And an extra note–I am getting similar problems (version out of sync when applying edits from code action) with eglot when using csharp-ls as well, so I think LSP implementation @ csharp-language-server is not fully compliant either. |
Same problem here with jedi-language-server. It is so pervasive that it probably makes sense to add a flag to remove this check, right? |
The very same? Better post the event log, or at least the relevant parts, to make sure. |
I get the same error message, which is solved similarly by reconnecting.
I don't manage to do the same bug report as above, as the |
That's very odd, unless you have set eglot-events-buffer-size to a very low value or 0 (in which case it's perfectly understandable). If that's the case, please reset eglot-events-buffer-size to its normal value, and report its contents here. It is of course possible to set a flag to avoid this server-bug, or simply to interpret "0" as skipping the check. But I'd also like to know if the LS server developers of the problematic are aware of this issue. Have you reported this to |
No, the eglot-events-buffer-size has the default value which is quite large. What should I report specifically to jedi-language-server if it is not possible to record the problem from eglot? |
Well, it should be, it really should. So if it's like you say, you're looking at an Eglot bug, in which case I would ask you to try to give me a simple reproduction recipe, like described https://joaotavora.github.io/eglot/#Troubleshooting-Eglot Maybe just fill something out like this?
Be sure to try out your own recipe after writing it! And thanks in advance. |
My problem is that whenever I try to use two eglot commands (rename, code action, etc.) consecutively, the first one succeeds, but the second one does not, unless I run
eglot-reconnect
in between.LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)
Backtrace (mandatory, unless no error message seen or heard):
There is no error message
Recipe
How is Emacs started?
I started it from xterm with the command
emacs -Q
Where does the language server executable live in your machine and
how should it be installed?
I installed it using nix. It is located at /run/current-system/sw/bin/haskell-language-server
What project files are needed to demonstrate the problem? Please
don't say "just open any Zglorb source file".
It is a simple git repo with only Haskell (.hs) files in it. There isn't really a project structure, just a bunch of files.
How is Emacs operated/configured before you invoke Eglot?
When I tried to reproduce the issue I created and evaluated the following elisp file:
How is Emacs operated after you invoke Eglot
I simply open a haskell file from the repo.
What actions must be taken for the problem to manifest itself?
I try to rename a function twice in a row.
What is the expected behaviour?
The
eglot-rename
command should be performed both times.What is the observed behaviour?
The second one fails with this error message:
If I run
eglot-reconnect
, then it works again, once.The text was updated successfully, but these errors were encountered: