Skip to content

eglot is laggy when use with polymode (i.e multiple major mode in same buffer), specifically working with rmarkdown files #1085

Open
@milanglacier

Description

  • Server used: r-language-server
  • Emacs version: 28.2
  • Operating system: macos
  • Eglot version: 20221011.1102
  • Eglot installation method: package.el
  • Using Doom: no

LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)

[internal] Tue Oct 18 22:21:46 2022:
(:message "Running language server: (R --slave -e languageserver::run())")
[client-request] (id:1) Tue Oct 18 22:21:46 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 26359 :rootPath "/Users/northyear/Downloads/test/" :rootUri "file:///Users/northyear/Downloads/test" :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:///Users/northyear/Downloads/test" :name "~/Downloads/test/")]))
[server-reply] (id:1) Tue Oct 18 22:21:47 2022:
(:jsonrpc "2.0" :id 1 :result
	  (:capabilities
	   (:textDocumentSync
	    (:openClose t :change 1 :willSave :json-false :willSaveWaitUntil :json-false :save
			(:includeText t))
	    :hoverProvider t :completionProvider
	    (:resolveProvider t :triggerCharacters
			      ["." ":"])
	    :signatureHelpProvider
	    (:triggerCharacters
	     ["(" ","])
	    :definitionProvider t :referencesProvider t :documentHighlightProvider t :documentSymbolProvider t :workspaceSymbolProvider t :codeActionProvider t :documentFormattingProvider t :documentRangeFormattingProvider t :documentOnTypeFormattingProvider
	    (:firstTriggerCharacter "\n" :moreTriggerCharacter
				    [")" "]" "}"])
	    :renameProvider t :documentLinkProvider
	    (:resolveProvider t)
	    :colorProvider t :foldingRangeProvider t :selectionRangeProvider t :callHierarchyProvider t)))
[client-notification] Tue Oct 18 22:21:47 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 Oct 18 22:21:47 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 0 :languageId "ess-r" :text "---\ntitle: 'test rmd'\nauthor: 'author'\ndate: '12/14/2021'\noutput: \n    bookdown::pdf_document2:\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, warning = F, message = F)\noptions(scipen = 10)\n```\n\n\n```{r}\ntest = 10\nfor (i in 1:100) {\n    print(i)\n}\n```\n\n```{r}\nanother_test = function(i) {\n    if (i > 0) {\n        print(i)\n    } else {\n        for (i in 1:i) {\n            print(i + 5)\n        }\n    }\n}\n```\n")))
[client-notification] Tue Oct 18 22:21:47 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
				   ())))
[client-request] (id:2) Tue Oct 18 22:21:47 2022:
(:jsonrpc "2.0" :id 2 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 11 :character 0)))
[client-request] (id:3) Tue Oct 18 22:21:47 2022:
(:jsonrpc "2.0" :id 3 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 11 :character 0)))
[client-request] (id:4) Tue Oct 18 22:21:47 2022:
(:jsonrpc "2.0" :id 4 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 11 :character 0)))
[server-reply] (id:2) Tue Oct 18 22:21:47 2022:
(:jsonrpc "2.0" :id 2 :result
	  (:signatures
	   []
	   :activeSignature -1))
		     (:start
		      (:line 11 :character 0)
		      :end
		      (:line 11 :character 7))))
[server-notification] Tue Oct 18 22:21:48 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 0 :diagnostics
		[(:range
		  (:start
		   (:line 10 :character 45)
		   :end
		   (:line 10 :character 47))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 10 :character 58)
		   :end
		   (:line 10 :character 60))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 27 :character 13)
		   :end
		   (:line 27 :character 14))
		  :severity 2 :source "for_loop_index_linter" :message "Don't re-use any sequence symbols as the index symbol in a for loop.")]))
[server-reply] (id:4) Tue Oct 18 22:21:48 2022:
(:jsonrpc "2.0" :id 4 :result nil)
[client-request] (id:5) Tue Oct 18 22:21:51 2022:
(:jsonrpc "2.0" :id 5 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 16 :character 0)))
[client-request] (id:6) Tue Oct 18 22:21:51 2022:
(:jsonrpc "2.0" :id 6 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 16 :character 0)))
[client-request] (id:7) Tue Oct 18 22:21:51 2022:
(:jsonrpc "2.0" :id 7 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 16 :character 0)))
[server-reply] (id:5) Tue Oct 18 22:21:51 2022:
(:jsonrpc "2.0" :id 5 :result
	  (:signatures
	   []
	   :activeSignature -1))
[server-reply] (id:6) Tue Oct 18 22:21:51 2022:
(:jsonrpc "2.0" :id 6 :result nil)
[server-reply] (id:7) Tue Oct 18 22:21:51 2022:
(:jsonrpc "2.0" :id 7 :result nil)
[client-request] (id:8) Tue Oct 18 22:21:53 2022:
(:jsonrpc "2.0" :id 8 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 11 :character 20)))
[client-request] (id:9) Tue Oct 18 22:21:53 2022:
(:jsonrpc "2.0" :id 9 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 11 :character 20)))
[client-request] (id:10) Tue Oct 18 22:21:53 2022:
(:jsonrpc "2.0" :id 10 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 11 :character 20)))
[server-reply] (id:8) Tue Oct 18 22:21:53 2022:
(:jsonrpc "2.0" :id 8 :result
	  (:signatures
	   []
	   :activeSignature -1))
[server-reply] (id:9) Tue Oct 18 22:21:53 2022:
(:jsonrpc "2.0" :id 9 :result nil)
[server-reply] (id:10) Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :id 10 :result nil)
[internal] (id:11) Tue Oct 18 22:21:54 2022:
(:deferring :textDocument/signatureHelp :id 11 :params
	    (:textDocument
	     (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	     :position
	     (:line 12 :character 0)))
[internal] (id:12) Tue Oct 18 22:21:54 2022:
(:deferring :textDocument/hover :id 12 :params
	    (:textDocument
	     (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	     :position
	     (:line 12 :character 0)))
[internal] (id:13) Tue Oct 18 22:21:54 2022:
(:deferring :textDocument/documentHighlight :id 13 :params
	    (:textDocument
	     (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	     :position
	     (:line 12 :character 0)))
[client-notification] Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 1)
	   :contentChanges
	   [(:text "---\ntitle: 'test rmd'\nauthor: 'author'\ndate: '12/14/2021'\noutput: \n    bookdown::pdf_document2:\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, warning = F, message = F)\noptions(scipen = 10)\n\n```\n\n\n```{r}\ntest = 10\nfor (i in 1:100) {\n    print(i)\n}\n```\n\n```{r}\nanother_test = function(i) {\n    if (i > 0) {\n        print(i)\n    } else {\n        for (i in 1:i) {\n            print(i + 5)\n        }\n    }\n}\n```\n")]))
[internal] Tue Oct 18 22:21:54 2022:
(:maybe-run-deferred
 (11 12 13))
[client-request] (id:11) Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :id 11 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 0)))
[client-request] (id:12) Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :id 12 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 0)))
[client-request] (id:13) Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :id 13 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 0)))
[server-reply] (id:11) Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :id 11 :result
	  (:signatures
	   []
	   :activeSignature -1))
[server-reply] (id:12) Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :id 12 :result nil)
[server-reply] (id:13) Tue Oct 18 22:21:54 2022:
(:jsonrpc "2.0" :id 13 :result nil)
[server-notification] Tue Oct 18 22:21:55 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 1 :diagnostics
		[(:range
		  (:start
		   (:line 10 :character 45)
		   :end
		   (:line 10 :character 47))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 10 :character 58)
		   :end
		   (:line 10 :character 60))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 28 :character 13)
		   :end
		   (:line 28 :character 14))
		  :severity 2 :source "for_loop_index_linter" :message "Don't re-use any sequence symbols as the index symbol in a for loop.")]))
[client-notification] Tue Oct 18 22:21:56 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 3)
	   :contentChanges
	   [(:text "---\ntitle: 'test rmd'\nauthor: 'author'\ndate: '12/14/2021'\noutput: \n    bookdown::pdf_document2:\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, warning = F, message = F)\noptions(scipen = 10)\nhe\n```\n\n\n```{r}\ntest = 10\nfor (i in 1:100) {\n    print(i)\n}\n```\n\n```{r}\nanother_test = function(i) {\n    if (i > 0) {\n        print(i)\n    } else {\n        for (i in 1:i) {\n            print(i + 5)\n        }\n    }\n}\n```\n")]))
[client-request] (id:14) Tue Oct 18 22:21:56 2022:
(:jsonrpc "2.0" :id 14 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 2)))
[client-request] (id:15) Tue Oct 18 22:21:56 2022:
(:jsonrpc "2.0" :id 15 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 2)))
[client-request] (id:16) Tue Oct 18 22:21:56 2022:
(:jsonrpc "2.0" :id 16 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 2)))
[server-reply] (id:14) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 14 :result
	  (:signatures
	   []
	   :activeSignature -1))
[server-reply] (id:15) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 15 :result nil)
[server-reply] (id:16) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 16 :result nil)
[client-notification] Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 5)
	   :contentChanges
	   [(:text "---\ntitle: 'test rmd'\nauthor: 'author'\ndate: '12/14/2021'\noutput: \n    bookdown::pdf_document2:\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, warning = F, message = F)\noptions(scipen = 10)\n\n```\n\n\n```{r}\ntest = 10\nfor (i in 1:100) {\n    print(i)\n}\n```\n\n```{r}\nanother_test = function(i) {\n    if (i > 0) {\n        print(i)\n    } else {\n        for (i in 1:i) {\n            print(i + 5)\n        }\n    }\n}\n```\n")]))
[client-request] (id:17) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 17 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 0)))
[client-request] (id:18) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 18 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 0)))
[client-request] (id:19) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 19 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 0)))
[server-reply] (id:17) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 17 :result
	  (:signatures
	   []
	   :activeSignature -1))
[server-reply] (id:18) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 18 :result nil)
[server-reply] (id:19) Tue Oct 18 22:21:57 2022:
(:jsonrpc "2.0" :id 19 :result nil)
[server-notification] Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 3 :diagnostics
		[(:range
		  (:start
		   (:line 10 :character 45)
		   :end
		   (:line 10 :character 47))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 10 :character 58)
		   :end
		   (:line 10 :character 60))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 28 :character 13)
		   :end
		   (:line 28 :character 14))
		  :severity 2 :source "for_loop_index_linter" :message "Don't re-use any sequence symbols as the index symbol in a for loop.")]))
[server-notification] Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 5 :diagnostics
		[(:range
		  (:start
		   (:line 10 :character 45)
		   :end
		   (:line 10 :character 47))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 10 :character 58)
		   :end
		   (:line 10 :character 60))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 28 :character 13)
		   :end
		   (:line 28 :character 14))
		  :severity 2 :source "for_loop_index_linter" :message "Don't re-use any sequence symbols as the index symbol in a for loop.")]))
[client-notification] Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 8)
	   :contentChanges
	   [(:text "---\ntitle: 'test rmd'\nauthor: 'author'\ndate: '12/14/2021'\noutput: \n    bookdown::pdf_document2:\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, warning = F, message = F)\noptions(scipen = 10)\nlib\n```\n\n\n```{r}\ntest = 10\nfor (i in 1:100) {\n    print(i)\n}\n```\n\n```{r}\nanother_test = function(i) {\n    if (i > 0) {\n        print(i)\n    } else {\n        for (i in 1:i) {\n            print(i + 5)\n        }\n    }\n}\n```\n")]))
[client-request] (id:20) Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :id 20 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 3)))
[client-request] (id:21) Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :id 21 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 3)))
[client-request] (id:22) Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :id 22 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 3)))
[server-reply] (id:20) Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :id 20 :result
	  (:signatures
	   []
	   :activeSignature -1))
[server-reply] (id:21) Tue Oct 18 22:21:58 2022:
(:jsonrpc "2.0" :id 21 :result nil)
[server-reply] (id:22) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 22 :result nil)
[internal] (id:23) Tue Oct 18 22:21:59 2022:
(:deferring :textDocument/signatureHelp :id 23 :params
	    (:textDocument
	     (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	     :position
	     (:line 12 :character 4)))
[internal] (id:24) Tue Oct 18 22:21:59 2022:
(:deferring :textDocument/hover :id 24 :params
	    (:textDocument
	     (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	     :position
	     (:line 12 :character 4)))
[internal] (id:25) Tue Oct 18 22:21:59 2022:
(:deferring :textDocument/documentHighlight :id 25 :params
	    (:textDocument
	     (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	     :position
	     (:line 12 :character 4)))
[client-notification] Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 9)
	   :contentChanges
	   [(:text "---\ntitle: 'test rmd'\nauthor: 'author'\ndate: '12/14/2021'\noutput: \n    bookdown::pdf_document2:\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, warning = F, message = F)\noptions(scipen = 10)\nlibr\n```\n\n\n```{r}\ntest = 10\nfor (i in 1:100) {\n    print(i)\n}\n```\n\n```{r}\nanother_test = function(i) {\n    if (i > 0) {\n        print(i)\n    } else {\n        for (i in 1:i) {\n            print(i + 5)\n        }\n    }\n}\n```\n")]))
[internal] Tue Oct 18 22:21:59 2022:
(:maybe-run-deferred
 (25 24 23))
[client-request] (id:25) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 25 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 4)))
[client-request] (id:24) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 24 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 4)))
[client-request] (id:23) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 23 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 4)))
[server-reply] (id:25) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 25 :result nil)
[server-reply] (id:24) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 24 :result nil)
[server-reply] (id:23) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 23 :result
	  (:signatures
	   []
	   :activeSignature -1))
[client-request] (id:26) Tue Oct 18 22:21:59 2022:
(:jsonrpc "2.0" :id 26 :method "textDocument/completion" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 4)
	   :context
	   (:triggerKind 1)))
[server-reply] (id:26) Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :id 26 :result
	  (:isIncomplete :json-false :items
			 [(:label "format.libraryIQR" :kind 3 :detail "{base}" :sortText "4-format.libraryIQR" :data
				  (:type "function" :package "base"))
			  (:label "La_library" :kind 3 :detail "{base}" :sortText "4-La_library" :data
				  (:type "function" :package "base"))
			  (:label "library" :kind 3 :detail "{base}" :sortText "4-library" :data
				  (:type "function" :package "base"))
			  (:label "library.dynam" :kind 3 :detail "{base}" :sortText "4-library.dynam" :data
				  (:type "function" :package "base"))
			  (:label "library.dynam.unload" :kind 3 :detail "{base}" :sortText "4-library.dynam.unload" :data
				  (:type "function" :package "base"))
			  (:label "print.libraryIQR" :kind 3 :detail "{base}" :sortText "4-print.libraryIQR" :data
				  (:type "function" :package "base"))
			  (:label ".Library" :kind 5 :detail "{base}" :sortText "4-.Library" :data
				  (:type "nonfunction" :package "base"))
			  (:label ".Library.site" :kind 5 :detail "{base}" :sortText "4-.Library.site" :data
				  (:type "nonfunction" :package "base"))]))
[client-request] (id:27) Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :id 27 :method "completionItem/resolve" :params
	  (:label
	   #("library" 0 1
	     (eglot--lsp-item #1))
	   :kind 3 :detail "{base}" :sortText "4-library" :data
	   (:type "function" :package "base")))
[server-notification] Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 9 :diagnostics
		[(:range
		  (:start
		   (:line 10 :character 45)
		   :end
		   (:line 10 :character 47))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 10 :character 58)
		   :end
		   (:line 10 :character 60))
		  :severity 3 :source "T_and_F_symbol_linter" :message "Use FALSE instead of the symbol F.")
		 (:range
		  (:start
		   (:line 28 :character 13)
		   :end
		   (:line 28 :character 14))
		  :severity 2 :source "for_loop_index_linter" :message "Don't re-use any sequence symbols as the index symbol in a for loop.")]))
[server-reply] (id:27) Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :id 27 :result
	  (:label "library" :kind 3 :detail "{base}" :sortText "4-library" :documentation
		  (:kind "markdown" :value "  `library` and `require` load and attach add-on packages.")))
[client-notification] Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd" :version 10)
	   :contentChanges
	   [(:text "---\ntitle: 'test rmd'\nauthor: 'author'\ndate: '12/14/2021'\noutput: \n    bookdown::pdf_document2:\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, warning = F, message = F)\noptions(scipen = 10)\nlibrary\n```\n\n\n```{r}\ntest = 10\nfor (i in 1:100) {\n    print(i)\n}\n```\n\n```{r}\nanother_test = function(i) {\n    if (i > 0) {\n        print(i)\n    } else {\n        for (i in 1:i) {\n            print(i + 5)\n        }\n    }\n}\n```\n")]))
[client-request] (id:28) Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :id 28 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 7)))
[client-request] (id:29) Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :id 29 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 7)))
[client-request] (id:30) Tue Oct 18 22:22:00 2022:
(:jsonrpc "2.0" :id 30 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/northyear/Downloads/test/test.rmd")
	   :position
	   (:line 12 :character 7)))

Backtrace (mandatory, unless no error message seen or heard):

no backtrace, as this is not a error

Minimum Reproducible Example (mandatory)

minimal emacs config

;;; minimal-ess-eglot.el -*- lexical-binding: t; -*-


(require 'package)
(setq package-user-dir "~/Downloads/emacs-package-dir")

(setq package-list '(ess polymode poly-R eglot))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))

(add-hook 'ess-r-mode-hook #'eglot-ensure)

Here's how I suggest you structure your recipe:

  1. How is Emacs started?
emacs -Q -nw -l /path/to/minimal-config.el
  1. Where does the language server executable live in your machine and
    how should it be installed?

/usr/local/bin/R via official R installer (or just R-base and R-base-dev for apt-get, say)
and install languageserver via R -e 'install.packages("languageserver")'

  1. What project files are needed to demonstrate the problem? Please

say there is a test.rmd located at any .git project root

https://pastebin.com/mXaDJ7yT

(since rmarkdown syntax will be conflict with github markdown syntax, attach the text in pastebin)

  1. How is Emacs operated/configured before you invoke Eglot?

emacs -Q -nw -l /path/to/minimal-config.el

  1. How is Emacs operated after you invoke Eglot

  2. What actions must be taken for the problem to manifest itself?

move point to a source code block (lines between three backquotes marker),
and feel obvious lag (hang emacs) for few seconds for the first time entering a code block,
and after entering the block, typing some characters may feel laggy at random(occasionally)

  1. What is the expected behaviour?

smooth typing experince, smooth moving cursor experience

  1. What is the observed behaviour?

feel obvious lag (hang emacs) for few seconds for the first time entering a code block,
and after entering the block, typing some characters may feel laggy at random( more frequent than occasionally)

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions