mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
`source.request.activeregions` is a new request that reports all `#if`, `#else` and `#elseif` decls in the response with an `is_active` flag. This is mainly useful for a client to know which branches are active, but for completeness sake, the active decls are also reported. Note: it only reports the positions of the decls, not the entire ranges. It's up to clients to map this to the syntactic structure of a tree. Reporting the ranges of the decls could be confusing in the case of nested `#if`s, where the ranges can overlap.
13 lines
299 B
Swift
13 lines
299 B
Swift
#if FLAG_1
|
|
class Foo {
|
|
}
|
|
#else
|
|
class Fallback {
|
|
}
|
|
|
|
// RUN: %sourcekitd-test -req=active-regions %s -- -D FLAG_1 -module-name active_regions %s | %FileCheck -check-prefix=CHECK1 %s
|
|
// CHECK1: START IF CONFIGS
|
|
// CHECK1-NEXT: 1:1 - active
|
|
// CHECK1-NEXT: 4:1 - inactive
|
|
// CHECK1-NEXT: END IF CONFIGS
|