From 6134873a5a5328484307403a1ed75625c1fff1cb Mon Sep 17 00:00:00 2001 From: Tillman Jex Date: Thu, 11 Jul 2024 10:53:56 +0200 Subject: [PATCH] fix: default lsp config opts not being rendered (#433) The handlebar templates for lsp completion popovers, were not being escaped. Therefore they were not being rendered in final config generation. --- internal/core/config.go | 8 ++++++-- internal/core/notebook_store.go | 6 +++--- tests/cmd-init-defaults.tesh | 6 +++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/internal/core/config.go b/internal/core/config.go index b35747f..ab6e34d 100644 --- a/internal/core/config.go +++ b/internal/core/config.go @@ -5,9 +5,9 @@ import ( "path/filepath" "strings" + toml "github.com/pelletier/go-toml" "github.com/zk-org/zk/internal/util/errors" "github.com/zk-org/zk/internal/util/opt" - toml "github.com/pelletier/go-toml" ) // Config holds the user configuration. @@ -23,6 +23,10 @@ type Config struct { Extra map[string]string } +// NOTE: config generation occurs in core.Init. The below function is used +// for test cases and as a program level default if the user conf is missing or +// has values missing. + // NewDefaultConfig creates a new Config with the default settings. func NewDefaultConfig() Config { return Config{ @@ -522,7 +526,7 @@ type tomlNoteConfig struct { IDLength int `toml:"id-length"` IDCase string `toml:"id-case"` Exclude []string `toml:"exclude"` - Ignore []string `toml:"ignore"` // Legacy alias to `exclude` + Ignore []string `toml:"ignore"` // Legacy alias to `exclude` } type tomlGroupConfig struct { diff --git a/internal/core/notebook_store.go b/internal/core/notebook_store.go index de195b5..29e17c0 100644 --- a/internal/core/notebook_store.go +++ b/internal/core/notebook_store.go @@ -332,11 +332,11 @@ dead-link = "error" # Customize the completion pop-up of your LSP client. # Show the note title in the completion pop-up, or fallback on its path if empty. -#note-label = "{{title-or-path}}" +#note-label = "\{{title-or-path}}" # Filter out the completion pop-up using the note title or its path. -#note-filter-text = "{{title}} {{path}}" +#note-filter-text = "\{{title}} \{{path}}" # Show the note filename without extension as detail. -#note-detail = "{{filename-stem}}" +#note-detail = "\{{filename-stem}}" # NAMED FILTERS diff --git a/tests/cmd-init-defaults.tesh b/tests/cmd-init-defaults.tesh index 39b16d4..bdeedb0 100644 --- a/tests/cmd-init-defaults.tesh +++ b/tests/cmd-init-defaults.tesh @@ -142,11 +142,11 @@ $ cat .zk/config.toml ># Customize the completion pop-up of your LSP client. > ># Show the note title in the completion pop-up, or fallback on its path if empty. ->#note-label = "" +>#note-label = "\{{title-or-path}}" ># Filter out the completion pop-up using the note title or its path. ->#note-filter-text = " " +>#note-filter-text = "\{{title}} \{{path}}" ># Show the note filename without extension as detail. ->#note-detail = "" +>#note-detail = "\{{filename-stem}}" > > ># NAMED FILTERS