dendron icon indicating copy to clipboard operation
dendron copied to clipboard

Wildcard in reference matches all lower levels as well

Open derpda opened this issue 3 years ago • 5 comments

Please select the area your bug applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

  • [ ] Workspace. VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
  • [ ] Lookup. Dendron's Lookup Command
  • [X] Views. Dendron Preview, Tree View, Side Panels in the UI
  • [ ] Schema. Dendron Schemas
  • [ ] Pod. Data import from / export to Dendron
  • [ ] Publish. External Site Publish
  • [X] Markdown. Markdown features, such as syntax support and features

Describe the bug

According to the Dendron docs, one can use

[...] the * operator at the end which lets you grab all notes of a given level of hierarchy

in a note reference, for example as below:

![[reference-test.hierarchy-matching.*]]

However, the * seems to also match all child notes deeper down the hierarchy, in contradiction to the documentation.

I hope I haven't missed an existing issue on this, or maybe something in the documentation.

To Reproduce

Steps to reproduce the behavior:

  1. Create new Dendron Code Workspace
  2. Create some hierarchy of nodes, for example
├── dendron.code-workspace
├── dendron.yml
└── notes
    ├── assets
    ├── reference-test.desired-note-1.md
    ├── reference-test.desired-note-1.undesired-note.md
    ├── reference-test.desired-note-2.md
    ├── reference-test.desired-note-2.undesired-note.md
    ├── reference-test.md
    ├── root.md
    └── root.schema.yml
  1. Try to reference the desired nodes with ![[reference-test.hierarchy-matching.*]] in reference-test.md
  2. See undesired notes show up in Dendron: Show Preview window of reference-test.md

Expected behavior

Only reference-test.hierarchy-matching.desired-note-2.md and reference-test.hierarchy-matching.desired-note-1.md should match the reference.

Screenshots

2022-07-12-17:40:41-screenshot

Desktop (please complete the following information)

  • OS: Arch Linux (5.18.9-arch1-1)
  • Browser (if with published websites; include version): [e.g. chrome, safari]
  • Versions (all that apply to bug):
    • Dendron Extension: v0.102.0
    • VS Code version: 1.69.0
    • Dendron CLI: N/A

Additional context

N/A

Dendron Log file

Dendron Log Output

{"level":30,"time":1657615445466,"pid":199555,"hostname":"x1","name":"dendron","ctx":"Logger:configure","msg":"exit","logLevel":"info"}
{"level":30,"time":1657615445516,"pid":199555,"hostname":"x1","name":"dendron","ctx":"_activate","stage":"prod","isDebug":false,"logLevel":"info","logPath":"/home/peter/.config/Code/logs/20220712T093408/exthost7/dendron.dendron","extensionPath":"/home/peter/.vscode/extensions/dendron.dendron-0.102.0","extensionUri":"/home/peter/.vscode/extensions/dendron.dendron-0.102.0","workspaceFile":"/home/peter/dev/sandbox/DendronTest/dendron.code-workspace","workspaceFolders":["/home/peter/dev/sandbox/DendronTest/notes"]}
{"level":30,"time":1657615445518,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"No cache path for Segment specified. Failed event uploads will not be retried."}
{"level":30,"time":1657615445518,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"user telemetry setting: enabled by config"}
{"level":30,"time":1657615445518,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"telemetry initializing"}
{"level":30,"time":1657615445518,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"using existing id"}
{"level":30,"time":1657615445518,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"anonymous id","anonymousId":"vyka0s4hlqb36mss8u2m02l"}
{"level":30,"time":1657615445522,"pid":199555,"hostname":"x1","name":"dendron","ctx":"DendronExtension","msg":"initialized"}
{"level":30,"time":1657615445637,"pid":199555,"hostname":"x1","name":"dendron","ctx":"_activate","msg":"initializeWorkspace","wsType":"CODE","currentVersion":"0.102.0","previousGlobalVersion":"0.102.0","extensionInstallStatus":"NO_CHANGE"}
{"level":30,"time":1657615445642,"pid":199555,"hostname":"x1","name":"dendron","ctx":"WorkspaceActivator.init:postSetupTraits","wsRoot":"/home/peter/dev/sandbox/DendronTest"}
{"level":30,"time":1657615445647,"pid":199555,"hostname":"x1","name":"dendron","ctx":"runMigrationsIfNecessary","changes":[],"workspaceInstallStatus":"NO_CHANGE"}
{"level":30,"time":1657615445648,"pid":199555,"hostname":"x1","name":"dendron","ctx":"WorkspaceActivator.init:postMigration","wsRoot":"/home/peter/dev/sandbox/DendronTest"}
{"level":30,"time":1657615445653,"pid":199555,"hostname":"x1","name":"dendron","ctx":"WorkspaceActivator.init:postWsServiceInitialize","wsRoot":"/home/peter/dev/sandbox/DendronTest"}
{"level":30,"time":1657615445658,"pid":199555,"hostname":"x1","name":"execServer","state":"enter"}
{"level":30,"time":1657615445667,"pid":199555,"hostname":"x1","name":"execServer","state":"post:exec.node"}
{"level":30,"time":1657615446406,"pid":199624,"hostname":"x1","name":"SegmentClient","msg":"No cache path for Segment specified. Failed event uploads will not be retried."}
{"level":30,"time":1657615446407,"pid":199624,"hostname":"x1","name":"SegmentClient","msg":"user telemetry setting: enabled by config"}
{"level":30,"time":1657615446407,"pid":199624,"hostname":"x1","name":"SegmentClient","msg":"telemetry initializing"}
{"level":30,"time":1657615446407,"pid":199624,"hostname":"x1","name":"SegmentClient","msg":"using existing id"}
{"level":30,"time":1657615446407,"pid":199624,"hostname":"x1","name":"SegmentClient","msg":"anonymous id","anonymousId":"vyka0s4hlqb36mss8u2m02l"}
{"level":30,"time":1657615447107,"pid":199555,"hostname":"x1","name":"execServer","state":"message","message":"42967"}
{"level":30,"time":1657615447107,"pid":199555,"hostname":"x1","name":"dendron","ctx":"WSUtils.handleServerProcess","msg":"subprocess running","pid":199624}
{"level":30,"time":1657615447107,"pid":199555,"hostname":"x1","name":"dendron","ctx":"startServerProcess","msg":"post-start-server","port":42967,"durationStartServer":1452}
{"level":30,"time":1657615447108,"pid":199555,"hostname":"x1","name":"dendron","ctx":"WorkspaceActivator.init:verifyOrStartServerProcess","port":42967}
{"level":30,"time":1657615447110,"pid":199555,"hostname":"x1","name":"logger","ctx":"FileStorageV2","wsRoot":"/home/peter/dev/sandbox/DendronTest","vaults":[{"fsPath":".","selfContained":true,"name":"DendronTest"}],"level":"info"}
{"level":30,"time":1657615447110,"pid":199555,"hostname":"x1","name":"dendron","ctx":"WorkspaceActivator.init:exit"}
{"level":30,"time":1657615447111,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"user telemetry setting: enabled by config"}
{"level":30,"time":1657615447111,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"telemetry initializing"}
{"level":30,"time":1657615447111,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"using existing id"}
{"level":30,"time":1657615447112,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"anonymous id","anonymousId":"vyka0s4hlqb36mss8u2m02l"}
{"level":30,"time":1657615447112,"pid":199555,"hostname":"x1","name":"dendron","msg":"Telemetry is disabled? false"}
{"level":30,"time":1657615447112,"pid":199555,"hostname":"x1","name":"dendron","msg":"Segment Residual Cache Path is at /home/peter/.config/Code/User/globalStorage/dendron.dendron/segmentresidualcache.log"}
{"level":30,"time":1657615447112,"pid":199555,"hostname":"x1","name":"SegmentClient","msg":"Attempting to flush residual segment data from file."}
{"level":30,"time":1657615447113,"pid":199555,"hostname":"x1","name":"dendron","ctx":"_activate:postSetupWorkspace","platform":"linux","extensions":[{"id":"dendron.dendron","version":"0.102.0","active":true},{"id":"dendron.dendron-paste-image","version":"1.1.0","active":false},{"id":"dendron.dendron-markdown-shortcuts","version":"0.12.1","active":true},{"id":"redhat.vscode-yaml","version":"1.8.0","active":false}],"vaults":[{"fsPath":".","selfContained":true,"name":"DendronTest"}]}
{"level":30,"time":1657615447126,"pid":199555,"hostname":"x1","name":"dendron","ctx":"TreeView:getChildren","msg":"reconstructing tree: enter"}
{"level":30,"time":1657615447126,"pid":199555,"hostname":"x1","name":"dendron","ctx":"TreeView:getChildren","msg":"reconstructing tree: exit"}
{"level":30,"time":1657615447127,"pid":199555,"hostname":"x1","name":"dendron","ctx":"dendron.reloadIndex:run","msg":"pre-execute"}
{"level":30,"time":1657615447127,"pid":199555,"hostname":"x1","name":"dendron","ctx":"ReloadIndex.execute","msg":"enter"}
{"level":30,"time":1657615447174,"pid":199555,"hostname":"x1","name":"dendron","msg":"Segment Residual Cache flush attempted. {\"successCount\":0,\"nonRetryableErrorCount\":0,\"retryableErrorCount\":0}"}
{"level":30,"time":1657615447195,"pid":199624,"hostname":"x1","name":"logger","ctx":"parsingSchemas","fname":"root","root":{"fsPath":".","selfContained":true,"name":"DendronTest"},"imports":[]}
{"level":30,"time":1657615447294,"pid":199624,"hostname":"x1","name":"LinkUtils.getLinks","ctx":"getLinks","dlinksLength":1,"noteRefsLength":1,"wikiLinksLength":0}
{"level":30,"time":1657615447309,"pid":199624,"hostname":"x1","name":"LinkUtils.getLinks","ctx":"getLinks","dlinksLength":0,"noteRefsLength":0,"wikiLinksLength":0}
{"level":30,"time":1657615447314,"pid":199624,"hostname":"x1","name":"LinkUtils.getLinks","ctx":"getLinks","dlinksLength":0,"noteRefsLength":0,"wikiLinksLength":0}
{"level":30,"time":1657615447319,"pid":199624,"hostname":"x1","name":"LinkUtils.getLinks","ctx":"getLinks","dlinksLength":0,"noteRefsLength":0,"wikiLinksLength":0}
{"level":30,"time":1657615447329,"pid":199624,"hostname":"x1","name":"LinkUtils.getLinks","ctx":"getLinks","dlinksLength":0,"noteRefsLength":0,"wikiLinksLength":0}
{"level":30,"time":1657615447338,"pid":199555,"hostname":"x1","name":"dendron","ctx":"ReloadIndex.execute","durationEngineInit":208}
{"level":30,"time":1657615447338,"pid":199555,"hostname":"x1","name":"dendron","ctx":"ReloadIndex.execute","msg":"exit"}
{"level":30,"time":1657615447338,"pid":199555,"hostname":"x1","name":"dendron","ctx":"dendron.reloadIndex:run","msg":"post-execute"}
{"level":30,"time":1657615447342,"pid":199555,"hostname":"x1","name":"dendron","ctx":"reloadWorkspace","msg":"post-ws.reloadWorkspace"}
{"level":30,"time":1657615447342,"pid":199555,"hostname":"x1","name":"dendron","ctx":"reloadWorkspace","msg":"exit"}
{"level":30,"time":1657615447343,"pid":199555,"hostname":"x1","name":"dendron","ctx":"postReloadWorkspace","msg":"same wsVersion"}
{"level":30,"time":1657615447343,"pid":199555,"hostname":"x1","name":"dendron","ctx":"postReloadWorkspace","msg":"exit"}
{"level":30,"time":1657615447343,"pid":199555,"hostname":"x1","name":"dendron","ctx":"setupViews","msg":"init:treeViewV2"}
{"level":30,"time":1657615447343,"pid":199555,"hostname":"x1","name":"dendron","ctx":"setupBacklinkTreeView","msg":"init:backlinks"}
{"level":30,"time":1657615447364,"pid":199555,"hostname":"x1","name":"dendron","ctx":"WorkspaceActivator:activate","msg":"fin startClient","durationReloadWorkspace":217}
{"level":30,"time":1657615447364,"pid":199555,"hostname":"x1","name":"dendron","ctx":"activateWorkspace","stage":"prod","msg":"enter"}
{"level":30,"time":1657615447365,"pid":199555,"hostname":"x1","name":"dendron","ctx":"togglePluginActiveContext","state":"togglePluginActiveContext: true"}
{"level":30,"time":1657615447367,"pid":199555,"hostname":"x1","name":"dendron","ctx":"showWelcomeOrWhatsNew","version":"0.102.0","previousExtensionVersion":"0.0.0"}
{"level":30,"time":1657615447431,"pid":199555,"hostname":"x1","name":"dendron","ctx":"updateDecorations","payload":{"error":null,"decorationsLength":3,"diagnosticsLength":0}}
{"level":30,"time":1657615450601,"pid":199555,"hostname":"x1","name":"dendron","ctx":"dendron.showPreview:run","msg":"pre-execute"}
{"level":30,"time":1657615450672,"pid":199555,"hostname":"x1","name":"dendron","ctx":"dendron.showPreview:run","msg":"post-execute"}
{"level":30,"time":1657615453040,"pid":199555,"hostname":"x1","name":"dendron","ctx":"dendron.dev.openLogs:run","msg":"pre-execute"}
{"level":30,"time":1657615453040,"pid":199555,"hostname":"x1","name":"dendron","ctx":"execute","opts":{}}
{"level":30,"time":1657615453050,"pid":199555,"hostname":"x1","name":"dendron","ctx":"dendron.dev.openLogs:run","msg":"post-execute"}

derpda avatar Jul 12 '22 08:07 derpda

Thank you for the report @derpda

This currently is how wildcard note references work, and the document is misleading. Sorry about that. There has been requests in the past to change the behavior or note references to be like what you described, but I believe this is the first github issue for it.

We have plans to make note referencing more flexible (see https://docs.dendron.so/notes/O4f9yfDoO7E7gRRDeBeCh/), but we don't have a solid ETA on this yet.

In the meantime, we'll fix the document so that it explains this behavior correctly. Do you mind if I change this into a enhancement instead of a bug? Until we have a plan to implement the aforementioned querying capabilities I think changing the wildcard reference behavior would be a good interim solution.

hikchoi avatar Jul 13 '22 13:07 hikchoi

@hikchoi, would this be a related issue?

  • https://github.com/dendronhq/dendron/issues/1633

aleksey-rowan avatar Jul 13 '22 14:07 aleksey-rowan

@hikchoi, would this be a related issue?

  • https://github.com/dendronhq/dendron/issues/1633

Not exactly, as that issue pertains to the header levels, not hierarchies. (and I think this is now fixed with smart header references released last week)

But I understand how it can be seen as an extension to that issue. I can't recall on top of my head if it shares the same logic though.

hikchoi avatar Jul 13 '22 14:07 hikchoi

@hikchoi Thank you for the explanation! It would indeed be good if the documentation reflected the current behavior more clearly.

Changing this to an enhancement is fine by me!

derpda avatar Jul 13 '22 14:07 derpda

@derpda

Awesome. I'll let you know here when the document is updated and also change this to an enhancement

hikchoi avatar Jul 14 '22 13:07 hikchoi