mhansen / hledger-vscode Goto Github PK
View Code? Open in Web Editor NEWVSCode plugin for HLedger accounting journal file
License: MIT License
VSCode plugin for HLedger accounting journal file
License: MIT License
In transaction descriptions that contain a hashtag, the syntax highlighter incorrectly interprets it as a comment. This is misleading and may cause a user to unnecessarily edit a transaction to remove the highlight. Example:
2023-08-15 SOBEYS #680 ; The comment starts at this semicolon, but highlighter indicates that it starts at the hashtag
Liabilities:My Credit Card -43.42
Expenses:Groceries 43.42
Please see this discussion for information on how transaction descriptions are parsed. To summarize:
- transaction descriptions can contain any characters other than semicolon
- an asterisk and space at the start of the description could be interpreted as a transaction status mark
- parenthesised text at the start of the description could be interpreted as a transaction code
- the first pipe character separates payee and note subfields and can not be escaped
- a semicolon starts a comment and can not be escaped. (# and * do not start a comment except at the start of a line.)
- comments can contain any characters
- words followed by a full colon within comments are interpreted as tags
17) Hledger test case files. build($name.in.hledger)=$name.want Tags.in.hledger:
TypeError: Cannot read property 'theme' of undefined
at new e (node_modules/vscode-textmate/release/webpack:/vscodetextmate/out/main.js:52:14)
at Object.build [as default] (tests/build.js:5:20)
at Context.<anonymous> (tests/test.ts:13:22)
at processImmediate (internal/timers.js:458:21)
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
.github/workflows/deploy-to-vsx.yml
actions/checkout v4
actions/setup-node v4
HaaLeo/publish-vscode-extension v1
.github/workflows/deploy.yml
actions/checkout v4
actions/setup-node v4
HaaLeo/publish-vscode-extension v1
.github/workflows/test.yml
actions/checkout v4
actions/setup-node v4
package.json
@types/minimist ^1.2.5
@types/mocha ^10.0.6
@types/node ^20.12.11
minimist ^1.2.8
mocha ^10.3.0
ts-node ^10.9.2
typescript ^5.4.5
vscode-oniguruma ^2.0.1
vscode-textmate ^9.0.0
vscode ^1.14.0
One of the features that the Vim/Emacs ledger-language support add-ons have is reformatting of the transactions to make them look prettier (e.g., with transaction amounts aligned neatly, etc.)
While this is not a very important feature (since one can run hledger print
to obtain somewhat similar results, though it is lossy since it doesn't preserve inter-transaction comments, etc.), it would be good to have.
https://github.com/PanAeon/vscode-tmgrammar-test looks like it does what I want for tests, but maintained by someone else.
Other {h}ledger-language grammar add-ons (such as the grammar for Atom) recognizes parser errors, and thus prevents you from making mistakes while adding/editing entries.
It'd be great if this could be made an optional feature with an override command.
AFAIK hledger (and in general, ledger) allows for arbitrary account names, not just starting with liabilities, assets, etc... So more generalized account highlighting would target the first contiguous strings at most separated by one space (because the delimiter between account and amount is two spaces anyway), after the header of the transaction.
i.e.
2020-02-02 Payee blah blah
this:will:be:an:account 20 USD
this will also be:an account 30 USD
so will this -50 USD
mocha -r ts-node/register tests/test.ts
/usr/local/lib/node_modules/ts-node/src/index.ts:307
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
^
TSError: ⨯ Unable to compile TypeScript
tests/test.ts (1,25): Cannot find module 'assert' or its corresponding type declarations. (2307)
tests/test.ts (2,21): Cannot find module 'fs' or its corresponding type declarations. (2307)
at getOutput (/usr/local/lib/node_modules/ts-node/src/index.ts:307:15)
at /usr/local/lib/node_modules/ts-node/src/index.ts:336:16
at Object.compile (/usr/local/lib/node_modules/ts-node/src/index.ts:498:11)
at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:392:43)
at Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Object.require.extensions.<computed> [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:395:12)
at Module.load (internal/modules/cjs/loader.js:1105:32)
at Function.Module._load (internal/modules/cjs/loader.js:967:14)
at Module.require (internal/modules/cjs/loader.js:1145:19)
at require (internal/modules/cjs/helpers.js:75:18)
at /usr/local/lib/node_modules/mocha/lib/mocha.js:231:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:228:14)
at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:514:10)
at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:480:18)
at Module._compile (internal/modules/cjs/loader.js:1256:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32)
at Function.Module._load (internal/modules/cjs/loader.js:967:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
Looks same as: atom/node-oniguruma#95
npm install
> [email protected] install /Users/mark/projects/hledger-vscode2/node_modules/oniguruma
> node-gyp rebuild
CC(target) Release/obj.target/oniguruma/deps/onig/regcomp.o
CC(target) Release/obj.target/oniguruma/deps/onig/regenc.o
CC(target) Release/obj.target/oniguruma/deps/onig/regerror.o
CC(target) Release/obj.target/oniguruma/deps/onig/regexec.o
CC(target) Release/obj.target/oniguruma/deps/onig/regext.o
CC(target) Release/obj.target/oniguruma/deps/onig/reggnu.o
CC(target) Release/obj.target/oniguruma/deps/onig/regparse.o
CC(target) Release/obj.target/oniguruma/deps/onig/regposerr.o
CC(target) Release/obj.target/oniguruma/deps/onig/regposix.o
CC(target) Release/obj.target/oniguruma/deps/onig/regsyntax.o
CC(target) Release/obj.target/oniguruma/deps/onig/regtrav.o
CC(target) Release/obj.target/oniguruma/deps/onig/regversion.o
CC(target) Release/obj.target/oniguruma/deps/onig/st.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/ascii.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/big5.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/cp1251.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/euc_jp.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/euc_kr.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/euc_tw.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/gb18030.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_1.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_2.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_3.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_4.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_5.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_6.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_7.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_8.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_9.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_10.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_11.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_13.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_14.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_15.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/iso8859_16.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/koi8.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/koi8_r.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/mktable.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/sjis.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/unicode.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/utf16_be.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/utf16_le.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/utf32_be.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/utf32_le.o
CC(target) Release/obj.target/oniguruma/deps/onig/enc/utf8.o
LIBTOOL-STATIC Release/oniguruma.a
CXX(target) Release/obj.target/onig_scanner/src/onig-result.o
CXX(target) Release/obj.target/onig_scanner/src/onig-reg-exp.o
CXX(target) Release/obj.target/onig_scanner/src/onig-scanner.o
../src/onig-scanner.cc:13:82: error: too few arguments to function call, single argument
'context' was not specified
target->Set(Nan::New<String>("OnigScanner").ToLocalChecked(), tpl->GetFunction());
~~~~~~~~~~~~~~~~ ^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:6475:3: note: 'GetFunction'
declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8config.h:431:31: note: expanded
from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/onig-scanner.cc:42:85: error: too few arguments to function call, single argument
'context' was not specified
OnigString* onigString = node::ObjectWrap::Unwrap<OnigString>(info[0]->ToObject());
~~~~~~~~~~~~~~~~~ ^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:2822:3: note: 'ToObject'
declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8config.h:431:31: note: expanded
from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/onig-scanner.cc:61:42: error: no matching member function for call to 'Get'
String::Utf8Value utf8Value(sources->Get(i));
~~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3717:43: note: candidate
function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3720:43: note: candidate
function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
../src/onig-scanner.cc:91:13: error: no matching member function for call to 'Set'
result->Set(Nan::New<String>("index").ToLocalChecked(), Nan::New<Number>(bestResu...
~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/onig-scanner.cc:92:13: error: no matching member function for call to 'Set'
result->Set(Nan::New<String>("captureIndices").ToLocalChecked(), CaptureIndicesFo...
~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/onig-scanner.cc:108:14: error: no matching member function for call to 'Set'
capture->Set(Nan::New<String>("index").ToLocalChecked(), Nan::New<Number>(index));
~~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/onig-scanner.cc:109:14: error: no matching member function for call to 'Set'
capture->Set(Nan::New<String>("start").ToLocalChecked(), Nan::New<Number>(captureStart));
~~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/onig-scanner.cc:110:14: error: no matching member function for call to 'Set'
capture->Set(Nan::New<String>("end").ToLocalChecked(), Nan::New<Number>(captureEnd));
~~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/onig-scanner.cc:111:14: error: no matching member function for call to 'Set'
capture->Set(Nan::New<String>("length").ToLocalChecked(), Nan::New<Number>(captur...
~~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/onig-scanner.cc:112:15: error: no matching member function for call to 'Set'
captures->Set(index, capture);
~~~~~~~~~~^~~
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/mark/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
10 errors generated.
make: *** [Release/obj.target/onig_scanner/src/onig-scanner.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/Cellar/node/14.7.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mark/projects/hledger-vscode2/node_modules/oniguruma
gyp ERR! node -v v14.7.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN [email protected] No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mark/.npm/_logs/2020-08-23T02_17_52_582Z-debug.log
Currently syntax highlighting seems to be implemented for account names beginning with "income", "assets", "liabilities" etc.
As seen in this hledger tutorial, "revenue" is encouraged as an account name instead of "income" (see images)
I propose addition of "revenue" to the set of keywords which are to be highlighted.
Hey there! I'm trying to install your excellent extension and running into a roadblock on Arch Linux. Your extension does not show up in the extension marketplace!
From my research (microsoft/vscode#108147 (comment)) it seems like Arch Linux's distribution of VSCode uses the Open VSX marketplace instead of Microsoft's.
If you would consider publishing your extension on Open VSX I would be very greatful! Instructions are available here:
Additionally, you can make use of the following Github Action to automatically publish to both Open VSX and the Visual Studio Marketplace. It looks like you are currently experimenting with running your unit tests already, so this may already be in the works.
Thanks!
In the meantime, for anybody else who wants to install this extension on Arch Linux, you can click the "Download Extension" button on the following page to get the .vsix
file and manually install it.
This extension doesn't recognize .timedot
files; is there a way to enable it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.