Skip to content
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

Allow completion from declared accounts #59

Merged
merged 1 commit into from
Jul 2, 2019

Conversation

rohieb
Copy link
Contributor

@rohieb rohieb commented Oct 1, 2017

When using ledger with the --strict option, you need to declare all your used accounts. These declarations can additionally be used to complete account names.

@rohieb
Copy link
Contributor Author

rohieb commented Oct 2, 2017

Mmmh, account names can contain spaces, so I cannot safely use split('[, \t]') … will fix this tomorrow.

@rohieb rohieb force-pushed the completion-from-account-stmts branch 2 times, most recently from 3b2db61 to 63aa71b Compare October 3, 2017 00:15
@rohieb
Copy link
Contributor Author

rohieb commented Oct 3, 2017

Should be fixed now by replacing the split(line, '[, \t]') with a split(line, '\s\+;') to remove comments at the end, and then matching to the pattern account\s\+\(.\+\).

Copy link
Member

@kljohann kljohann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is a very useful feature.

Can you re-indent your changes to match the rest of the file (inside while loop)?

autoload/ledger.vim Outdated Show resolved Hide resolved
autoload/ledger.vim Outdated Show resolved Hide resolved
When using ledger with the `--strict` option, you need to declare all
your used accounts. These declarations can additionally be used to
complete account names.

ledger#declared_accounts() works a lot like ledger#transactions(), on
which it is based. s:collect_completion_data() can then take the list of
declared accounts as an initial value to which it then adds the accounts
used in transactions.

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
@rohieb rohieb force-pushed the completion-from-account-stmts branch from 63aa71b to 5a41452 Compare October 19, 2017 00:44
@rohieb
Copy link
Contributor Author

rohieb commented Oct 19, 2017 via email

@rohieb
Copy link
Contributor Author

rohieb commented Oct 24, 2017

I'm also thinking if it would be a good idea to follow the include statements, and look for account completions in those files also. This way, when using ledger --strict, I could split up my journal into several files for better overview, and still make use of omnicompletion.

@alerque
Copy link
Member

alerque commented Jul 1, 2019

Hey @rohieb thanks for taking the time to contribute this. I've recently stepped in to help maintenence of this plugin along a bit and am wondering what the status is. It looks like most of the PR feedback has been addressed. Is that your take too?

I agree following includes (or better yet, some way to scan all project files because in my case I'm in the included file and want to complete from all accounts) but I don't think that should hold up merging this PR to add that feature (which might take a little ironing out).

Is there any reason we can't go ahead with merging this as it stands?

@rohieb
Copy link
Contributor Author

rohieb commented Jul 1, 2019

Thanks for coming back to this :-) I think it looks fine as-is.

@alerque alerque merged commit babb13c into ledger:master Jul 2, 2019
@rohieb rohieb deleted the completion-from-account-stmts branch July 2, 2021 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants