question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

attribute/method to locate `StructTypeDef` from `StructInstance`

See original GitHub issue

Hi @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:

  1. implement relevant functionality in wdl-lsp package, or
  2. 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!

CC @pshapiro4broad @rexwangcc @mohawkTrail

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
mlincommented, Nov 29, 2019

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.

1reaction
dinvladcommented, Aug 19, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to combine typedef'd struct with instance creation?
No, you can't. typedef 's syntax is typedef T type_ident; // T is type specified by the declaration specifiers.
Read more >
Type Attributes - Using the GNU Compiler Collection (GCC)
The keyword __attribute__ allows you to specify special attributes of struct and union types when you define such types. This keyword is followed...
Read more >
How to use the typedef struct in C - Educative.io
The C language contains the typedef keyword to allow users to provide alternative names for the primitive (e.g.,​ int) and user-defined​ (e.g struct)...
Read more >
Structs (Structures) in C - An Introductory Tutorial on typedefs ...
0:00 Structs are Structures / Compound Data Types to group related variables0:55 The syntax of struct declarations in C with an example ......
Read more >
CS31: Intro to C Structs and Pointers
A struct is a type used to represent a heterogeneous collection of data; it is a mechanism for treating a set of different...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found