-
Notifications
You must be signed in to change notification settings - Fork 307
Rename getReferenceDocument
request to textDocumentContent
#1639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
5db1179
49d5134
fd417c7
066c385
a7f9382
1dc0213
6e07e52
af99d89
6ca4d95
88ca0c6
9702a28
dd7669a
99836e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors | ||
// Licensed under Apache License v2.0 with Runtime Library Exception | ||
// | ||
// See https://swift.org/LICENSE.txt for license information | ||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
/// Request from the client to the server asking for contents of a URI having a custom scheme | ||
/// For example: "sourcekit-lsp:" | ||
/// | ||
/// - Parameters: | ||
/// - uri: The `DocumentUri` of the custom scheme url for which content is required | ||
/// | ||
/// - Returns: `TextDocumentContentResponse` which contains the `content` to be displayed. | ||
public struct TextDocumentContentRequest: RequestType { | ||
public static let method: String = "workspace/textDocumentContent" | ||
public typealias Response = TextDocumentContentResponse | ||
|
||
public var uri: DocumentURI | ||
|
||
public init(uri: DocumentURI) { | ||
self.uri = uri | ||
} | ||
} | ||
|
||
/// Response containing `text` of `TextDocumentContentRequest` | ||
public struct TextDocumentContentResponse: ResponseType { | ||
public var text: String | ||
fwcd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
public init(text: String) { | ||
self.text = text | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,8 +218,8 @@ extension SwiftLanguageService { | |
} | ||
|
||
if case .dictionary(let experimentalCapabilities) = self.capabilityRegistry.clientCapabilities.experimental, | ||
case .bool(true) = experimentalCapabilities["workspace/peekDocuments"], | ||
case .bool(true) = experimentalCapabilities["workspace/getReferenceDocument"] | ||
case .bool(true) = experimentalCapabilities["workspace/peekDocuments"] | ||
// TODO: Check if client supports LSP 3.18's workspace/textDocumentContent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this check should be in place before we merge the PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you address this TODO? I don’t like having TODOs in the codebase without an associated issue because in practice they never get fixed.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think we have to revert this for now. Once the request is upstreamed, we can relax this condition to support clients that don't explicitly declare it as an experimental capability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've re-added this and added a short remark to the PR description for how this check has to be updated once we wish to support the upstream client capability. |
||
{ | ||
let expansionURIs = try macroExpansionReferenceDocumentURLs.map { | ||
return DocumentURI(try $0.url) | ||
|
Uh oh!
There was an error while loading. Please reload this page.