mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SwiftSourceInfo files provide source location information for decls coming from loaded modules. For most IDE use cases it either has an undesirable impact on performance with no benefit (code completion), results in stale locations being used instead of more up-to-date indexer locations (cursor info), or has no observable effect (live diagnostics, which are filtered to just those with a location in the primary file). For non-IDE clients of SourceKit though, cursor info providing declaration locations for symbols from other modules is useful, so add a global configuration option (and a new request to set it) to control whether .swiftsourceinfo files are loaded or not based on use case (they are loaded by default).
30 lines
1.5 KiB
Swift
30 lines
1.5 KiB
Swift
import Foo
|
|
func bar() {
|
|
foo()
|
|
}
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: echo "/// Some doc" >> %t/Foo.swift
|
|
// RUN: echo "public func foo() { }" >> %t/Foo.swift
|
|
// RUN: %target-swift-frontend -enable-batch-mode -emit-module -emit-module-doc -emit-module-path %t/Foo.swiftmodule %t/Foo.swift -module-name Foo -emit-module-source-info-path %t/Foo.swiftsourceinfo -emit-module-doc-path %t/Foo.swiftdoc
|
|
//
|
|
// Test setting optimize for ide to false
|
|
// RUN: %sourcekitd-test -req=global-config -for-ide=0 == -req=cursor -pos=3:3 %s -- -I %t -target %target-triple %s | %FileCheck --check-prefixes=BOTH,WITH %s
|
|
//
|
|
// Test setting optimize for ide to true
|
|
// RUN: %sourcekitd-test -req=global-config -for-ide=1 == -req=cursor -pos=3:3 %s -- -I %t -target %target-triple %s | %FileCheck --check-prefixes=BOTH,WITHOUT %s
|
|
//
|
|
// Test sourcekitd-test's default global configuration request (optimize for ide is true)
|
|
// RUN: %sourcekitd-test -req=cursor -pos=3:3 %s -- -I %t -target %target-triple %s | %FileCheck --check-prefixes=BOTH,WITHOUT %s
|
|
//
|
|
// Test without sending any global configuration request to check the sevice's default settings (optimize for ide is false)
|
|
// RUN: %sourcekitd-test -suppress-config-request -req=cursor -pos=3:3 %s -- -I %t -target %target-triple %s | %FileCheck --check-prefixes=BOTH,WITH %s
|
|
|
|
// WITH: source.lang.swift.ref.function.free ({{.*}}/Foo.swift:2:13-2:16)
|
|
// WITHOUT: source.lang.swift.ref.function.free ()
|
|
// BOTH: foo()
|
|
// BOTH: s:3Foo3fooyyF
|
|
// BOTH: () -> ()
|
|
// BOTH: $syycD
|
|
// BOTH: Foo
|