Commit Graph

32 Commits

Author SHA1 Message Date
Xi Ge
d6f8f142a7 [SourceKit] Teach range-info request to recognize single declaration and multi-statements. (#5672) 2016-11-07 16:54:48 -08:00
Xi Ge
ac3411234d [SourceKit] The initial implementation of range-info request.
Like cursor-info, range info (""source.request.cursorinfo"") answers some
questions clients have for a code snippet under selection, for instance, the type of a selected
expression. This commit implements this new quest kind and provides two
simple information about the selected code: (1) the kind of the
snippet, currently limited to single-statement and expression; and (2)
the type of the selected expression. Gradually, we will enrich the
response to provide more insight into the selected code snippet.
2016-11-03 16:07:04 -07:00
John McCall
c8c41b385c Implement SE-0077: precedence group declarations.
What I've implemented here deviates from the current proposal text
in the following ways:

- I had to introduce a FunctionArrowPrecedence to capture the parsing
  of -> in expression contexts.

- I found it convenient to continue to model the assignment property
  explicitly.

- The comparison and casting operators have historically been
  non-associative; I have chosen to preserve that, since I don't
  think this proposal intended to change it.

- This uses the precedence group names and higherThan/lowerThan
  as agreed in discussion.
2016-07-26 14:04:57 -07:00
Xi Ge
195c737b54 [libIDE] Add syntax kind of argument to fix a crash. rdar://27377118
Argument used to have the same syntax kind with that of parameter. This patch
starts to differentiate them.
2016-07-19 15:10:46 -07:00
Xi Ge
a7e4cfd042 [SourceKit] Report container type USRs in the response to cursor-info request.
Typically, users jump to type-specific interface from a member of that type, for
instance, a.getSomething(). To generate the interface, we need to report the USR
of the container type of "getSomething()", which is the USR for the type of a,
 when cursor info is requested for this function call.
2016-07-12 15:50:18 -07:00
Xi Ge
a5e51a3494 [SourceKit] In CursorInfo response, include the mangle name of the type of the underlying decl.
The mangled name of the type is identical to those for debugger. These
mangled names allow us to reconstruct the type from AST and generate interface
specifically for that type.

Related rdar://27306890
2016-07-12 13:10:58 -07:00
Brian Croom
fac744067c [SourceKit] Remove dependency of SwiftLang on Core 2016-06-22 13:04:37 -04:00
Mishal Shah
87b7bcfd3e Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-06-14 14:53:55 -07:00
Argyrios Kyrtzidis
c78f1699cc [SourceKit] Ignore the '__raw_doc_comment' attribute, which is more of an implementation detail. 2016-05-05 16:44:34 -07:00
Argyrios Kyrtzidis
af21c7d4b1 [SourceKit] Move UIDsFromDeclAttributes function to SwiftLangSupport header so it can be re-used, NFC. 2016-05-05 16:44:34 -07:00
Ben Langmuir
6096b8b93c [index] Make IndexSymbol's subkind into a bitset
This follows a similar change to clang indexing, and will allow us to
add overlapping sub kinds such as "UnitTest", etc.
2016-04-29 19:04:26 -07:00
Ben Langmuir
1b1320b9f1 [index] Thread through SymbolRoleSet as a generalization of "bool isRef"
As a first step toward having more detailed "role" information, thread
through a SymbolRole bitset.  For now it just contains the existing ref
vs. definition status.
2016-04-29 19:04:24 -07:00
Ben Langmuir
5523266715 [index] Remove unreachable materializeForSet case in indexer
We already had it marked unreachable in SourceKit, so lift that up into
the libIndex and remove the unnecessary enum case.
2016-04-28 16:51:03 -07:00
Ben Langmuir
db381525d0 [index] Remove unused local/param variables from index kinds
We don't index local variables or parameters, so remove the index symbol
kinds.
2016-04-28 16:51:02 -07:00
Ben Langmuir
d817555778 [index] Move associated type into common macro NFC
Now that we have first-class associated types it works the same as the
other simple cases.
2016-04-14 13:13:59 -07:00
Ben Langmuir
ad269b0e1f [index] Move core indexing code out of SourceKit
Leaving only the SourceKit-specific code (e.g. UID generation) behind in
SourceKit.

rdar://problem/22348041
2016-04-14 13:13:54 -07:00
Ben Langmuir
bfa5a1f67f [index] Factor out the dependency between the core indexing walker and SourceKit
The goal is to be able to move the core IndexSwiftASTWalker code out of
SourceKit, leaving only the serialization bits behind.

Mostly this replaces some direct uses of UIdent strings with explicit
enums, and then adds the translation code to produce those enums and to
convert them into UIdents in SourceKit.

rdar://problem/22348041
2016-04-14 13:13:49 -07:00
Xi Ge
8afcf65fa2 [SourceKit] DocInfo: Update the UIdent for synthesized extensions to respect the synthesized targets instead of the original extended types. 2016-03-31 18:12:53 -07:00
Xi Ge
16a23d79b4 [SourceKit] DocInfo: Update the printed doc comment for synthesized extensions therefore it reflects the synthesized targets explicitly. rdar://25439820 2016-03-31 17:53:21 -07:00
Ben Langmuir
a760b70827 Fixup recent formatting boo boos I've committed
I always think I'll remember to clang-format before pushing, but I don't
always follow through.
2016-03-16 15:58:11 -07:00
Ben Langmuir
3976acaf09 [SourceKit] Fix crash in getUIDForDecl() with invalid operator
We may know syntactically that we have an operator without being able to
find the associated operator decl when the input is invalid/incomplete.
Don't crash when that happens, and just fallback to a "free function"
decl kind.

rdar://problem/25196625
2016-03-16 14:21:54 -07:00
Ben Langmuir
184efb5e1c [SourceKit] Differentiate decl.var.local from decl.var.parameter
For decls it can be interesting to know when a decl is a parameter vs. a
local. This will be needed for the new fully annotated decls. For refs
it's usually not interesting.

rdar://problem/24292226
2016-02-24 11:37:00 -08:00
Xi Ge
dfd0a86986 [SourceKit] Teach SourceKit to recognized USRs for synthesized extensions.
So that IDE can jump to the synthesized extensions instead of the actual extensions.
2016-02-16 17:22:58 -08:00
Doug Gregor
38c1de69e4 Reinstate "[SR-511][Parse] Add 'associatedtype' keyword and fixit"
This reverts commit ce7b2bcf09, tweaking
a few validation tests appropriately (1 crasher fixed, two -verify
tests that needed updating).
2016-01-14 00:21:48 -08:00
Erik Eckstein
ce7b2bcf09 Revert "[SR-511][Parse] Add 'associatedtype' keyword and fixit"
This reverts commit 2b2e9dc80e.

It broke some compiler crasher tests
2016-01-13 20:42:58 -08:00
gregomni
2b2e9dc80e [SR-511][Parse] Add 'associatedtype' keyword and fixit
Adds an associatedtype keyword to the parser tokens, and accepts either
typealias or associatedtype to create an AssociatedTypeDecl, warning
that the former is deprecated. The ASTPrinter now emits associatedtype
for AssociatedTypeDecls.

Separated AssociatedType from TypeAlias as two different kinds of
CodeCompletionDeclKinds. This part probably doesn’t turn out to be
absolutely necessary currently, but it is nice cleanup from formerly
specifically glomming the two together.

And then many, many changes to tests. The actual new tests for the fixits
is at the end of Generics/associated_types.swift.
2016-01-13 17:54:31 -08:00
Doug Gregor
d1707c02c1 Revert "Remove unnecessary 'visitDecl' default cases." 2016-01-11 21:07:21 -08:00
Doug Gregor
bef06570c7 Merge pull request #244 from mohammadg/dev
Remove unnecessary 'visitDecl' default cases.
2016-01-11 20:48:58 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Mohammad Ghasembeigi
ee2ceca8d1 Remove unnecessary 'visitDecl' default cases.
The default cases are unnecessary and provide no benefits so they should
just be removed.
2015-12-06 03:08:08 +11:00
Argyrios Kyrtzidis
d19e4ae026 [SourceKit] Add license notices to all the source files. 2015-11-05 12:01:14 -08:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00