Closed gep13 closed 7 years ago
Yup. ~ syntax like Visual Studio snippets :-) It's one of the things that's on my list. Requires dealing with the selection range that can be a bit tricky and requires some explicit code in the editor.js code.
So added this in ad02ec150392dde9b2b90efab84d247edd6ffa72
@{
var file = Path.GetFileNameWithoutExtension(
Model.ActiveDocument.Filename);
file = StringUtils.FromCamelCase(file);
file = file.Replace("-"," ");
}---
Title: @file
Timestamp: @DateTime.Now.ToString("MMM dd, yyyy HH:mm")
Tags:
- ~
---
The ~
determines where the cursor goes if specified.
It's in 0.2, but this change also requires an update to MM 1.1.18
Sweet! Will take this for a spin later.
Just got this...
After updating to 1.1.18, and re-installing the addin.
Hmmm... that looks like a different OLD version. 1.0.28. You should be on 1.1.18.
And yes the updated addin requires the newer build.
Can you send me your last error log entries that pertain to that error? I might be able to block off the code that won't run in older versions. I lost track :-)
Ok installed older version and re-ran and was able to figure out what was not working - bracketed the new code so it should work now. Update the addin.
I think I see the problem...
Looks like there is an issue with the mm.exe/bat:
If I run mm, I don't get version 1.1.18.
Ah - yes. This was due to the switch to the 32 bit version. You probably didn't uninstall the old version when the switch came and Mm is probably still looking at the old \program files\ path.
To fix:
You should end up with only the new version and path pointing at \program files (x86)\Markdown Monster.
That was a sucky thing to have to do but there was no way around that. It was in the update notice and docs to do a full uninstall firs then reinstall, but of course nobody actually reads that :-)
Yeah, that did it:
Yip, I never read that part, just did a choco upgrade
. If this needs to happen again, you could add a chocolateyBeforeModify.ps1 script, to do a full uninstall of the application, if currently installed.
@RickStrahl ok, now we are getting somewhere. I am running this:
and this:
And this is my snippet definition:
But after adding bfm
I get this:
Hmmm... that should work. I just installed 1.1.18 from Choco, unloaded the existing addin and reloaded it and it works for me. You did restart MM after installing the updated addin right? Since addins load in memory a restart is required.
FWIW, there are a bunch of updates coming to the Addin Manager and addin handling in general in the next update (1.1.20 most likely).
that will hopefully make updates a little less painful than they are right now.
@RickStrahl yip, multiple restarts. I have this morning uninstalled all addins, and then re-installed them, but the same thing happens. I wondered if it was something to do with the fact that I was using the vim emulation layer for the editor, but turning the on/off didn't result in any difference either. The ~
was still output into the document, rather than replacing it with cursor.
I will try again once new MM is published.
1.1.19 is out on the Web site (not on Choco yet). I can confirm with 1.1.19 and 0.2.3 installed the ~ is working for me in expansions.
The fact that the ~ is still in the output is probably a dead giveaway, you're not running the latest addin as the ~ is replaced even before the cursor movement.
Is the addin showing up more than once in your Addin list? I fixed the naming to be consistent so it's possible that a new install will not remove the old one.
To fix manually:
%appdata%\Addins
Remove all Snippets looking addins
%programfiles%\Markdown Monster\Addins
Remove all Snippets looking addins
Nope, only showing up once in Addins list.
I have just cleared out the folders that you suggested. Updated to latest MM. Re-installed Snippets addin and still get the same thing. The ~ is still output, and cursor is not where it is expected to be 😢
I mean on the toolbar. There's an icon - (pen in a box). Is that there more than once?
This one:
@RickStrahl thanks again! This is now resolved.
Thanks for your help and persistance on this.
After adding the snippet, my cursor is here:
Is it possible to define within the snippet where the cursor should go? Ideally, I would end up here:
After adding the snippet so that I can immediately add the tags for the post.