-
Notifications
You must be signed in to change notification settings - Fork 314
Implement document symbol request #98
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
Merged
benlangmuir
merged 6 commits into
swiftlang:master
from
Trzyipolkostkicukru:cukr/document-symbol
May 30, 2019
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eb8ea96
Implement document symbol request
Trzyipolkostkicukru 550e376
Add DocumentSymbol tests and some missing symbol kinds
Trzyipolkostkicukru 9e1e493
Set syntactic_only to avoid unnecessary work, and mangle the name
Trzyipolkostkicukru f0391f6
refactor symbolKind(sourcekitSymbolKind:) to sourcekitd_uid_t extension
Trzyipolkostkicukru a519e5a
Mark Document Symbols as supported feature in README
Trzyipolkostkicukru 125cf2d
Update the linux tests
Trzyipolkostkicukru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2019 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 for symbols to display in the document outline. | ||
/// | ||
/// This is used to provide list of all symbols in the document and display inside which | ||
/// type or function the cursor is currently in. | ||
/// | ||
/// Servers that provide document highlights should set the `documentSymbolProvider` server | ||
/// capability. | ||
/// | ||
/// - Parameters: | ||
/// - textDocument: The document in which to lookup the symbol location. | ||
/// | ||
/// - Returns: An array of document symbols, if any. | ||
public struct DocumentSymbolRequest: TextDocumentRequest, Hashable { | ||
public static let method: String = "textDocument/documentSymbol" | ||
public typealias Response = [DocumentSymbol]? | ||
|
||
/// The document in which to lookup the symbol location. | ||
public var textDocument: TextDocumentIdentifier | ||
|
||
public init(textDocument: TextDocumentIdentifier) { | ||
self.textDocument = textDocument | ||
} | ||
} | ||
|
||
/// Represents programming constructs like variables, classes, interfaces etc. that appear | ||
/// in a document. Document symbols can be hierarchical and they have two ranges: one that encloses | ||
/// its definition and one that points to its most interesting range, e.g. the range of an identifier. | ||
public struct DocumentSymbol: Hashable, Codable, ResponseType { | ||
|
||
/// The name of this symbol. Will be displayed in the user interface and therefore must not be | ||
/// an empty string or a string only consisting of white spaces. | ||
var name: String | ||
|
||
/// More detail for this symbol, e.g the signature of a function. | ||
var detail: String? | ||
|
||
/// The kind of this symbol. | ||
var kind: SymbolKind | ||
|
||
/// Indicates if this symbol is deprecated. | ||
var deprecated: Bool? | ||
|
||
/// The range enclosing this symbol not including leading/trailing whitespace but everything else | ||
/// like comments. This information is typically used to determine if the clients cursor is | ||
/// inside the symbol to reveal in the symbol in the UI. | ||
var range: PositionRange | ||
|
||
/// The range that should be selected and revealed when this symbol is being picked, | ||
/// e.g the name of a function. | ||
/// | ||
/// Must be contained by the `range`. | ||
var selectionRange: PositionRange | ||
|
||
/// Children of this symbol, e.g. properties of a class. | ||
var children: [DocumentSymbol]? | ||
|
||
public init( | ||
name: String, | ||
detail: String?, | ||
kind: SymbolKind, | ||
deprecated: Bool?, | ||
range: PositionRange, | ||
selectionRange: PositionRange, | ||
children: [DocumentSymbol]?) | ||
{ | ||
self.name = name | ||
self.detail = detail | ||
self.kind = kind | ||
self.deprecated = deprecated | ||
self.range = range | ||
self.selectionRange = selectionRange | ||
self.children = children | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.