-
Notifications
You must be signed in to change notification settings - Fork 210
[Concourse] Navigation in pipeline files with VSCode Concourse CI extension doesn't work everytime #483
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Does the problem seem deterministic? I.e. is it something that depends on the contents in the editor and allways happens when that editor content is the same? Or is more like something that feels a bit random, it works / doesn't work even though nothing is different about the editor content. If it is deterministic, it would be very helpful to provide the exact editor content that causes the problem (or a cut down version of it). That should make it relatively easy then to reproduce, diagnose and fix. |
Followed up on your hunch that it might have something to do with anchors and references. And... bingo :-) This example reproduces the issue:
When I delete the line |
Thank you for you answer but it doesn't seem to be so simple. Indeed, when I delete the lines with anchors or aliases, my outline view doesn't work better. Here's a sample: registries-pe: ®istries-pe
insecure_registries:
- ((docker_pe.registre))
username: ((docker_pe.utilisateur))
password: ((docker_pe.mot_de_passe))
registry_mirror: http://((docker_pe.registre))
resource_types:
- name: kubernetes-resource
type: docker-image
source:
repository: ((docker_pe.registre))/incubateur/concourse-kubernetes-resource
tag: 1.16
<<: *registries-pe
- name: concourse-pipeline-resource
type: docker-image
source:
repository: ((docker_pe.registre))/concourse/concourse-pipeline-resource
tag: 1.1.0
insecure_registries:
- ((docker_pe.registre))
<<: *registries-pe |
Thanks for the extra examples. It is always nice to have more examples to demonstrate / reproduce a bug, as well as verify a potential fix. This is especially true if the examples are markedly different. So therefore... you said:
So I take it you actually have a editor contents example that has a problem despite not using anchors and/or references? Can you please paste that example as it would be a bit different from the other examples we have already. |
Here is an example (I rename it in .txt so I can upload it on github): pipeline.yaml And here is the corresponding outline view and the non-working GoTo functionality: |
I've just noticed that if if I disable the plugin, reload VSC and then finally reactivate the plugin, I get the outline back again (with the file without anchors and/or references) ... The same process doesn't work with the file with anchors and/or references. |
Looks to me like contents of the outline view is simply not being updated immediately in all cases. I'm not sure of the exact logic of when vscode refreshes the outline. Saving the file seems to be fairly robust way of 'forcing' an update. Sometimes it also refreshed quickly as I typed, sometimes there seems to be a lag. And sometimes, unless I do something l(like click in the editor or save it) it doesn't refresh. However, from what I can tell so far, the problem with the outine being 'empty' is tied strictly to references and anchors. A file with no references / anchors in it seems to allways work fine... sometimes we have to do something to make it appear (save file etc). And yes, you are right some examples with references in them do still seem to work fine. That's interesting too. But most important is... having some examples that makes it not work, with those I can debug the issue and figure out why it doesn't work... then hopefully fix that. BTW: Ironically, all the examples that I've tried so far, only the first one that I posted myself... is one were it breaks outine for me. The other two you gave both seem to work just fine. |
Thanks for the extra example. That helps. |
See: #483 Signed-off-by: Kris De Volder <kdevolder@pivotal.io>
Problems that I found debugging this:
Vscode doesn't like 'null' in the tree neither does it like symbol's who's name range isn't 'nested' in he symbol range. I addressed both of these by:
Now my own example seems to work. It would nice @OphyTe if you could also give it a try and see if it helps for your examples as well. |
If you want to try, you can get a snasphot build from here: http://dist.springsource.com/snapshot/STS4/nightly-distributions.html |
I decided to quickly try out your complex 'not working' example from above. Sadly that still is not working. It's quite a complex file that one :-). So not so easy to just eyeball it and guess why it's causing issues. It's getting a bit late here and I'm done for today, but before closing this ticket, I'd like to try debug this a bit and understand what may be going on there. So reopening ticket until I have a chance to do that. The snasphot meanwhile already has the fixes that may help in some cases. Still would be nice if you can give that one a try. |
I've just tested it and it doesn't work on any of my projects ... 😞 |
I created a test case from the 'not working' sample. Looks like when our editor is trying to validate the file, the validation is crashing with some error:
I'm looking into that now trying to determine the cause of it. First guess: the use of anchors and references makes it so that the yaml AST is not strictly a tree anymore. There are sections of the 'tree' that are actually shared and so when we 'walk' the tree we are visiting some parts of the tree more than once. I think this causing problems somehow. |
Note: whatever the cause may be, this is clearly to be considered as a bug in our validator. Even if there is 'strange stuff' or problems in a file (and I'm not even sure there is an actual problem with the file)... the validator should never crash, (if there is a problem, a problem should be reported, instead of validator crashing). |
Looks like I was correct in my guess. Added some logging to detect the condition that would cause the exception and then log some info instead of crashing. I got a very long list of this:
|
In the sample file the 'notifications' section with a 'on_failure' bit that has a reference to a resource in it. This is inserted by means of |
Good news for this example is that it seems the type assignment in each visit is consistent. This makes sense, if the inserted blob of yaml is used in each 'insertion point' in a similar way. So, if we just detect the duplicate type assignment and simply ignore the extra/redundant ones (instead of allowing them to crash the validator), I think everything should work nicely. |
The newest snapshot now works with your previously posted 'complex not working example'. Snapshot that I tried out myself: https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/vscode-extensions/snapshots/vscode-concourse-1.24.0-202011162342.vsix Can be gotten also from http://dist.springsource.com/snapshot/STS4/nightly-distributions.html (but be careful as that browser has a tendency to cache old links / contents of that page. So make sure version you get is at least timestamp Let me know how it goes. If you still have issue... as always... if you can provide an example of something that doesn't work would be great to help debug. |
Yes it works like a charm! All that's missing now is the integration of the anchors in the outline view 😉 |
Great! Thanks for trying it. |
Sometimes, navigation through the outline view doesn't work anymore on the pipeline files ... I get the message "No symbols found in document pipeline.yaml' (my document is ok, it works on my Concourse instance).
I didn't know why yet. Maybe because of my use of yaml anchors and aliases ...
The text was updated successfully, but these errors were encountered: