attribute/method to locate `StructTypeDef` from `StructInstance`
See original GitHub issueHi @mlin,
As the title says, we’d like to add “Go to definition/Find references” features to all editors through LSP. In order to do that, we could either:
- implement relevant functionality in
wdl-lsp
package, or - add a couple methods to MiniWDL itself.
In both cases, the methods would operate on the parsed AST, and would take a source pos
and return a target pos[]
, which corresponds to place(s) where it was defined/referenced.
Do you think such methods would better belong to MiniWDL, or should we implement them on our end?
Regardless, I’m thinking to approach the implementation by traversing the entire WDL.Tree
and finding the corresponding list of pos
: pos[]
pairs. To improve performance, we can also construct a symbol lookup table so we only need to traverse the tree once, and do everything else in O(1), until the tree is modified.
Would be interesting to hear your thoughts. Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:16
Top GitHub Comments
I just remembered how to do this while fixing some linter bugs – updated docstring in the above commit. That gets you to the
StructTypeDef
in the current document, which might actually be a reference to the actual definition in an imported document.yep, we keep all dependencies strictly versioned, so it will not break any existing or new installations, and we’ll just need to produce a new update for
wdl-lsp
with the fixes that use the new version of MiniWDL