peggyjs / code-peggy-language

VSCode syntax highlighting and error reporting for Peggy
MIT License
15 stars 9 forks source link

Empty outline on newly opened files #46

Open j4k0xb opened 1 year ago

j4k0xb commented 1 year ago

Steps to reproduce:

  1. Open a pegjs file
  2. See that the outline is empty: image
  3. Only after editing something it gets initialized: image

Expected: show all symbols directly after opening

After debugging a bit I found out it was introduced in #33 because validateTextDocument always delays the AST parsing but in the meantime onDocumentSymbol gets called which can't find the cached AST

hildjj commented 1 month ago

OK, I've found this. Worked around it by ensuring we have waited for parsing to finish before replying to the request that the editor sends.
There's an outside chance that they way I solved it will leave the outline unchanged after you rename something, so if you happen to see that, re-open this.