Sublime Forum

[Solved][Question] Sublime Text API: How get syntax scope, not scope under cursor?

#1

Briefly

How I can get «syntax scope» in Sublime Text console? Not scope under cursor.

Detail

For example, I have HTML syntax. I want to get only text.html.basic, not text.html.basic meta.attribute-with-value.html entity.other.attribute-name.html. If I use Markdown GFM syntax, I want to get only text.html.markdown.gfm, not text.html.markdown.gfm meta.block-level.markdown markup.heading.markdown punctuation.definition.heading.markdown.

Did not help

view.scope_name(view.sel()[0].begin())

If I input this code in console, I get scope name under cursor, not syntax scope.

Thanks.

0 Likes

#2
view.scope_name(0).split()[0]
3 Likes

#3

Thank you very much!

0 Likes