Skip to content
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

Add a note how default lsp-enable-indentation settings can hit performance and editing experience. #3933

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

artemkovalyov
Copy link
Contributor

My JS editing was halting during editing with this in Messages buffer: lsp-request: Timeout while waiting for response. Method: textDocument/rangeFormatting. Disabling indentation in the config solved the problem. I think this has to be nil by default or correctly set based on server features. I used this gitter thread as a hint, although I couldn't find this issue mentioned anywhere in the docs

My JS editing was halting during editing with this in Messages buffer:  `lsp-request: Timeout while waiting for response.  Method: textDocument/rangeFormatting`. 
Disabling indentation in the config solved the problem. I think this has to be `nil` by default or correctly set based on server features.
I used this gitter thread as a hint, although I couldn't find this issue mentioned anywhere in the docs
@ericdallo
Copy link
Member

I also received complains about rangeFormatting freezing the editor for Clojure, @yyoncho should we consider disabling by default?

@yyoncho
Copy link
Member

yyoncho commented Jan 28, 2023

Can someone provide some callstack who is calling this range formatting?

@artemkovalyov
Copy link
Contributor Author

@yyoncho, here's what in my logs:

[lspserver] Using Typescript version (user-setting) 4.9.4 from path "/home/artem/.nvm/versions/node/v18.12.1/lib/node_modules/typescript/lib/tsserver.js"
Cancelling textDocument/semanticTokens/full(31) in hook after-change-functions
Cancelling textDocument/documentHighlight(29) in hook after-change-functions
Cancelling textDocument/codeAction(28) in hook after-change-functions
Cancelling textDocument/codeAction(34) in hook post-command-hook

Give me an idea of what should I instrument for the stack trace you're looking for.

@yyoncho
Copy link
Member

yyoncho commented Jan 28, 2023

Most likely M-x debug-on-entry RET lsp-format-region RET

@ericdallo
Copy link
Member

For clojure users it's pretty common during use of parent manipulations:

Debugger entered--entering a function:
* lsp-format-region(2367 2800)
  apply(lsp-format-region (2367 2800))
  #f(advice-wrapper :override clojure-indent-region lsp-format-region)(2367 2800)
  indent-region(2367 2800 nil)
  paredit-forward-and-indent(nil)
  paredit-forward-barf-sexp(nil)
  funcall-interactively(paredit-forward-barf-sexp nil)
  command-execute(paredit-forward-barf-sexp)

@artemkovalyov
Copy link
Contributor Author

artemkovalyov commented Jan 29, 2023

@yyoncho, here we go:

plugins/Debugger entered--entering a function:
* lsp-format-region(883 1013)
  apply(lsp-format-region (883 1013))
  #f(advice lsp-format-region :override #f(compiled-function (&rest args) #<bytecode -0x1d384fe0445d58b6>))(883 1013)
  indent-region(883 1013 nil)
  sp--indent-region(883 1013)
  sp--cleanup-after-kill()
  sp-backward-kill-symbol(1 t)
  sp-backward-delete-symbol(1 t)
  sp-backward-delete-word(1)
  funcall-interactively(sp-backward-delete-word 1)
  call-interactively(sp-backward-delete-word nil nil)
  command-execute(sp-backward-delete-word)

@yyoncho
Copy link
Member

yyoncho commented Feb 23, 2023

Can you fix the wording that the issue can happen only in combination with smartparens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants