-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ledger sections in VSCode outline view #57
Comments
looks cool to me, i am in the process of moving the vscode-beancount repo to this repo. i can merge the code into master so you can make a PR with your changes. the vscode extension will be in the folder editor/code. |
code should be in master now to write PR |
awesome, i'll give it a try |
OK so I did some reading. my understanding is there's essentially 3 parsers happening here:
Adding the symbol provider would add a 4th (albeit ad-hoc) parsing pass, also in VSCode's node process. A couple ideas:
WDYT? Honestly option 1 feels not really better than just installing vscode-beancount-language-server + vscode-aarons-beancount-utils. Option 2 seems more fun, but based on the profiling I've done, it's unlikely to actually be a performance benefit unless we do option 3. Option 4 seems most theoretically pure, but (a) that's a lot of work and (b) you still need to create VSCode types at some point, and those would need to be serialized between processes, so IDK if it'd actually be any performance benefit. I'd propose:
WDYT? |
I like option 1 for now, it might make better sense to add to the rust parser later(so all editors can get the benefit). the semantic provider is in the vscode extension because it is only needed for vscode (since most editors support tree-sitter) . |
Hi there, thanks again for the cool language server.
I had this desire to be able to jump quickly to headings in the ledger (where "headings" are lines that begin with some number of asterisks, which I believe comes from Emacs org-mode, i.e. "Hooli Income" or "Vanguard Brokerage"). VSCode has the "outline" view in the explorer, and that comes from the
DocumentSymbolProvider
extension API.I coded it up here: https://github.com/aaronj1335/vscode-aaronsbeancountutils/blob/10499548429d0521241ca8bc80fddaeaf07d0dec/src/extension.ts#L112, (quick docs) and I find it quite helpful.
I think this is relatively performant since it's a single loop through the lines (which I guess I assume are already parsed). That being said, it seems like a bit of a shame this isn't baked into the language server more directly.
If you think this would be appropriate in your language server, I'd love to contribute it, but I'd need some pointers. WDYT? Any chance you could give me some guidance on building the VSCode extension and where this might fit in?
The text was updated successfully, but these errors were encountered: