It's the idea from the so-called "inline suggestion" feature where it shows code insertion hint right after the caret. This may be something like a combination of EOL annotation + normal multi-line annotation, but with syntax coloring (probably dimmed?).
Styling of annotations is possible with SCI_ANNOTATIONSETSTYLES and the same feature could be implemented for EOL annotations since they share code.
This still requires choosing styles, perhaps by lexing in an invisible document+window or preparing before hand in a configuration file.
Perhaps first try a single inline annotation with both pieces of text to see how it works before the more complex work of adding styling to EOL annotations. It should be possible to produce the simplified feature just with client application code.
My experience with EOL annotation is that it always has one space before the annotation, it would be nicer if that space can be optionally removed to better create the "inline" effect.
Based on your comment, my understanding is that for now I can try to produce the feature with a EOL annotation (but without syntax color). When there's multiple line of text, I will also need a few more SCI_ANNOTATIONSETTEXT.
I understand this may require more hard work, but still it would be nice to have this as an infrastructure feature built in scintilla.
There is an 'end-of-line-selection' space after the last character on a line. If you select over the line end (such as selecting two lines) that space shows the selection background colour. While the size of that space could be modifiable, setting to zero or very small would affect other lines in a way that would likely confuse users. Moving that space after the EOL annotation would mean that it is less likely to be visible as EOL annotations often continue past the left edge of the window. There is already a proposal to set the width [feature-requests:#1356]. Perhaps there could be a choice on each EOL annotation to eliminate the space just on that line.
Another approach would be to implement 'virtual text' that can add text at any point in the document. Unfortunately, implementing this is complex and difficult. [feature-requests:#969]
This appears to me to be a feature that is partly implemented in Scintilla and partly in the application and the subdivision of the feature into the pieces on each side and the shape of the boundary will be the main task. Scintilla commonly implements small features that can be combined into larger user-level features by the application.
This feature request includes 'syntax coloring' but a full implementation is outside the scope of Scintilla and likely needs orchestrating by the application. A more implementable item would be 'styled text' as is described for SCI_ANNOTATIONSETSTYLES.
Related
Feature Requests: #1356
Feature Requests: #969
I just did a simple test with a pseudocode, then realized that or tab \t seems to be removed or not drawn. This will be a problem for inline completion.
Then I also had an idea: what if scintilla can simply allow me to draw custom annotation content?
We call a function in scintilla to allocate for an annotation space for EOL and lines below it, and we provide a call back or something that can be invoked when needed to paint whatever content we want. Then in theory we can create a hidden scintilla editor, set the text and apply styling, then print it to the space with given drawn context.
Over time, Scintilla's drawing subsystem has evolved towards greater modularity to try to allow adding new independent features more easily. New features, however, tend to require access to significant contextual data in ways that were not envisioned by the design hence requiring infrastructure work. Putting new feature code in a callback moves it further away from potential context data leading to new requirements on the callback mechanism and heavy support costs. It also makes it more difficult to implement new drawing techniques like multi-threading and better scaling support.
It you want to have your application perform drawing, then it should use independent windows.
Because tabs are not drawn, I cannot use the current annotation API to implement a workable inline completion
Last edit: yonken 4 days ago
Why is this a problem?
Since tabs are not expanded, I have no idea how to implement the inline completion effect as shown in the InlineAnnotation.png...
Tabs can be replaced with spaces.