Commit Graph

5 Commits

Author SHA1 Message Date
Alex Hoppen
0b613cf959 [SourceKit] Test adjustments for improved formatting in BasicFormat
Companion of https://github.com/apple/swift-syntax/pull/2511
2024-02-25 19:36:50 -08:00
Rintaro Ishizaki
ac1443ada6 [Macros] Adjust insertion position of peer macros for var decls
When the target decl is a VarDecl, peer macro should expand at the end
of the pattern binding decl, instead of the end of the VarDecl which
only covers the name.

rdar://117098598
2023-10-23 18:56:39 -07:00
Alex Hoppen
cf81bab67d [Macros] Adjust test case because accessors are only separated by a single line 2023-07-31 21:53:24 -07:00
Holly Borla
67b30a406a [NFC] Fix formatting of expanded extensions in SourceKit tests. 2023-06-30 22:54:22 -07:00
Rintaro Ishizaki
c3d1304345 [SourceKit] Add request to expand macros syntactically
Expand macros in the specified source file syntactically (without any
module imports, nor typechecking).

Request would look like:
```
{
  key.compilerargs: [...]
  key.sourcefile: <file name>
  key.sourcetext: <source text> (optional)
  key.expansions: [<expansion specifier>...]
}
```
`key.compilerargs` are used for getting plugins search paths. If
`key.sourcetext` is not specified, it's loaded from the file system.
Each `<expansion sepecifier>` is
```
{
  key.offset: <offset>
  key.modulename: <plugin module name>
  key.typename: <macro typename>
  key.macro_roles: [<macro role UID>...]
}
```
Clients have to provide the module and type names because that's
semantic.

Response is a `CategorizedEdits` just like (semantic) "ExpandMacro"
refactoring. But without `key.buffer_name`. Nested expnasions are not
supported at this point.
2023-06-07 14:26:40 -07:00