willcrichton / flowistry

Flowistry is an IDE plugin for Rust that helps you focus on relevant code.
https://marketplace.visualstudio.com/items?itemName=wcrichton.flowistry
MIT License
1.91k stars 45 forks source link

Panic on slicing const string #31

Closed willcrichton closed 2 years ago

willcrichton commented 2 years ago

ex:

fn foo() { 
  const FOO: &str = "bar";
}

select FOO, get Unknown arg span for owner_node

Issue is that const FOO: .. is treated as a standalone item, not a variable declaration within foo, (e.g. similar if you nested fn bar() {} inside of foo). So the broader issue is attempting to slice items that aren't functions.

But also: is it possible to be able to slice FOO? Even if this doesn't panic, it's confusing for a user.