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

documentHighlight failed when first opening a project #1096

Closed
Zhaoyilunnn opened this issue Jul 11, 2024 · 4 comments
Closed

documentHighlight failed when first opening a project #1096

Zhaoyilunnn opened this issue Jul 11, 2024 · 4 comments
Assignees

Comments

@Zhaoyilunnn
Copy link

Zhaoyilunnn commented Jul 11, 2024

Hello, thanks for the great work.

I have a small project wirtten in python. I found coc-pyright being very slow when starting. Specifically, when I first open my source file, it stucks for a long time beforing document highlighting works. Then I found the errors below. And before coc-pyright finally get to work, I found node cosuming 100% usage of a CPU core.

What's the output of :CocCommand pyright.version

[coc.nvim] coc-pyright 1.1.371 with Pyright 1.1.371

What's the output of :CocCommand workspace.showOutput Pyright

Workspace: /home/zhaoyilun/dqc-map
Using python from /home/zhaoyilun/miniconda3/envs/dm-dev/bin/python

[Info  - 15:06:29.144] Pyright language server 1.1.371 starting
[Info  - 15:06:29.144] Server root directory: file:///home/zhaoyilun/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist
[Info  - 15:06:29.146] Starting service instance "dqc-map"
[Info  - 15:06:29.179] Setting pythonPath for service "dqc-map": "/home/zhaoyilun/miniconda3/envs/dm-dev/bin/python"
[Info  - 15:06:29.180] Loading pyproject.toml file at /home/zhaoyilun/dqc-map/pyproject.toml
[Info  - 15:06:29.182] Pyproject file "/home/zhaoyilun/dqc-map/pyproject.toml" has no "[tool.pyright]" section.
[Info  - 15:06:29.182] No include entries specified; assuming /home/zhaoyilun/dqc-map
[Info  - 15:06:29.183] Auto-excluding **/node_modules
[Info  - 15:06:29.183] Auto-excluding **/__pycache__
[Info  - 15:06:29.183] Auto-excluding **/.*
[Info  - 15:06:29.220] Assuming Python version 3.11.9.final.0
[Info  - 15:06:29.324] Found 12 source files
[Error - 15:06:34.596] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:06:36.492] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:06:36.514] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:06:38.478] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:06:38.500] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:06:38.571] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:07.232] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:07.233] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:07.234] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:07.234] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:09.115] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:09.116] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:10.993] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:10.994] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:11.016] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:11.038] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:13.003] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:07:16.847] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800
[Error - 15:11:42.650] Sending request textDocument/documentHighlight failed.
  Message: request cancelled
  Code: -32800

Additionally, this is my CocInfo output

## versions
vim version: VIM - Vi IMproved 9.1 9010558
node version: v20.12.2
coc.nvim version: 0.0.82-cfa1115 2024-07-10 15:49:31 +0800
coc.nvim directory: /home/zhaoyilun/.vim/plugged/coc.nvim
term: dumb
platform: linux
@fannheyward
Copy link
Owner

You can ignore the textDocument/documentHighlight error as the client cancelled it.

being very slow when starting

Can't reproduce this, do you have any error in :CocOpenLog?

@Zhaoyilunnn
Copy link
Author

Zhaoyilunnn commented Jul 11, 2024

You can ignore the textDocument/documentHighlight error as the client cancelled it.

being very slow when starting

Can't reproduce this, do you have any error in :CocOpenLog?

Thanks for the quick reply.

There's no error in :CocOpenLog

being very slow when starting

It sometimes takes a long time (seconds to a minite) to highlight variables where my cursor locates, I am not sure whether this is expected behavior.

If I stay on one single source file, everything works fine after waiting for some moment (i.e., highlighting, goto definition, autocompletion, etc). However, if I do some other things like quickly switching between different tabs or use shift + G to go to the end of the source file, it somes got stuck again and I need to wait for a long time again.

As a comparison, my other coc-extensions like coc-rust-analyzer is much faster during the same period.

BTW, could you illustrate the meaning of request cancelled? I am sure I am not moving my cursor so this should not be proactively cancelled by myself, are there any other causes of request cancelled

@fannheyward
Copy link
Owner

Disable inlayHint.enable and try again, maybe same issue as #1087

are there any other causes of request cancelled

coc.nvim will cancel the request at documentHighlight.timeout, it's 300ms by default.

@Zhaoyilunnn
Copy link
Author

Disable inlayHint.enable and try again, maybe same issue as #1087

Thanks a lot, this do solve my problem

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

No branches or pull requests

2 participants