Skip to content

Docs don't appear when hovering over types & methods in result builders #446

Open
@tarasis

Description

@tarasis

Describe the bug

When editing a SwiftUI file, sometimes the callout docs work, and other times they don't. For instance in example code A the only things that have hover docs are body, View, or PreviewContent but others like Image, Text, .padding() don't.

In code B, Text, .padding() and .foregroundColor() and .blue do have hover docs.

To Reproduce
Steps to reproduce the behavior:

  1. Open code A: Swift file with a SwiftUI struct. (see code below)
  2. Hover over body you will see partial docs in a callout
  3. Hover over Image(), or Text(), .padding(), .blur()
  4. No callout appears.

Expected behavior
A callout should appear for all things in the SDK. Open Code B in a file, and hover over Text, .padding() and so on. All work.

Environment

  • OS: macOS 13.2 beta
  • Swift version swift-driver version: 1.62.15 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
    Target: arm64-apple-macosx13.0
  • Visual Studio Code version: 1.73.1
  • vscode-swift version: 0.9.0

Additional context

Example code A

import SwiftUI

struct ContentView: View {
    #if SWIFT_PACKAGE
        var image = AsyncImage(url: Bundle.module.url(forResource: "AltIconOutside", withExtension: "png"))
    #else
        var image = Image("AltIconTest", bundle: .main)
    #endif

    var body: some View {
        Text("I've been edited in VSCode. But can be run from both Xcode and VSCode.")
            .padding()
        image
        HStack {
            // none of these will appear when built with swift build & run as it doesn't compile asset catalogue
            // only appears when compiled and run from Xcode
            Image("Buddy").border(.blue)
            // will appear in Xcode version and xcodebuild version
            Image(packageResource: "Buddy", ofType: "png", from: .assetCatalog).border(.orange)
            // will only appear in xcodebuild version
            Image("Buddy", bundle: .module).border(.green).blur(radius: 0.1)
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Example code B:

import SwiftUI

struct SwiftUIView: View {
    var body: some View {
        Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
            .padding().foregroundColor(.blue)
    }
}

struct SwiftUIView_Previews: PreviewProvider {
    static var previews: some View {
        SwiftUIView()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsourcekit-lspSourceKit-LSP issue

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions