onflow / cadence-tools

Developer tools for Cadence
https://www.onflow.org/
Apache License 2.0
24 stars 20 forks source link

[LS] `textDocument/documentSymbol` failed keeps showing #397

Closed jribbink closed 2 months ago

jribbink commented 8 months ago

Problem

textDocument/documentSymbol failed error displays any time the LS tries to check this code (i.e. just type in the window and each time it refreshes the LS it will show).

Screenshot 2024-01-10 at 4 18 50 PM

[Error - 4:18:09 PM] Request textDocument/documentSymbol failed.
Error: selectionRange must be contained in fullRange
    at Function.validate (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:137:17337)
    at new d (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:137:17551)
    at kn (/Users/jordan/.vscode/extensions/onflow.cadence-2.2.0/out/extension/src/main.js:77:72602)
    at kn (/Users/jordan/.vscode/extensions/onflow.cadence-2.2.0/out/extension/src/main.js:77:72781)
    at a (/Users/jordan/.vscode/extensions/onflow.cadence-2.2.0/out/extension/src/main.js:77:46794)
    at Object.FMe (/Users/jordan/.vscode/extensions/onflow.cadence-2.2.0/out/extension/src/main.js:77:46880)
    at Object.to [as asDocumentSymbols] (/Users/jordan/.vscode/extensions/onflow.cadence-2.2.0/out/extension/src/main.js:77:72569)
    at l (/Users/jordan/.vscode/extensions/onflow.cadence-2.2.0/out/extension/src/main.js:81:56108)
    at d.provideDocumentSymbols (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:39616)

Steps to Reproduce

Write an import similar to what I have and make LS refresh.

Acceptance Criteria

Doesn't show error.

Context

Bad UX, useless error

turbolent commented 7 months ago

Probably a LS issue, maybe move to the cadence-tools repo

nichita-rusin commented 3 months ago

Any news on this? It's completely breaking my workflow.

turbolent commented 3 months ago

@jribbink Is the reproducer simply what is shown in the screenshot? something like import T from 0x1?

jribbink commented 3 months ago

Yeah, from what I can remember this will reproduce it 👍 .

jribbink commented 2 months ago

This should be fixed by https://github.com/onflow/cadence/issues/3497.

I'm not sure if my original reproducer screenshot was missing something. I tried parsing imports like the one in the image and it doesn't seem to cause the issue (the Range assigned to the ImportDeclaration appears correct), so it must have been entitlements.