Skip to content

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

@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()
    }
}

Activity

adam-fowler

adam-fowler commented on Nov 16, 2022

@adam-fowler
Contributor

Is this SwiftUI for iOS or macOS?

tarasis

tarasis commented on Nov 17, 2022

@tarasis
Author
adam-fowler

adam-fowler commented on Nov 17, 2022

@adam-fowler
Contributor

This looks like it is not working for function called within result builders. This is most likely an issue with SourceKit-LSP. I've added the following issue swiftlang/swift#67216

changed the title [-]Sometimes docs appear when hovering over types & methods, other times not.[/-] [+]Docs don't appear when hovering over types & methods in result builders[/+] on Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @tarasis@adam-fowler

        Issue actions

          Docs don't appear when hovering over types & methods in result builders · Issue #446 · swiftlang/vscode-swift