swift.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. - class declarations
  3. - method declarations (including initializers and deinitializers)
  4. - property declarations
  5. - function declarations
  6. */
  7. export default `
  8. (class_declaration
  9. name: (type_identifier) @name) @definition.class
  10. (protocol_declaration
  11. name: (type_identifier) @name) @definition.interface
  12. (class_declaration
  13. (class_body
  14. [
  15. (function_declaration
  16. name: (simple_identifier) @name
  17. )
  18. (subscript_declaration
  19. (parameter (simple_identifier) @name)
  20. )
  21. (init_declaration "init" @name)
  22. (deinit_declaration "deinit" @name)
  23. ]
  24. )
  25. ) @definition.method
  26. (class_declaration
  27. (class_body
  28. [
  29. (property_declaration
  30. (pattern (simple_identifier) @name)
  31. )
  32. ]
  33. )
  34. ) @definition.property
  35. (property_declaration
  36. (pattern (simple_identifier) @name)
  37. ) @definition.property
  38. (function_declaration
  39. name: (simple_identifier) @name) @definition.function
  40. `