Sublime Forum

Entity.name.function not correct definition

#1

Standart syntax my funtion: data_type Name_function(parameters);
Examlpe:void GetCoordinate(string number);
My entity.name.function: match: '({{basic_types}}\s)([[:alpha:]])\(([[:alpha:]])\)' scope: entity.name.function

My basic_types: basic_types: 'String|Array|Map|Bool|bool|exception|string|Int|Float|Variant|Object|Message|message|void'
Plugin Outline cant see my function on it syntax. But he sees on the other. Probably an error in the expression ?

0 Likes

#2
  1. Don’t you want [[:alpha:]]+ instead of [[:alpha:]] for the function name?
  2. Also, put the \s outside of the ().
  3. Don’t use scope here, because the different parts of the regex mean different things.
  4. If you want more than one parameter, you’re going to need to do things a little more complicated.
function:
  - match: ({{basic_types}})\s+([[:alpha:]]+)\s*(\()
    captures:
      1: support.type
      2: entity.name.function
      3: punctuation.definition.parameters.begin
    push:
      - match: ','
        scope: punctuation.separator
      - match: '\)'
        scope: punctuation.definition.parameters.end
        pop: true
1 Like

#3

UPD:
I use '(?:String|Array|Map|Bool|bool|exception|string|Int|Float|Variant|Object|Message|message|void)\s+\K[[:alpha:]_][[:alnum:]_]*(?=\s*\() and this work on https://regex101.com/r/IH3XK3/1, but in Sublime it not work.

0 Likes

#4

Probably \K in a syntax definition is a bad idea :tm:

3 Likes

#5

Without him, I get data_type name_function back, and I need only name_function. You have ideas ?

0 Likes

#6

why not use captures?

image

2 Likes

#7

than to replace him with me?

0 Likes