Giter Club home page Giter Club logo

Comments (20)

yhoiseth avatar yhoiseth commented on July 21, 2024 1

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.

levitanong avatar levitanong commented on July 21, 2024 1

Hurrah! Thanks for this!

from hledger-vscode.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

levitanong avatar levitanong commented on July 21, 2024

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.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

levitanong avatar levitanong commented on July 21, 2024

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.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

levitanong avatar levitanong commented on July 21, 2024

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.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

levitanong avatar levitanong commented on July 21, 2024

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.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

levitanong avatar levitanong commented on July 21, 2024

Hello again! I've run into a couple of problems, and I'm hoping you have some insight here:

  1. 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.
  2. 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.
  3. 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.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

levitanong avatar levitanong commented on July 21, 2024

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.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

mhansen avatar mhansen commented on July 21, 2024

from hledger-vscode.

mhansen avatar mhansen commented on July 21, 2024

Should be fixed now; give it a go and open a bug if you see any problems?

from hledger-vscode.

yhoiseth avatar yhoiseth commented on July 21, 2024

Just updated, and it looks great so far. Thanks a ton :)

from hledger-vscode.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.