I use SyntaxEditor for a SQL editor that we offer in our application. I use adornments to show a custom, inline editor for certain special variable types, directly underneath the variable name in the code. I used to use "intra-text" adornments, because they were all that were available when I wrote the functionality. But these broke badly when I moved to verson 2019. It was difficult to figure out why, but instead of fixing it, I moved to "intra-line" adornments because they seemed to fit my requirements better anyway.
These work fine - usually. I've got a
CollectionTagger that I add tags to, whenever a user clicks a small button that appears next to the variable name. Sometimes, though, when I edit code ahead of the variable, the
TagVersionRange that I've stored in my tagger does not seem to 'adjust' correctly to the edits. I know this because when I click the little button to show my adornment, my
GetTags override returns nothing, because the updated snapshot ranges don't intersect my tag. It's like it's been "left behind" somehow. Here's how I create my
TagVersionRange, when the user clicks the little variable button to bring up the editor:
var snapshotRange = new TextSnapshotRange(_syntaxEditor.Document.CurrentSnapshot, tokenTuple.Item3.TextRange);
Does all this sound right? Do you have a sample that combines a CollectionTagger with an intra-line adornment? I've read the CodeLens sample, but it seems different enough from my case, that I can't get useful wisdom from it. I can't figure out what I'm doing wrong.
[Modified 2 years ago]