Commit Graph

2426 Commits

Author SHA1 Message Date
Rintaro Ishizaki
35f8686574 [CodeCompletion] Remove getTypeContextEnumElementCompletions()
Use getUnresolvedmemberCompletion() instead.

rdar://problem/45219937
2019-06-25 11:58:12 -07:00
Rintaro Ishizaki
588d87b90e [CodeCompletion] Remove completeCaseStmtDotPrefix() completion
Now that, normal dot-member completion works at case position. We don't
need to handle it specially.

rdar://problem/45219937
2019-06-25 11:18:14 -07:00
Rintaro Ishizaki
e7c8e22ce9 Merge pull request #25717 from rintaro/ide-completion-keypathlookup-rdar50073837
[CodeCompletion] Map the result type for keypath member lookup
2019-06-24 14:48:44 -07:00
swift-ci
2538ae3695 Merge pull request #25718 from akyrtzi/comment-marker-single-line-block 2019-06-24 13:13:07 -07:00
Rintaro Ishizaki
9f02fa7b06 [CodeCompletion] Map the result type for keypath member lookup
rdar://problem/50073837
2019-06-24 12:34:31 -07:00
Argyrios Kyrtzidis
dbc35b4531 [IDE/SyntaxModel] Make sure to properly annotate comment markers in single-line comment blocks
rdar://51893731
2019-06-24 12:19:12 -07:00
swift-ci
88a5c00b34 Merge pull request #25672 from akyrtzi/index-remove-module-hash 2019-06-21 18:16:29 -07:00
Argyrios Kyrtzidis
3332b37d00 [Index/SourceKit] Remove the code related to calculating a module hash from the indexing walker
This has been an unnecessary code path for a long time now and should be removed particularly because it triggers wasteful `stat` calls.

rdar://51523161
2019-06-21 17:09:12 -07:00
Rintaro Ishizaki
bb3edd5dde [CodeCompletion] contextual attribute completion only on the same line
It's common to have decls on consecutive lines. Better to show too many
attributes than too few.
2019-06-21 14:03:09 -07:00
Rintaro Ishizaki
bc037967d1 [CodeCompletion] Stop using DeclKind::Module as a isIndependent indicator 2019-06-21 11:15:25 -07:00
Rintaro Ishizaki
09ca68e485 [CodeCompletion] Don't attach attr to decl if blank line exists
```
@#^COMPLETE^#

public func something() {}
```
In this case, we can't say the user is adding attribute to the func or
starting a new declaration. So if there're one or more blank lines after the
completion, suggest context free attribute list.

rdar://problem/50441643
2019-06-20 17:06:32 -07:00
Rintaro Ishizaki
b1fae101f2 [AST] Restore previous behavior for DocCommentAsXML
Associate requirement decl with DocComment.
2019-06-20 12:05:04 -07:00
Rintaro Ishizaki
db2c11787b [AST] Inherit doc-brief comment from protocol, superclass, and requirement
rdar://problem/38422822
2019-06-20 10:04:05 -07:00
Rintaro Ishizaki
be2fabe762 [CodeCompletion] Enable custom attribute completion for func decl
rdar://problem/50352482
2019-06-18 16:09:49 -07:00
Hamish Knight
e1f8af2389 Merge remote-tracking branch 'upstream/master' into a-couple-of-tangents 2019-06-18 19:09:06 +01:00
Rintaro Ishizaki
f94a6c0d9b [CodeCompletion] Context type analysis for default argument initializer
rdar://problem/51037538
2019-06-17 15:04:30 -07:00
Hamish Knight
a3ead02902 Merge remote-tracking branch 'upstream/master' into a-couple-of-tangents 2019-06-13 14:46:55 +01:00
Rintaro Ishizaki
04ca9752cf [CodeCompletion] Enable type name completion for param decl attribute
rdar://problem/50074177
2019-06-11 17:34:45 -07:00
Doug Gregor
0494574706 Factor the computation of default arguments into ParameterListInfo.
Provide a place where we can capture more information about the parameters
from a declaration being called.
2019-06-11 17:34:44 -07:00
Xi Ge
5280254325 Sourcekit/Indentation: avoid indenting dot member access appearing after trailing closure 2019-06-11 15:12:30 -07:00
Xi Ge
2b190648c0 SourceKit/Indentation: avoid indenting the end of subscript expressions in call chain.
rdar://50591281
2019-06-11 10:54:07 -07:00
Xi Ge
c7cf96660a SourceKit/Indentation: align function names in chained trailing closures
Chained trailing closures are sibling-like thus they should be aligned.

rdar://22205716
2019-06-10 17:07:20 -07:00
Rintaro Ishizaki
fcc35c7012 [SyntaxModel] Don't mark custom attribute as attribute-builtin
rdar://problem/50074156
2019-05-31 11:10:04 -07:00
Rintaro Ishizaki
32a0b2e771 [CodeCompletion] Exclude precedence groups from type completion 2019-05-31 11:10:04 -07:00
Rintaro Ishizaki
9ba232d718 [CodeCompletion] Implement completion at custom attribute argument 2019-05-31 11:09:54 -07:00
Rintaro Ishizaki
878c9c600b [CodeCompletion] Enable type completion at beginning of attribute
for 'VarDecl' or if we don't know the kind of the decl.
Property delegate allows arbitrary type name (with `@propertyDelegate`
attr).
2019-05-31 09:44:19 -07:00
Rintaro Ishizaki
afd6d66130 [CodeCompletion] Fix attribute completion for var/let decl
There's no attribute declared for PatternBindingDecl. There are for
VarDecl. Code completion should consider DeclKind::PatternBinding as
DeclKind::Var.
2019-05-31 09:42:50 -07:00
Hamish Knight
2872210735 [CodeCompletion] Fix a call to computeDefaultMap
Resolves SR-10795.
2019-05-31 15:53:27 +01:00
Xi Ge
b520708f07 Sourcekit/Indentation: avoid indenting the end of array/dictionary literals if they appear at the argument end
rdar://40093469
2019-05-30 15:51:50 -07:00
Rintaro Ishizaki
6da1be5d16 Merge pull request #25130 from rintaro/ide-mangledtype-rdar51198887
[TypeContextInfo/ConformingMethods] Map type out of context
2019-05-30 15:07:03 -07:00
Rintaro Ishizaki
5ff4b0cfcd [TypeContextInfo/ConformingMethods] Map type out of context
To print mangling names.

rdar://problem/51198887
rdar://problem/51227338
2019-05-30 10:59:32 -07:00
Slava Pestov
c947eda18f AST: Use ProtocolDecl::getAssociatedTypeMembers() where possible 2019-05-28 22:08:31 -04:00
Xi Ge
2d22a375f7 Merge pull request #24986 from nkcsgexi/object-literal-syntax
SourceKit/SyntaxMap: properly handle object literal syntax for highlighting
2019-05-22 19:29:17 -07:00
Xi Ge
d3a192f3c5 SourceKit/SyntaxMap: properly handle object literal syntax for highlighting
We should use parser to figure out the end position of object literal expression instead
of scanning through token stream, which crashes sourcekitd when the syntax is invalid.

Fixing: rdar://48390913
2019-05-22 14:29:57 -07:00
Rintaro Ishizaki
a79fadcdce Merge pull request #24969 from rintaro/ide-completion-poundfile-rdar47169238
[CodeCompletion] '#file', '#line', et al. after '#'
2019-05-22 10:12:55 -07:00
Rintaro Ishizaki
e2a4621b14 [CodeCompletion] Suggest #selector and #keyPath after # only if applicable
Also, add type annotation, and make it `TypeRelation[Identical]`.
'ExprSpecific' is too strong.
2019-05-21 17:25:53 -07:00
Rintaro Ishizaki
3c957de1c9 [CodeCompletion] Use CompletionLookup.CurrModule instance property 2019-05-21 17:24:59 -07:00
Rintaro Ishizaki
83084e2b5f [CodeCompletion] Suggest 'file', 'line', et al. after #
rdar://problem/47169238
2019-05-21 17:24:59 -07:00
Xi Ge
e8588672da Merge pull request #24939 from nkcsgexi/doc-support-issue
Sourcekit/DocSupport: fix an assertion when generating documentation for extensions with attributes
2019-05-20 18:59:53 -07:00
Xi Ge
1ca8e83aa3 Sourcekit/DocSupport: fix an assertion when generating documentation for extensions with attributes
When sanitizing the documentation comments for synthesized extensions,
we expect some text like "<declaration>extension". This isn't the case
when use-facing attributes are present.

rdar://50913510
2019-05-20 17:43:29 -07:00
Marc Rasi
fb268e5234 handle diags that happen during repl code completion 2019-05-20 11:10:44 -07:00
Rintaro Ishizaki
1b688d5e21 [CodeCompletion] Implement call signature completion for subscript
rdar://problem/28874899
2019-05-17 14:20:28 -07:00
Rintaro Ishizaki
1e711850bb Merge pull request #24805 from rintaro/ide-completion-unresolvedarg-rdar50696432
[CodeCompletion] Call argument completion for implicit member expression
2019-05-15 18:49:14 -07:00
Rintaro Ishizaki
557505d599 [CodeCompletion] Look through ApplyExpr to get referenced decl
For example:
  let x: MyClass = .create(<#COMPLETE#>)

This expression ends up with:
  (call_expr
    (dot_syntax_self_apply_expr
      (decl_ref_expr decl='C.create(_:arg1)'
      (type_expr type=MyClass))))
So we need to look through 'DotSyntaxSelfApplyExpr' to get the decl.
2019-05-15 17:31:19 -07:00
Rintaro Ishizaki
5b5d342995 [CodeCompletion] Enable call signature completion for unresolved member
rdar://problem/50696432
2019-05-15 17:31:19 -07:00
Rintaro Ishizaki
14d2f7c0a7 [CodeCompletion] Enable context type analysis for implict member expression
At argument part of implict member expression, we need context type
analysis to complete arguments.

rdar://problem/50696432
2019-05-15 12:34:26 -07:00
Jordan Rose
c622f6b8dd Simplify swift::getInheritedForPrinting to take a PrintOptions
This lets us make some more assumptions in the next commit, but I
think it's also just a nice cleanup to /not/ allow random predicates
here.

There were three callers of this API:

- PrintAST, which was using PrintOptions::shouldPrint but /also/
  incorrectly notifying listeners that a declaration would be skipped.

- (IDE) Interface generation, which uses PrintOptions::shouldPrint to
  count how many "inherits" there will be.

- SwiftDocSupport's reportRelated, which does no filtering at all.
  Creating a PrintOptions here is a little more expensive, but still.

No intended functionality change.
2019-05-14 16:16:28 -07:00
Rintaro Ishizaki
7b7c320bd5 [CodeCompletion] Allow ErrorType in constructor
Even if the constructor has `ErrorType` we can suggest it as long as it's
`FunctionType`.

rdar://problem/49480808
2019-05-13 01:32:57 -07:00
Rintaro Ishizaki
558cc6382e Merge pull request #24455 from rintaro/ide-complete-import-swiftmodule
[CodeCompletion] Complete Swift only module name after 'import'
2019-05-08 14:02:34 -07:00
Rintaro Ishizaki
ffde2280c9 [CodeCompletion] Hide 'SwiftOnoneSupport' from module name completion 2019-05-08 10:12:29 -07:00