diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-02 09:34:03 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-02 09:34:03 +0100 |
commit | 9ee96dcf4a2b47a6df0e3ea379d36aec2e6e1784 (patch) | |
tree | 672f5ebda7447c06ff28556515e41b13cef261e1 /Cargo.toml | |
parent | 98f7842e408587fdaca3d15d8eda677b689a035a (diff) | |
parent | dd5e4d4870b4e59bc82d285c481bb6971d016912 (diff) |
Merge #3816
3816: vscode: add goto ast node definition from rust source code r=Veetaha a=Veetaha
By holding the `Ctrl` key you can now goto-definition of the appropriate syntax token in the syntax tree read-only editor. But actually going to the definition is not very convenient, since it opens the new editor, you'd rather just hold the `Ctrl` and look at the syntax tree because it is automatically scrolled to the proper node and the node itself is enclosed with text selection.
Unfortunately, the algorithm is very simple (because we don't do any elaborate parsing of the syntax tree text received from the server), but it is enough to debug not very large source files.
I tested the performance and in a bad case (rust source file with 5K lines of code) it takes `1.3` seconds to build the `rust -> ast` mapping index (lazily once on the first goto definition request) and each lookup in this worst-case is approx `20-120` ms. I think this is good enough. In the simple case where the file is < 100 lines of code, it is instant.
One peculiarity that I've noticed is that vscode doesn't trigger the goto-definition provider when the user triggers it on some punctuation characters (i.e. it doesn't underline them and invoke te goto-definition provider), but if you explicitly click `Ctrl+LMB` it will only then invoke the provider and navigate to the definition in a new editor. I think this is fine ;D
![rust2ast](https://user-images.githubusercontent.com/36276403/78198718-24d1d500-7492-11ea-91f6-2687cedf26ee.gif)
Related: #3682
Co-authored-by: veetaha <[email protected]>
Diffstat (limited to 'Cargo.toml')
0 files changed, 0 insertions, 0 deletions