Add config option to control whether tooltips are displayed for linter decorations #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "lint-decoration-tooltip-config-option"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In some circumstances, it would be useful to suppress tooltips for linter decorations within the editor content and rely instead on tooltips for gutter markers. This adds a configuration option to do that.
Is there a reason to use a separate facet here, rather than including this option in
lintSource(possibly renaming it tolintConfig)?I think it would be fine to combine this one option into
lintSourceif you'd prefer that, and looking at it now, I agree that it doesn't seem correct to havedelayin both facets.For context, there are two things we're trying to achieve:
We can achieve the first with this
showTooltipsoption and we can achieve the second simply but somewhat hackily by styling warning markers in the content to be invisible.I extracted this PR from a larger set of new config options I was experimenting with that enable and disable decorations both at the severity level and independently in the gutter and editor content, which seems to me like a different concern to a list of sources of diagnostics.
How about allowing
showTooltipsto be either a boolean or a(tooltip: Tooltip, type: "gutter" | "code") => booleanpredicate? Hiding these with CSS seems a bit wasteful.(Or actually the boolean part wouldn't make much sense, just a predicate would work well I suppose.)
That would work for us for tooltips. I think having the array of
Diagnostics available to the predicate would also be helpful: it would allow hiding of the tooltip based on the severity of the diagnostics. It could go further by instead having a diagnostics filter function; I can imagine we might decide we'd want to filter out warnings from the tooltip if there the were errors as well. Something like(diagnostics: Diagnostic[], type: "gutter" | "code") => Diagnostic[], calledtooltipDiagnosticFiltermaybe?A similar
showMarkerspredicate for markers would be ideal and remove the need to hide warning markers via CSS.Oh, right, my
Tooltipargument there was nonsense, we want to pass diagnostics, not tooltips. Your type sounds good.I've implemented
tooltipDiagnosticFilterandmarkerDiagnosticFilterconfig options. I've also merged the lint source and config facets, but I'm really not convinced by how I've implemented that part. I wasn't sure what the best way to combine values would be, given that sources should be additive and configs should be merged.One other contextual thing I've forgotten to mention that is that the "we" above is Overleaf, who I now work for.
Reading the patch, I realized it might be clearer to pass separate filters options the config to
linterand the config tolintGutter, and do away with the second argument to the filters. Also, I'd prefer shorter option names likemarkerFilterandtooltipFilter.Done. I agree that having separate filter options in the gutter config seems better.
Thanks! I've merged this as
79aee39555Pull request closed