Lsp-mode: Moving cursor is very slow

Created on 17 May 2019  路  6Comments  路  Source: emacs-lsp/lsp-mode

Describe the bug
A clear and concise description of what the bug is.

Cursor feels sluggish and stops at times when moving around files. I use spacemacs with evil-mode, in case that matters.

To Reproduce
Steps to reproduce the behavior:

  • Navigating in a very small project (python and go)
  • Cursor starts feeling sluggish and stops at times

Expected behavior
A clear and concise description of what you expected to happen.

Which Language Server did you use
Mention which server/language did you use (e. g. lsp-python, lsp-ccls, lsp-java, etc)

  • lsp-python
  • lsp-golang

OS
Which os do you use?

Linux

Profiler



Profiler output

- lsp-ui-doc--make-request                                        971  34%
 - lsp-ui-doc--hide-frame                                         681  24%
  - lsp-workspace-root                                            641  22%
   - f-ancestor-of?                                               414  14%
    - f-same?                                                     394  14%
     - f-canonical                                                353  12%
      - file-truename                                             347  12%
       - file-truename                                            278   9%
        - file-truename                                           216   7%
         - file-truename                                          182   6%
          - file-truename                                         136   4%
           - file-truename                                         90   3%
            - file-truename                                        57   2%
               file-truename                                       27   0%
       f-exists?                                                   27   0%
       f-expand                                                     3   0%
    + f-full                                                       20   0%
   + f-canonical                                                  227   8%
    lsp-ui-doc--get-frame                                           7   0%
  + #<compiled 0x1d1aba9>                                           6   0%
 - lsp--send-request-async                                        257   9%
  - lsp--make-message                                             254   9%
   - json-encode                                                  254   9%
    - json-encode-list                                            254   9%
     - json-encode-plist                                          254   9%
      - json-encode                                               176   6%
       - json-encode-list                                         172   6%
        - json-encode-plist                                       172   6%
         - json-encode                                            115   4%
          - json-encode-list                                      115   4%
           - json-encode-plist                                    111   3%
            - json-encode-key                                      92   3%
             - json-read-from-string                               75   2%
              + #<compiled 0x36cc489>                              65   2%
              + generate-new-buffer                                10   0%
               json-encode                                          4   0%
            + json-encode                                          19   0%
         + json-encode-key                                         57   2%
         json-encode-string                                         4   0%
      - json-encode-key                                            78   2%
       - json-read-from-string                                     72   2%
        + #<compiled 0x1d1a289>                                    66   2%
          generate-new-buffer                                       6   0%
    lsp--send-no-wait                                               3   0%
 + lsp--capability                                                  7   0%
 + lsp--buffer-uri                                                  6   0%
 + symbol-at-point                                                  3   0%
+ redisplay_internal (C function)                                 621  22%
+ timer-event-handler                                             497  17%
+ command-execute                                                 334  11%
+ #<compiled 0x2d42b15>                                           267   9%
+ eldoc-pre-command-refresh-echo-area                              29   1%
+ sp--save-pre-command-state                                       12   0%
+ winner-save-old-configurations                                   11   0%
+ lsp--highlight                                                   10   0%
+ evil-repeat-post-hook                                            10   0%
+ lsp-ui-sideline                                                   6   0%
+ evil-repeat-pre-hook                                              6   0%
+ flycheck-hide-error-buffer                                        6   0%
+ hl-paren-initiate-highlight                                       4   0%
  yas--post-command-handler                                         3   0%
+ evil--jump-hook                                                   3   0%
+ #<compiled 0x2a6dfb9>                                             3   0%
  company-post-command                                              3   0%
+ evil-escape-pre-command-hook                                      3   0%
+ flycheck-pos-tip-hide-messages                                    3   0%
  undefined                                                         3   0%
+ ...                                                               0   0%

Most helpful comment

We still need to fix that. I just wanted to confirm that this is what is causing the sluggishness on your system.

All 6 comments

Can you set lsp-ui-doc-enable to nil, close and reopen the file and report back whether the issue has been solved?

Yes, I can confirm that solves the sluggishness. Thanks for the quick reply and fix.

The doc was kind of a useful thing. Guess I can live without it. Is it possible to have it activate with a keybinding.

EDIT:

To show it manually add a keybinding to the function lsp-ui-doc-show

We still need to fix that. I just wanted to confirm that this is what is causing the sluggishness on your system.

@yyoncho In case it's important, in go files, it shows LSP:: No identifier found in the message in certain places, like at closing brackets.

To show it manually add a keybinding to the function lsp-ui-doc-show

You may use K in normal state for the standard help.

@yyoncho In case it's important, in go files, it shows LSP:: No identifier found in the message in certain places, like at closing brackets.

go language servers break the lsp protocol by returning an error instead of returning nil. We may start eating the error istead of showing warning.

Was this page helpful?
0 / 5 - 0 ratings