Sublime Forum

Dev Build 3070

#61

Yeah, I noticed this with scopehunter and started to strip out CRs. But I do think that should just be done internally by sublime.

Being able to define a border would do wonders. In OSX, you already get a shadow, so it’s actually not too bad unless you have really dark colors, but on windows, you get no shadow, no border and it all just blends in if you make your colors too close. I even tried adding a border…but the CSS doesn’t support borders :frowning:.

0 Likes

#62

[quote=“facelessuser”]

Yeah, I noticed this with scopehunter and started to strip out CRs. But I do think that should just be done internally by sublime.

Being able to define a border would do wonders. In OSX, you already get a shadow, so it’s actually not too bad unless you have really dark colors, but on windows, you get no shadow, no border and it all just blends in if you make your colors too close. I even tried adding a border…but the CSS doesn’t support borders :frowning:.[/quote]

Maybe this works:

html {
    background-color: /* your border color */
}
body {
    background-color: /* regular bg color */
    margin: 1px;
}
0 Likes

#63

It does, but it’s just an workaround. We kind of aim for a consistent experience (that’s why i think styling - at least colors and absolute font sizes - should be made mostly by the theme, otherwise we will expect 5 styles of tooltips from 5 different plugins)

0 Likes

#64

Yep, I kind of agree with this. There needs to be some kind of standardized styling with some standard classes and such that are included in a theme. And then maybe a plugin can inject some additional style if the themes standard style just doesn’t fit what a plugin is doing. That way plugins would have a seemingly consistent tooltip experience across the board.

[quote=“maliayas”]Maybe this works:

CODE: SELECT ALL
html {
background-color: /* your border color /
}
body {
background-color: /
regular bg color */
margin: 1px;
}
[/quote]

Yep as @imantz said, it works. I was trying to find something other than going this route. If the tool tip content doesn’t scroll, it’s not bad, but if you have scrollable content, you won’t see a border on one or more sides until you scroll all the way in that direction.

0 Likes

#65

goto_definition seems broken.

I hit my goto_definition keybind, and it pops up a list of places where it found a definition for my function.
For example, let’s say it found function “foo()” in “file1.c”, “file2.c”, and “file3.c”.
file1.c is highlighted in the popup panel, but the temporary buffer that’s being shown is the match from file2.c. If just hit enter now (because the temporary buffer is showing me the code I want from file2.c), then it opens up file1.c.

As soon as I press the up or down arrow to change the selection, everything becomes fine (if I press the up arrow, index 0 is still highlighted, and the preview buffer now correctly loads file1.c – or if I press the down arrow, index 1 is now highlighted, and the preview buffer doesn’t change – it’s still showing file2.c)

0 Likes

#66

View.update_popup() does this, except for the reposition part.

[quote]4) You should add a default styling as following:

  • font-size: .7em (or .8em); and be relative to the font-size defined in settings (also, you should remove pixels as font-size unit because it can lead to very unreadable/weird tooltips)[/quote]

Font size is already matched to the current view. This may not happen on Windows if you’re using direct write or HiDPI settings, I haven’t checked there.

0 Likes

#67

I have a hunch that this question came up before, but if so, then I’ve been unable to find it … how do I learn more about the arguments to show_pop?

For example, what’s the argument on_navigate doing? The initial example uses on_navigate=print, but I couldn’t see a difference between using that and using on_navigate=None.

The (un)official documentation appears to not have been updated yet - is there some other way of exploring the API?

0 Likes

#68

[quote=“scmalte”]I have a hunch that this question came up before, but if so, then I’ve been unable to find it … how do I learn more about the arguments to show_pop?

For example, what’s the argument on_navigate doing? The initial example uses on_navigate=print, but I couldn’t see a difference between using that and using on_navigate=None.

The (un)official documentation appears to not have been updated yet - is there some other way of exploring the API?[/quote]

The on_navigate method is called when you click on a link. The href attributes value is passed to whatever the callback on on_navigate is. See Intellitip for another example; https://github.com/jbrooksuk/Intellitip/blob/master/intellitip.py#L80

0 Likes

#69

Seems the show_popup HTML parser blows up if the attributes are in single quotes rather than double quotes. The first line below works fine, second line produces the output that follows it:

>>> view.show_popup('<div style="color: red">Test</div>')
>>> view.show_popup("<div style='color: red'>Test</div>")
Parse Error: 'color: red'>Test</div> code: Unexpected character
Parse Error: 'color: red'>Test</div> code: Unexpected character
Parse Error: '>Test</div> code: Unexpected character

Known issue? Let me know if this should be logged directly on the GitHub core project.

p.s. How do you keep the popup from disappears on the next key press? I’d like it remain (and preferably follow the cursor) as I complete the arg list.

0 Likes

#70

Ahhh, re my last question about keeping the popup on screen. Seems the “COOPERATE_WITH_AUTO_COMPLETE” flag mostly works here, however whenever you enter something that auto-inserts a match, (i.e. quotes or parens), the popup disappears.

For example, if you trigger the popup while in the arg list for “foo()”, then type in args such as “foo(x, 5, “test”, (3 + 2) )”, then the popup stays fine for the first 2 args, but disappear for the last 2 as soon as you type the open quote or paren.

Is this by design? I see how it could be awkward/ambiguous with the parens especially (i.e. did you just enter the scope of another parameter list that should have a different popup?). It’s annoying for the quotes case though, as strings are common arguments.

Also, I see the popup gets dismissed if I use the cursor to move left or right, even while still within the parens. Is it possible to not dismiss the popup unless the cursor exits a region? (i.e. the argument list in this case)

0 Likes

#71

[quote=“billti”]however whenever you enter something that auto-inserts a match, (i.e. quotes or parens), the popup disappears.

Also, I see the popup gets dismissed if I use the cursor to move left or right, even while still within the parens. Is it possible to not dismiss the popup unless the cursor exits a region? (i.e. the argument list in this case)
[/quote]

This is an interesting case. Since auto-matching is done by inserting a snippet it probably assumes that you “don’t need the popup anymore” or similarly. Since there may be multi-line snippets or just snippets of any sort one would either have to find a decent algorithm that fits most use cases (i.e. closes the popup only when you surely don’t need it anymore) or write plugin code to support this case by immediately reopening the panel in case the function call was not “left”. The latter would also, despite probably being a bit taxing on performance.

0 Likes

#72

Yeah, it has some interesting heuristics currently which don’t gel well with a few common use cases.

What I have done currently to work around it is define an invisible region for the area I want the popup for (in this case, the span of the argument list), and when I call show_popup I pass it an on_hide handler. In there I detect if it was hidden while I’m still inside the region, and if so just show it again immediately. (see github.com/Microsoft/TypeScript … t.py#L1083 ). It’s a little funky, but the best I could do with current API design.

I think it would be a nice addition to be able to provide a region when calling show_popup, and other than pressing escape key or the view losing focus, the popup remains while the cursor/selection is inside the region provided (even in the presence of cursor movement, snippet insertions, etc…).

0 Likes

#73

+1

if the popup includes an higher-resolution image, then as you move the cursor through the region, there
is noticeable flicker as the popup refreshes when you call show_popup every time.

[quote=“billti”] …
I think it would be a nice addition to be able to provide a region when calling show_popup, and other than pressing escape key or the view losing focus, the popup remains while the cursor/selection is inside the region provided (even in the presence of cursor movement, snippet insertions, etc…).[/quote]

i’m really liking the new popup feature… very nice.

other things on my popup wishlist :

  • support for svg, inline or as src in img tag (i am using it now to show previews of images included in markdown, but am limited to lower quality png)
  • support for mathjax/katex (i have a working version of a real-time preview of equations as you write them in latex/markdown, kind of works… but its slow and bad quality as the i need to convert equation to png)
0 Likes

#74

 
Is there a particular sub-set of font-family that works with show_popup?

I have been testing fonts from CSS Web Safe Fonts, and only some of them work.

0 Likes