move icon indicating copy to clipboard operation
move copied to clipboard

[Feature Request][move-analyzer] Make go-to-def, find-references, etc. more robust to error-introducing updates

Open awelc opened this issue 3 years ago • 0 comments

🚀 Feature Request

At this point, file updates are obtained by the Move analyzer by reading on-disk files. Relying on incremental updates being transmitted by the IDE (https://github.com/move-language/move/issues/378) would makes go-to-def, find-references, etc. less sensitive to error-introducing file updates.

Motivation

At this point, we need all files in the project to compile in order to rebuild metadata needed for go-to-def, find-references etc. When a developer modified a file and introduced a compilation problem, the old version of the metadata is being used. What this means that even when compilation problems are present, go-to-def, find-references, etc. will work but only to an extent. The limitation here is that file editing may introduce new characters on a given line or new whole new lines, which will affect the metadata (computed before compilation-breaking edits) that describes locations of identifiers and their definitions. This may result in, say, a function name in the editor being located in a different place that is known to the Move analyzer, and a query related to this function name will fail. Similarly, if function name is in the same place as far as both the editor and the Move analyzer are concerned, but it's definition is not, an action for this identifier may fail, say go-to-def will jump to a place where there is no function definition.

Pitch

The solution would be to use incrementalized updates sent from the editor to Move analyzer (https://github.com/move-language/move/issues/378). The Move analyzer, on the other hand, would have to store file content non-contiguously and adjust location of identifiers and their definitions when an edit to a give file is received.

awelc avatar Aug 12 '22 23:08 awelc