all repos

clerk @ 8dcac8b50c40fbb802c43d17d2c91e46b7087850

missing tooling for ledger/hledger
8 files changed, 20 insertions(+), 22 deletions(-)
test: lsp: align test naming, benchmark warm-up, and helper typo

TestServerHover_DocumentNotFound and TestDefinition_DocumentNotFound
match the TestServer_* convention used by the newer suites; the hover
benchmark now asserts the warm-up request resolved a hover (like the
definition benchmark), and openJouranl is spelled openJournal.
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-08-15 18:59:46 +0300
Authored at: 2026-08-14 12:36:43 +0300
Change ID: vypurvoyqzqvvzwsuzurvuvnlyqkxrnp
Parent: ecdc664
M internal/analyzer/analyzer.go
···
        17
        17
         	Commodities map[string]*CommodityInfo

      
        18
        18
         	Payees      map[string]*PayeeInfo

      
        19
        19
         

      
        20
        
        -	// AccountAliases maps alias names to the account they resolve to, from

      
        21
        
        -	// account "alias" subdirectives and top-level "alias A = B" directives.

      
        22
        
        -	AccountAliases map[string]string

      
        23
        
        -

      
        24
        
        -	// AliasDirectives holds every top-level "alias A = B" directive in entry order.

      
        25
        
        -	AliasDirectives []*ast.AliasDirective

      
        26
        
        -

      
        27
        
        -	AccountNames     []string            // sorted for binary search

      
        28
        
        -	PayeeNames       []string            // sorted, all payee names from directives + usage

      
        29
        
        -	AccountsByPrefix map[string][]string // "expenses:" -> ["expenses:food", "expenses:taxi"]

      
        
        20
        +	AccountAliases  map[string]string     // maps alias names to the account they resovle to

      
        
        21
        +	AliasDirectives []*ast.AliasDirective // holds every top-level "alias A = B" directive in entry order

      
        30
        22
         

      
        31
        
        -	// PayeeTemplates holds the last transaction's postings per payee name.

      
        32
        
        -	PayeeTemplates map[string][]PostingTemplate

      
        
        23
        +	AccountNames     []string                     // sorted for binary search

      
        
        24
        +	PayeeNames       []string                     // sorted, all payee names from directives + usage

      
        
        25
        +	PayeeTemplates   map[string][]PostingTemplate // holds the last transaction's postings per payee name

      
        
        26
        +	AccountsByPrefix map[string][]string          // "expenses:" -> ["expenses:food", "expenses:taxi"]

      
        33
        27
         

      
        34
        28
         	Tags      map[string]*TagInfo

      
        35
        29
         	TagNames  []string // unique tag names, sorted

      
M internal/lsp/diagnostics_test.go
···
        8
        8
         )

      
        9
        9
         

      
        10
        10
         func BenchmarkDiagnostics(b *testing.B) {

      
        11
        
        -	content := openJouranl(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        
        11
        +	content := openJournal(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        12
        12
         	srv := NewServer("test")

      
        13
        13
         

      
        14
        14
         	// Per-edit cost: a fresh loader skips the parse cache, so each iteration re-parses, then lints and groups findings.

      
M internal/lsp/textdocument_definition_test.go
···
        14
        14
         	"olexsmir.xyz/clerk/journal"

      
        15
        15
         )

      
        16
        16
         

      
        17
        
        -func TestDefinition_DocumentNotFound(t *testing.T) {

      
        
        17
        +func TestServer_Definition_DocumentNotFound(t *testing.T) {

      
        18
        18
         	srv := NewServer("test")

      
        19
        19
         	res, err := srv.server.Definition(t.Context(), &protocol.DefinitionParams{

      
        20
        20
         		TextDocumentPositionParams: protocol.TextDocumentPositionParams{

      
M internal/lsp/textdocument_format_test.go
···
        8
        8
         )

      
        9
        9
         

      
        10
        10
         func BenchmarkFormatting(b *testing.B) {

      
        11
        
        -	content := openJouranl(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        
        11
        +	content := openJournal(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        12
        12
         

      
        13
        13
         	srv := NewServer("test")

      
        14
        14
         	srv.server.openDoc(uri.URI("file:///test.journal"), content, 1, "journal")

      
M internal/lsp/textdocument_hover_test.go
···
        94
        94
         }

      
        95
        95
         

      
        96
        96
         func BenchmarkHover(b *testing.B) {

      
        97
        
        -	content := openJouranl(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        
        97
        +	content := openJournal(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        98
        98
         

      
        99
        99
         	srv := NewServer("test")

      
        100
        100
         	srv.server.openDoc(uri.URI("file:///test.journal"), content, 1, "journal")

      ···
        117
        117
         				},

      
        118
        118
         			}

      
        119
        119
         

      
        120
        
        -			// warm up

      
        121
        
        -			if _, err := srv.server.Hover(b.Context(), params); err != nil {

      
        
        120
        +			// warm up: assert the cursor resolved to a hover

      
        
        121
        +			res, err := srv.server.Hover(b.Context(), params)

      
        
        122
        +			if err != nil {

      
        122
        123
         				b.Fatal(err)

      
        
        124
        +			}

      
        
        125
        +			if res == nil {

      
        
        126
        +				b.Fatalf("%s: no hover", tname)

      
        123
        127
         			}

      
        124
        128
         			b.ReportAllocs()

      
        125
        129
         			b.ResetTimer()

      
M internal/lsp/textdocument_references_test.go
···
        67
        67
         }

      
        68
        68
         

      
        69
        69
         func BenchmarkReferences(b *testing.B) {

      
        70
        
        -	content := openJouranl(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        
        70
        +	content := openJournal(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        71
        71
         

      
        72
        72
         	srv := NewServer("test")

      
        73
        73
         	u := uri.URI("file:///test.journal")

      
M internal/lsp/textdocument_semantic_test.go
···
        221
        221
         }

      
        222
        222
         

      
        223
        223
         func BenchmarkSemanticTokens(b *testing.B) {

      
        224
        
        -	content := openJouranl(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        
        224
        +	content := openJournal(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        225
        225
         

      
        226
        226
         	// Cold path: each iteration re-parses and re-encodes, as after an edit.

      
        227
        227
         	b.ReportAllocs()

      ···
        232
        232
         	}

      
        233
        233
         }

      
        234
        234
         

      
        235
        
        -func openJouranl(t testing.TB, path string) string {

      
        
        235
        +func openJournal(t testing.TB, path string) string {

      
        236
        236
         	t.Helper()

      
        237
        237
         	src, err := os.ReadFile(path)

      
        238
        238
         	if err != nil {

      
M internal/lsp/workspace_symbol_test.go
···
        81
        81
         }

      
        82
        82
         

      
        83
        83
         func BenchmarkSymbols(b *testing.B) {

      
        84
        
        -	content := openJouranl(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        
        84
        +	content := openJournal(b, "../../journal/testdata/journals/actual-1ktxns-100accts.journal")

      
        85
        85
         

      
        86
        86
         	srv := NewServer("test")

      
        87
        87
         	u := uri.URI("file:///test.journal")