Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline snippets in folders #45

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Conversation

TinyAtoms
Copy link

Here is a working proof of concept of what I wanted and how multiline snippets could be implemented.
It is not in a state where it should be merged yet. No error handling to speak of, no tests, etc.
I do want to know what you think of this method of implementation, and suggestions on how you would do it.
My alternative method was going to be using something like using something like

file : TAbstractFile = this.app.metadataCache.getFirstLinkpathDest(this,settings.multilineFolder +selectedText, "");
newstr = this.app.vault.cachedRead(file).then((content) => this.mlSnippets[file.basename] = content);
if (newStr == null) newstr = ""

in findSnippet. My reasoning for not doing it that way is that it might produce noticable delays after trying to insert.

TinyAtoms and others added 5 commits May 10, 2022 12:41
Multiline snippets can now be defined as files in a watched folder

multiline snippets using the old way might not function correctly
@ArianaKhit
Copy link
Owner

My reasoning for not doing it that way is that it might produce noticable delays after trying to insert.

Can multiline snippets be loaded to snippets variable in settings, so delays will be less?

@TinyAtoms
Copy link
Author

You could, but then you'd lose the simplicity of that, and would be doing something like what I'm doing in the PR. The simplicity in directly reading it from the file is that you don't have to monitor the multiline snippet folder. As soon as you move it in memory, you'd have to make sure that your in-memory copy reflects that folder, so you'd have to monitor it.

@ArianaKhit
Copy link
Owner

Then I think this method will be just fine, you can use one of the latest versions of the code, without errors while loading the plugin in Live Preview, if you want to test it

@willow512
Copy link

Is there progress on this issue? I'm very much looking forward to use this feature. :)

TinyAtoms and others added 2 commits June 13, 2022 22:06
Make code work with upstream changes
chore: 🔨 Add upstream changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants