Comments (20)
For what it’s worth, I have a different use case for generalized account syntax: use languages other than English.
(I prefer to keep my books in my native language, which is Norwegian. For example, revenues is inntekter in Norwegian.)
from hledger-vscode.
Hurrah! Thanks for this!
from hledger-vscode.
from hledger-vscode.
I have a separate top-level account called obligations
, which helps me keep track of me and my friends owing money to each other.
Formal accounting rules are too cumbersome for this task: if I owe someone money, it's a liability
, but if they owe me it's an asset:receivable
. Checking the balance between me and my friends requires me to check two different accounts.
This separate obligations
account allows me to just consolidate everything. If it's negative, I owe them. If it's positive, they owe me.
I get the desire for syntax highlighting to aid in spell checking, but IMHO that's sort of overloading the function of syntax highlighting. I think spell checking is better served by autocompletion (which it seems is on the roadmap) and explicit account declarations like so: https://hledger.org/journal.html#declaring-accounts
from hledger-vscode.
from hledger-vscode.
I'm attempting to do this, but I'm running into some trouble running the tests as they are.
I'm following the last part of the readme by executing mocha -r ts-node/register tests/test.ts
, but I keep running into errors like
Cannot find module 'assert' or its corresponding type declarations.
This applies to 'fs' and a few others as well. I've tried this on both windows and WSL2, on both node 12.9.0 and 14.8.0, and while they vary in small ways, they are all consistent in assert
and fs
being absent.
Do you have any advice on how I may proceed?
from hledger-vscode.
from hledger-vscode.
from hledger-vscode.
from hledger-vscode.
Ah! It was @types/node
that I was missing. Thank you for this!
However, I am indeed still getting errors. This time, it seems there was an API change in vscode-textmate 5.x.x, that removes loadGrammarFromPathSync
and requires an argument in the constructor of Registry
. Neither change is documented in any changelog in vscode-textmate. 😅 I did, however, find this commit:
microsoft/vscode-textmate@195943d
It also appears vscode-textmate prefers we do stuff asynchronously, so if we want to use this newer version of this library, we'll have to do some refactoring. If this is something you're interested in, I don't mind trying my hand at this.
from hledger-vscode.
from hledger-vscode.
Oh it works perfectly now! I must've pulled just after you updated the dependencies and before you pushed the async fix. 😅 I'm unblocked now, thanks! Will now work on this in earnest.
from hledger-vscode.
from hledger-vscode.
Hello again! I've run into a couple of problems, and I'm hoping you have some insight here:
- The general account syntax rules clashes with the account directive (possibly more, but this is the immediate one i've found), such that
account foo:bar
will match as one entire account. - My immediate thought to solve (1) is to add a negative lookbehind, but there seems to be no indication that it's supported by oniguruma.
- Because there doesn't seem to be a facility for exclusion, for now account matching requires that there is at least one sub-account. i.e. "foo:bar" will match, but just "foo" will not.
from hledger-vscode.
from hledger-vscode.
Hi, I just wanted to let you know that I'm still working on this, but I've been busy for the past week, and I'll likely only be able to make small progress next week.
I agree, negative lookbehind sounds expensive, and I hesitate to use it. I tried your approach a few days ago, but there doesn't seem to be much documentation about precedence or order of matching. I'm beginning to wonder if I should look into semantic highlighting, which would necessitate the creation of a language server.
from hledger-vscode.
from hledger-vscode.
from hledger-vscode.
Should be fixed now; give it a go and open a bug if you see any problems?
from hledger-vscode.
Just updated, and it looks great so far. Thanks a ton :)
from hledger-vscode.
Related Issues (14)
- Currency codes get highlighted in the middle of posting descriptions
- Tests failing after vscode-textmate update HOT 4
- Can't run tests: unable to compile typescript
- Timedot support HOT 1
- Unable to install on Arch Linux (needs to be published on Open VSX) HOT 3
- [Feature Request] Parser error reporting HOT 7
- [Feature Request] Journal Prettifier HOT 5
- Syntax coloring for effective dates HOT 11
- Currency symbols don't get highlighted if not followed by a number HOT 4
- Syntax highlighting for "revenue" in addition to "income" HOT 1
- Hashtags in transaction descriptions are being highlighted as comments HOT 1
- Consider using vscode-tmgrammar-test for tests
- Can't compile oniguruma dependency HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hledger-vscode.