-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat(extmark): window scoped namespace #27361
Conversation
90c840f
to
7a23819
Compare
Alternative representation: for each decoration, just store a single bit (in the flags field for the extmark) whether this is a "scoped" extmark. then for each window, store a set of all the active namespaces from which scoped extmarks are considered. It is less granular in one way (either all or nothing of scoped marks in a namespace is visible) but a lot more flexible in another (a given extmark category can be displayed in a subset of windows, not just one). |
I thought about instead of having a scoped option for the extmark; have a scoped option for the namespace, as I don't see many people creating a namespace with a combination of scoped and unscoped extmarks. |
ffaf361
to
2d82edb
Compare
0883afc
to
f58c8b9
Compare
That might be an option as well.
That's mostly a consequence of just a single item of info being used currently. changing that to a struct would be fine if we go that path. |
87a7bf0
to
a2ba753
Compare
a2ba753
to
b04dcb0
Compare
e7b380e
to
0451e89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM. thanks for looking into this.
I don't really favor the current PR so I thought a bit more about whether it would be better to have the namespaces themselves be scoped and this is what I came up with (only a proposal): Each namespace would have some scopes. By default(if there are no scopes set) the namespace would fallback to the default behavior (which is that namespace-highlight won't be displayed anywhere and extmarks would be displayed everywhere). If multiple scopes are set then they are a union instead of an intersection. These are the scopes:
The affected namespace elements would be: buffer-local-extmark(and any other future extmark) and namespace-highlight. Some api for this (not final design):
Depreciated api functions and their replacements:
NOTE: I won't implement namespace-highlight in this PR (if the proposal is good to go). If you're okay with this proposal then signal so that I can start working on it. |
7868823
to
ce88b44
Compare
Hmm, I'd still like to just get window-scoped extmarks merged first and then extend upon it as needed. As far as I can tell this PR by itself is mostly forward-compatible with this extended proposal. The only difference I think is if we want to "mark" each individual extmark as scoped, or as you say, mark the entire namespace as scoped and then need to opt-in to it in specific windows.
IMO I would first merge this pr pretty much as-is so that plugin authors can play with it. From there one we can gather feedback of what add-on features are mostly desired. |
Then this PR is ready to merge. |
ce88b44
to
660ff88
Compare
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
660ff88
to
1c032ad
Compare
• scoped: boolean that indicates that the extmark should | ||
only be displayed in the namespace scope. (experimental) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extra flag seems kind of random. It allows opt-ing out ("ignore the scopes for the given namespace"). If you don't want an extmark to obey the properties of its namespace, why not create a separate namespace ?
Edit: #28469
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If opting out is not allowed, that means an extmark will be invisible until its namespace is added to a window, which is undesirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an extmark will be invisible until its namespace is added to a window
Why must it be like that? If a namespace has no "window scopes", can't we assume it has "all windows" scope?
💯 Alternatively, we could use options/variables ( |
By @bfredl suggestion #27361 (comment):
Make namespaces have the possibility of being window-local (only show the namespaces's extmarks in specific windows).
Currently, one needs to set a flag on the extmark (called
scoped
) to make this take effect (may be changed).Closes #19654