Sublime Forum

Dev Build 3116

#21

As long as CDATA tags are not required by the color scheme parser, you can just not use them since the converter will already handle escaping the necessary characters before writing the converted XML. CDATA tags are only useful when you are directly editing XML by hand, not when you are converting to it anyway.

Just use a | YAML block scalar.

1 Like

#22

@jps Also is it possible to configure the popup to appear only on some scopes ?
Iā€™d like to limit it to function and types.

@ fitchefoll & kingkeith : Thanks, I just copy-pasted the css from the default themes, without checking that the CDATA wasnā€™t necessary.

0 Likes

#23

The symbol index does not store context information regarding the symbol it found (specifically its scope path), so you canā€™t reliably do it from within a plugin.

Depending on what exactly you do not want to see, you can prevent that from being indexed altogether through a ā€œtmPreferencesā€ metadata file. See http://docs.sublimetext.info/en/latest/reference/symbols.html.

1 Like

#24

with the hover functionality, because the new hover API receives a point, it is possible to get the scope under the mouse cursor, so a plugin can reliably choose to ignore certain scopes or only whitelist certain scopes. However, looking at the code in symbol.py, as it stands, there is no way to configure it - youā€™d have to write your own plugin and disable the built in functionality using the show_definitions setting.

0 Likes

#25

So how does someone who has a theme style the popups?

0 Likes

#26

you can only style popups in a color scheme I think, apart from that the plugins that show the popups are responsible for what colors to use

0 Likes

#27

The popups are styled via the popupCss setting of the color scheme. It is controlled via the color scheme so that they fit nicely with the text buffer, since that is the only place they are displayed.

At some point in the near future Iā€™ll be working on some docs for our subset of HTML and CSS. We do not currently embed a full-featured HTML engine.

2 Likes

#28

What happens if a popup supplies CSS too? Are the styles merged? Or are the theme CSS styles ignored?

0 Likes

#29

This allows fetching the scope of the symbol the mouse is over, but not the scope of the source of the symbol. You could accomplish checking the destination scope via opening the file/point in a hidden output buffer and checking the scope and then excluding it from the list.

Iā€™m sure weā€™ll be tweaking Show Definitions over time as we get feedback and have time to implement more features. Keep the feedback coming!

2 Likes

#30

I think @FichteFoll had this question in another thread, and I have it too: What happens if more than one plugin is using the new hover listener, and they both try to show a popup?

0 Likes

#31

There are multiple stylesheets: the default, one based on the current view text settings, the rules from the popup, <style> tags in the content sent to show_popup() and then style="" attributes on the HTML. The selector with the greatest specificity will win.

1 Like

#32

Iā€™m on OS X with build 3117 and neither ā€œsettings open in new windowā€ or ā€œshow_definition on hoverā€ seem to work.

With settings, I either select Sublime Text -> Preferences -> Settings - User or use the keyboard shortcut cmd-, and both seem to just open the user settings file in a new tab.

For ā€œshow_definition on hoverā€ nothing happens. Iā€™ve used the Python example posted above with the build in Python syntax definition, but nothing happens on hover. Iā€™ve also tried with several other syntaxes. All of them work with ā€œgoto definitionā€ using keyboard shortcuts or mouse.

Could these be package conflicts or am I misunderstanding how these features work?

0 Likes

#33

There is a single popup visible for a view at a time. The last one to run will be the one visible.

There is a method in the API to check if a popup is already shown (in addition to being able to see if the auto complete menu is shown).

1 Like

#34

It sounds like you have an override for Main.sublime-menu. There is no entry for Settings ā€“ User any longer, it is just Settings.

You could check the console to see if any errors are listed.

0 Likes

#35

That is what I expected, but I worry that, especially in the gutter, it is going to be easy for plugins to bump into each other. Maybe there could be a way to allow for paginating the popup if more than one source is trying to show a popup at the same time?

Edited to add: I realize I sound a bit negative, and I donā€™t want to, I am really excited to see this functionality, and I am already thinking about how to use it.

1 Like

#36

Great, here are some suggestions:

  1. Only display the line number for the current file. (:40)
  2. Display paths as a relative path to the project root, not just the filename (or just the filename for files not in the project). Similar to how the goto anything panel displays file paths. (And the goto definition quick panel.)
  3. Generate a default stylesheet from the color sheme if no popupCss key is defined. In its most simple form, this could be only foreground and background colors.
    mdpopups additionally provides coloring for classes named after standard scopes (and builds from markdown, which is why Iā€™ll probably still be using it).
1 Like

#37

This is already planned for the next build.

2 Likes

#38

If you are using the mdpopups dependency. If you turn on mdpopups.debug in your User/Preferences.sublime-settings, when you create a popup, it will dump CSS and HTML to the console. In that dump you will see the generated CSS for standard scopes (based on the scopes and colors already in your theme). That might be helpful for developers wanting to generate such classes for their themeā€¦maybe I should more easily expose this functionality in a plugin like scopehunterā€¦

example:

					.foreground { color: #4D4D4C; }
					.background { background-color: #FCFCFC; }
					.comment { color: #8E908C; }
					.constant.other { color: #4D4D4C; }
					.entity.name.tag { color: #C82829; }
					.entity.other.attribute-name { color: #C82829; }
					.constant.numeric { color: #F5871F; }
					.support.constant { color: #F5871F; }
					.constant.character { color: #F5871F; }
					.variable.parameter { color: #F5871F; }
					.support.type { color: #EAB700; }
					.support.class { color: #EAB700; }
					.string { color: #718C00; }
					.entity.other.inherited-class { color: #718C00; }
					.markup.heading { color: #718C00; }
					.keyword.operator { color: #3E999F; }
					.entity.name.function { color: #4271AE; }
					.support.function { color: #4271AE; }
					.keyword { color: #8959A8; }
					.storage { color: #8959A8; }
					.storage.type { color: #8959A8; }
					.invalid { color: #FAFDFF; background-color: #C82829; }
					.invalid.deprecated { color: #FAFDFF; background-color: #8959A8; }
					.variable.language { color: #EAB700; }
					.markup.underline.link { color: #3E999F; }
					.markup.bold { color: #8959A8; font-weight: bold; }
					.markup.italic { color: #8959A8; font-style: italic; }

If you install a plugin like ScopeHunter, the mdpopups dependency should get installed on your system via PackageControl.

3 Likes

#39

Can I configure this popup to show up on mouse over + key, say Ctrl?

1 Like

#40

ST does not provide an API that allows to inspect the currently pressed keys or modifiers and it also does not pass this information as a parameter to the event hook.

You can, however, use the Python ctypes module and use OS-specific system calls to retrieve information about the currently pressed modifier keys.


Another suggestions for the on_hover feature:

It would be nice if the delay for the hover event to trigger was configurable.

5 Likes