Sublime Forum

Snippet which work in comment scopes

#1

Hello! Sorry my bad english.
I make own syntax highlighting for code with next structure:
fgfgbfg
With scope definitions all right. I write syntax highlighting, comments and code-blocks definite right. But. I type keyword of snippet in comment, and snippet don’t work. Can I make snippet, which will worked in comment scopes? Or it posiible only in plugin?
Maybe there is an scope of comment, where i can use snippets?

Snippet for example:
image
Example of Syntax
contexts:
main:
- match: “”
push:
- include: preprocessor
- match: "."
scope: comment.line.documentation.qsp
with_prototype:
- match: ^(\s
?)(#)\s?.+$
scope: …

0 Likes

#2

Can I make snippet, which will worked in comment scopes?

Sure.

Maybe there is an scope of comment, where i use snippets?

Isn’t the syntax definition written by you? Use whatever comment scope by your definition.


Note that you didn’t show any implementation detail (neither syntax definition, nor snippet definition) so people can only give a general answer.

0 Likes

#3

maybe you just want to change the auto_complete_selector in the syntax specific preferences or something to remove the exclusion of comment scope?

0 Likes

#5

What if you manually trigger autocompletion?

0 Likes

#6

Sorry. I use standart deffinitions scopes from documentation scope_naming.

For comment - comment.block or comment.block.documentation. If i add this definitions to scope tag in snippet, snippet don’t work.

I will add examples of snippet and .sublime-syntax in head-post.

0 Likes

#7

Can you tell me more? This is the setting in Preferences.sublime-settings? If it is, then it doesn’t work for me.

0 Likes

#8

If you remove the - comment part in the default

    "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",

then autocompletion should pop up in comment scope.

If you manually trigger autocompletion, it seems to always work anyway.

I will add examples of snippet and .sublime-syntax in head-post.

Doesn’t seem to be needed now. :slight_smile:

0 Likes

#9

Sorry. Changing Sublime Text settings doesn’t work for me. I want to share my sublime-syntax file.

0 Likes