OCamlPro / superbol-studio-oss

Open-Source part of SuperBOL Studio, including the Visual Studio Code extension and its LSP server
https://superbol.eu
Other
24 stars 13 forks source link

`Lsp_lookup.element_at_position` unable to find 88 level fields in the Data division #297

Open NeoKaios opened 5 months ago

NeoKaios commented 5 months ago

When hovering or going to definition on a condition field (88), the lsp lookup the element under the cursor with the Lsp_lookup.element_at_position function, which in turn uses the fold_unit_group Visitor. When checking the position of a 88 field, the function returns nothing.

This is because the Lsp_position.sieve skips elements whose loc doesn't include the requested position. But the loc of the item_definition which contains the 88 field stops after the last sub-fields, not after the last condition field. Like so:

+       5           WORKING-STORAGE SECTION.
+       6 >         01 VAL PIC X.
+    ----           ^^^^^^^^^^^^^
+       7             88 COND VALUE "A".

Once this is fixed, it will possible to hover and go to def on such position.

GitMensch commented 5 months ago

I'm a bit confused now - was this fixed by the referenced PR?

NeoKaios commented 5 months ago

No it was not, atm when hovering or [go to definition] on the example given, the lsp fails to find the definition

GitMensch commented 3 months ago

@nberth any ETA here? [I just make a mental list for a possible switch from bitlang.cobol]