Hi,
I search how underline a word with sublime text.
Someone help ?
Thanks
Hi,
I search how underline a word with sublime text.
Someone help ?
Thanks
Not true, it can be done via add_regions:
v = sublime.active_window().active_view()
v.add_regions("hello", [sublime.Region(0,v.size())], "somescope","", sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)
You can also get a solid underline (with no word breaks) by underlining a list of empty regions (one zero-width pos each, for the width of your underline) and the add_regions flag “sublime.DRAW_EMPTY_AS_OVERWRITE”.
This has been working since 2011.
[quote=“quarnster”]Not true, it can be done via add_regions:
v = sublime.active_window().active_view()
v.add_regions("hello", [sublime.Region(0,v.size())], "somescope","", sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)
[/quote]
How can I get the list of the “somescope” ? I just had some try and found a scope named “keyword”
I searched the API documentation and the google but failed.
I found the “view.scope_name(view.sel()[0].begin())” will get some king of “scope_name”, but it’s a long text like “source.python meta.function.python meta.function.parameters.python variable.parameter.function.python”, I extracted some words like “variable”, “parameter”, but no other color appeared
Underline works:
sublime.active_window().active_view().add_regions(‘keyword’, [sublime.Region(0, sublime.active_window().active_view().size())], ‘b’, ‘’, sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)