joaotavora / eglot

A client for Language Server Protocol servers
GNU General Public License v3.0
2.25k stars 200 forks source link

eglot freezes (maybe disconnects and reconects) for several second when working in quarto or RMarkdown documents #1080

Closed cddesja closed 1 year ago

cddesja commented 1 year ago

I have the following in my init.el

(use-package eglot
  :ensure t
  :hook ((ess-r-mode . eglot-ensure)))

Below is a very simple RMarkdown/quarto document. It should be copied/pasted into a test.qmd (if Quarto is installed) or a test.Rmd file. It doesn't matter, as I get this behavior using either.

  1. Open the file in Emacs and enter an R chunk, denoted by ```{r}. The first time eglot connects, no problem.
  2. Move cursor outside of chunk.
  3. Move cursor back into chunk, eglot mode shows that it's activated.
  4. Start editing code in chunk, maybe deleting or typing 2 + 2 or library(MASS), and eglot hangs. This is typically for 5 seconds or so on my machine.

This always happens when editing chunks with eglot enabled.

Eglot works fine R scripts, just not with Rmd or qmd files.

---
title: "ggplot2 demo"
author: "Norah Jones"
date: "5/22/2021"
format: 
  html:
    code-fold: true
---

## Air Quality

@fig-airquality further explores the impact of temperature on ozone level.

```{r}    
library(ggplot2)
ggplot(airquality, aes(Temp, Ozone)) + 
  geom_point() + 
  geom_smooth(method = "loess")
```

```{r}
head(mtcars)
plot(mpg ~ wt, mtcars)
```
joaotavora commented 1 year ago

Not according to the bug reporting template. Missing information. Converting into discussion.