Sublime Forum

Dev Build 3118

#18

Currently, CSS is generated for the background and foreground color, along with a link color and class names error, deleted, success, inserted, warning and modified. The background is modified by lightening it slightly to help distinguish from the text area background. The link and various class colors are pulled from the color scheme by looking through the various colors in the scheme and then setting the color: rule to the closest match to:

  • a tags: #0000FF
  • .error, .deleted classes: #FF0000
  • .success, .inserted classes: #00FF00
  • .warning, .modified classes: #FFD900
4 Likes

Minihtml best practises to work alongside theme developers
How to achieve default style for phantom_css if popup_css is defined in color scheme?
#19

It’s called when views are created and when settings change. For example, if is_applicable returns True iff the syntax of a view is set to Python, then the listener will be created or destroyed as required when the user changes the syntax of the file.

5 Likes

#20

More question time!

Is there an event/method that is called if a view is unsubscribed from? The classmethod that does unsubscribing doesn’t have access to the particular instance and __del__ is not approproate for situations like these. If no, I’d like to request this.

In the changelog there was a mention of a cancel key. Is that supposed to be a command name or a shell command (I assume the former)?

What does View.is_primary() tell? If a view is a phantom view? So far, I only managed to get it return True on the several views I tried.

2 Likes

#21

Currently relying on __del__ is the only option.

cancel may be either a command name (a Sublime Text one, not a shell command), or a map of args that to pass to the target command.

If a buffer has multiple views (e.g., New View into File has been used), then is_primary() will only return True for one of them. Note that a view can start as non-primary, but become primary if the previous primary view is closed. By default, ViewEventListeners only get created for primary views.

4 Likes

#22

where the generated settings gets saved ??, i cant find it in the active scheme

0 Likes

#23

I would expect them not to get saved at all but rather generated on the fly.

0 Likes

#24

Amazing API additions in the new dev builds!!

It would be great to use this to preview the best completion inserted by insert_best_completion (tab key by default) particularly when the completion popup is not visible. However, I don’t think there is an API method to get the best completion (maybe I am wrong) and ST adds a small gap for LAYOUT_INLINE. Would be pretty neat.

body = """\n <style>\n body {\n  background-color: #f1f1f1;\n}\n span {\n color: #aaaaaa;\n }\n </style>\n <span>ball</span> """

view.add_phantom("test", view.sel()[0], body, sublime.LAYOUT_INLINE)
1 Like

#25

They are not saved to disk anywhere, just stored in memory. They are not generated if the color scheme defines its own popupCss.

0 Likes

#26

Small bug.

In symbol.py, this line:
symbol_begin_pt = view.text_point(l[2][0] - 1, l[2][1])
must be:
symbol_begin_pt = view.text_point(l[2][0] - 1, l[2][1] - 1)

In addition, this is a Gist with a modified symbol.py to propose active file items first and an other item than the current one by default.
Maybe this can be integrated in standard ST3 (only tested on Windows).

1 Like

#27

when i define the settings they always use the same default colors (white bg and blue links) so maybe u can save the generated colors to the scheme file ,this way it could be edited easily :wink:

0 Likes

#28

First off, thanks for the new build!


I’ve found https://github.com/lord/slate to be great for documentation, compare https://lord.github.io/slate for output of the gh-pages branch. Docs could be included and opened via default brower from Sublime Text when offline, as well as linked to from the website when hosted on github and opened from Sublime Text when online.

@alkuzad Dash and/or Zeal would require those to be installed, browsers come with the OS. Using Slate here would reduce third-party dependencies.

0 Likes

#29
  • Build errors are now shown inline at the location where they occurred. This is controlled with the show_errors_inline setting.

As much as I welcome this feature in general, I think the way it’s currently implemented looks terrible. Would be nice if error messages can by customized by themes, so they stand out visually, rather than looking like a line of text inserted in the editor – I find that very confusing.

1 Like

#30

Really excited about the new API’s. This opens many possibilities related to additional information about the code on screen. One thing I would like to see added is the ability to set an icon for a phantom region to be displayed only when there is no existing icon on the line (for inline display) or always display when displaying as a block region. I can see this being very effective for quickly identifying lines with build errors. To avoid the issue of trying to render multiple icons to the gutter I would say existing icons from normal regions that have been added to the code should take priority over phantom icons.

Thank you for the new build devs, keep up the amazing work!

1 Like

#31

I’ve been working on some enhancements to minihtml that will make it easier to tweak the various popups. I’m also planning on making some visual tweaks. Keep your eyes peeled for further improvements.

8 Likes

#32

I was trying out your example ViewCalculator plugin and I noticed that if I open a new file tab that the is_applicable() class method gets called on every character I type into that view until the file is saved. Is that expected behavior?

1 Like

#33

Thanks for the updates :sunglasses:

I played with appearance of the popup in my theme and have some questions.

How can I change the font size, face and weight of the Definition: title?

minihtml: Implemented font-family stacks

I was able to change the font face of the links only. Is this a bug?

0 Likes

#34

Thanks for the cool updates.

If anyone else wants to make the inline errors stand out more, here’s an example of what I added to the .tmTheme file I’m using

<key>phantomCss</key>
<string><![CDATA[
    html {
        color: black;
        background-color: darkorange;
    }
]]></string>

2 Likes

#35

Without the code you used, I can’t really say. Currently the CSS selectors in minihtml only support a single level of selectors, i.e. no nested selectors.

As I mentioned in another comment, I am working on implementing more features to make the various built-in popup customizable via color schemes. I will also be working in the near future on documenting the current feature set of minihtml.

4 Likes

#36

exec.py should html-escape (html.escape) the build result message. Otherwise tracebacks like these suddenly end after in:

Traceback (most recent call last):
  File "E:\Temp\default\exec.py", line 9, in <module>
    import sublime
ImportError: No module named 'sublime'


@ others: In order to make exec.py parse build results and add them as phantom views, View.find_all_results_with_text() was added. This wasn’t mentioned before.

>>> e = window.create_output_panel("exec")
Running python -u "E:\Temp\default\exec.py"
>>> e.find_all_results_with_text()
[('/E/Temp/default/exec.py', 9, 0, '  File "E:\\Temp\\default\\exec.py", line 9, in <module>')]

@jps, @wbond: When revising build results parsing, I’d like to point to two different issues I’ve had with those that I reported here: https://github.com/SublimeTextIssues/Core/issues/938
My suggestion was to provide a mapping that allows selecting a specific match of a pattern and modifying that in case the match is not in a format we can use. I don’t think this suggestion can be adjusted to support the error message being in the line(s) following filename, linenumber and column, though.

1 Like

#37

Did anyone manage to display a multi-line phantom ?
I tried to put <br /> and \n in a sublime.LAYOUT_BLOCK but without success…

0 Likes