* Addresses #1184
Currently tag completion only works in the front matter if you type a `#`
character. Adding the suggested tag will then mark the tag as a comment
```markdown
---
tags: #foo #bar
---
```
Update the tag completion provider to recognize if we are in the
front-matter, by using adding two functions to utils.ts. Because the
tag completion intellisense must be summoned with either the `#`
character or the keybinding (typically `ctrl+space`), allow
for 2 outcomes
1. if the tag is prefixed in the front matter with a `#`, remove it when
substituting the tag.
2. If `ctrl-space` is used, recognize we are on the `tags: ` line and
allow for non-`#` prefaced words.
The tag provider only works on the `tags: ` within the `tags: ` key of
the frontmatter. For example
```markdown
---
title: A title
tags:
- foo
- bar
- |
```
(where `|` is the cursor) will provide suggestions for tags.
Outside the `tags:` element, suggestions will not be provided.
```markdown
---
title: A title
tags:
- foo
- bar
dates:
- 2023-01-1
- |
```
* Refactor into functions for front matter & content
Refactor the main provider method into two
sub-functions, one for front matter, one for
regular content. Add helper functions to generate
the `CompletionItems` and to find the start & end
indices of the last match to `#{tag}`.
* Added title param in create-note command
* Added utility functions for commands
* Use create-note command when dealing with placeholders
* Updated open-resource command to new pattern
* Pass workspace.isTrusted to createFilter
* Fixed bug when finding absolute paths in workspace without providing basedir
* open-resource command can also receive `uri` param to skip filtering step
* added tests
* added docs
* Added note filter and a few tests
* Added expression for filters and trusted workspace support
* Consolidate `include` and `exclude` into `path` parameter
* Added documentation
* fixing some unmatched links, daily-note path note, start graphviz/tags/properties clarification
fixed links that didn't actually link to their target, add discussion about creating daily-notes in path based off date, then clarifying notes about styling graph viz and tags while enhancing the note properties descriptions by describing how properties are described and which properties are custom, which are foam-specific, and which are foam-template-specific
* add filter view, default variables to graphviz, and viewing tags in graphviz
graphviz: discuss filter view, add all changeable variables to graph style example, tags: describe viewing tags in the graphviz
* add small note about learning yaml
* last push fixing up some todos
* making recommended changes from PR request
* Reorganize docs folder; isolate dev docs and user docs; integrate foam-template docs
* Rename how-to to getting-started
* Fixup all references
* Fix contribution-guide.md
* Fix asset references
* Fix user/index.md
* Spelling is good.
Thanks @DrakeWhu
* Add note about how to wite docs for foam
* create slugified title variable available in templates
* add test
* add FOAM_SLUG to documentation
* add github-slugger dependency
Co-authored-by: Brian DeVries <brian@brianjdevries.com>
* Add the snippet parsing code from VSCode
From 95be30b3ac
* Remove `override` keyword
This is a TypeScript 4.3 feature, but Foam is not there yet
* Use `SnippetParser` to find Foam variables
* Return `Variable` objects from `findFoamVariables`
* Make `SnippetParser` resolve async
* Implement a `VariableResolver`
* Add start/end positions to `Variable`s
* Substitute based on indices, not regex
* Remove limitation warning from docs
* Merge `FoamVariableResolver` and `Resolver`
* Remove `extraVariablesToResolve`
It was no longer being used for `FOAM_TITLE`, and `FOAM_SELECTED_TEXT` didn't need to have it set either, so long as it appeared in `givenValues`, which it does.
* Add name filter to `resolveVariables`
You cannot call `resolve` on a `Variable` without modifying it, even if your `VariableResolver` doesn't know how to resolve the `Variable`.
For example, a `Transform` with a default value will modify the `Varible`'s `children`, even if the `VariableResolver` does not resolve a value.
Instead, we add a name filter, so that we don't resolve any `Variable`s that aren't Foam variables.
* Return `undefined` when the `VariableResolver` cannot resolve a `Variable`
This is how a `VariableResolver` is supposed to behave in these cases.
* Move variable substitution into `TextmateSnippet`
That way, the Foam `VariableResolver` code doesn't need to keep track of the text, nor interact with the `Variable` `pos`/`endPos`.