Commit Graph

174 Commits

Author SHA1 Message Date
practicalswift
f4e1e458a0 Merge pull request #1594 from practicalswift/fix-old-style-classes
[Python] Use new style class definitions: "class A" → "class A(object)"
2016-03-09 23:16:26 +01:00
Ben Langmuir
6581eba8e6 [CodeCompletion] Improve ordering of prefix matches vs popular names
In the experimental code-completion path.

rdar://problem/24843463
2016-03-09 11:23:06 -08:00
practicalswift
c69ffe4eb6 [Python] Use new style class definitions: "class A" → "class A(object)" 2016-03-09 09:42:42 +01:00
Argyrios Kyrtzidis
345d05e2e9 Introduce an internal attribute '@_show_in_interface' to be used in stdlib for underscored protocols that
should be shown in the interface.

Also switch the option and hide all underscored protocols by default, unless they are marked with the new attribute.
2016-03-08 23:30:58 -08:00
Brian Gesiak
c9000af795 Merge pull request #1526 from practicalswift/fix-pep8-violations-ii
[Python] Fix five classes of PEP-8 violations (E101/E111/E128/E302/W191)
2016-03-08 23:55:46 -05:00
Argyrios Kyrtzidis
56cbc4f740 [SourceKit] Avoid calling "sourcekitd::shutdown()" on the service side, when the connection closes.
No need to call sourcekitd::shutdown() since the process is going down
anyway, plus if we get a new connection before the process closes then
we will fail to re-initialize properly since the initialize call is at main.
2016-03-08 13:07:46 -08:00
practicalswift
e2de5c2202 [Python] Fix blind except: statements
Make sure all Python code in the repo specifies which exceptions to
catch when using `except:`.

Regressions can be catched using `flake8-blind-except` going forward.
2016-03-08 11:08:28 +01:00
practicalswift
183da818df [Python] Fix five classes of PEP-8 violations (E101/E111/E128/E302/W191)
* E101: indentation contains mixed spaces and tabs
* E111: indentation is not a multiple of four
* E128: continuation line under-indented for visual indent
* E302: expected 2 blank lines, found 1
* W191: indentation contains tabs
2016-03-07 22:36:23 +01:00
Ben Langmuir
e752de0d20 [SourceKit] Print and annotate the raw value expression of enum elements
For now, only do this in SourceKit (printQuickHelpDeclaration), but
there are probably other printing modes that should do this.

rdar://problem/24292226
2016-03-07 12:36:47 -08:00
Ben Langmuir
3d424b5e96 [SourceKit] Annotate tuple types and nested function types
Move the type callbacks into the respective type/typerepr printers so
taht we get these callbacks even when we print the type directly, or in
a nested fashion.  Also make the returntype more explicit than just
"inside a function type", since visiting the function type currently
visits the input argument tuple (which is different than e.g. the
function *decl* printing, which walks the parameter list explicitly).

rdar://problem/24292226
2016-03-07 10:13:01 -08:00
Chris Lattner
868a795566 Introduce a new class between TypeDecl and NominalTypeDecl named GenericTypeDecl.
This factors the DeclContext and generic signature behavior out of NTD, allowing
it to be reused in the future.  NFC.
2016-03-04 23:09:15 -08:00
Ben Langmuir
1ea2d46a04 [SourceKit] Add builtin attribute tags
As promised, tag the whole attribute include all of its 'parameters'.

rdar://problem/24292226
2016-03-03 21:20:14 -08:00
Ben Langmuir
ba702b846f [SourceKit] Add tags for attribute names
As a first foray into annotating attribute, add tags around attribute
names. For now, treat any decl-modifiers as keywords. We will also want
to wrap the whole attribute (including any parameters) into tags as
well, but that will require more work in the callback hanlding.

Also factor the attribute printing to handle any special cases early,
which will simplify wrapping attributes in tags, since we can then just
put the whole switch intside the pre/post callbacks.

rdar://problem/24292226
2016-03-03 18:39:21 -08:00
Ben Langmuir
f61a241dfc [ASTPrinter] Rename parameter callback to widen scope NFC
I want to start using this for other things like function types and
attributes, so rename it to reflect the new scope. I'm not really happy
with "PrintStructureKind", etc. but haven't come up with anything
better so far.
2016-03-03 18:39:20 -08:00
Xi Ge
8bde763ba2 IDETypeChecking: make parameter consistently pass reference. NFC 2016-03-03 18:02:13 -08:00
Ben Langmuir
65f0e7eb94 [SourceKit] Add annotation tags for generic type requirements
Each requirement gets tagged. We could also tag the whole where clause
if we need to, but so far it hasn't been interesting.

rdar://problem/24292226
2016-03-03 16:11:07 -08:00
Ben Langmuir
c934315315 [SourceKit] Update terminology in generic parameter tag names
And add a test that does cursor info on the generic parameter itself,
not just on the parent decl context.

rdar://problem/24292226
2016-03-03 13:34:16 -08:00
Ben Langmuir
f848fcb7d1 [SourceKit] Update doc comment for fully annotated decl changes
It's nice to match the actual behaviour.
2016-03-03 12:53:49 -08:00
Ben Langmuir
1182e41e01 [SourceKit] Add tags for generic parameters to annotated decl
Like typerefs, we want to show the USR in the tag.

rdar://problem/24292226
2016-03-03 12:47:09 -08:00
Ben Langmuir
cebf51989d [SourceKit] Use ChunkKind::is consistently NFC 2016-03-02 18:21:38 -08:00
Ben Langmuir
8f9299cc97 [CodeCompletion] Add assignment to experimental operator completion
When the LHS is an lvalue/assignable tuple and there is no leading
sequence of binary expressions.

It's a bit hacky right now since we don't have a good way to
differentiate general pattern completions from builtin operators.

rdar://problem/23209683
2016-03-02 18:21:37 -08:00
Ben Langmuir
d88d5052aa [SourceKit] Use keyword name context to add syntaxtype.keyword tags
We can now markup most keyword uses.  Still missing access control
keywords.

rdar://problem/24292226
2016-03-02 18:20:59 -08:00
Xi Ge
bafe60e91b Refactoring: move IsInSynthesizedExtension to Analyzer. NFC. 2016-03-02 17:30:11 -08:00
Xi Ge
65a3aade7e [SourceKit] Cursor info: for extension decls, the cursor info query always returns the extended nominal's group name. 2016-03-02 17:30:11 -08:00
Xi Ge
8f1c239d01 [SourceKit] Cursor info: remove type interface since no clients are using it. rdar://24920331 2016-03-02 12:28:02 -08:00
Ben Langmuir
1168aa0342 [SourceKit] Put SourceDocInfo ASTPrinters into anonymous namespaces NFC 2016-03-02 11:01:21 -08:00
Ben Langmuir
1b22116639 [SourceKit] Refactor parameter printing to use its own callbacks NFC
The current approach of visiting the param decl won't work when we want
to visit the parameters of function *types*, or when visiting tuple
elements (which aren't themselves decls).

rdar://problem/24292226
2016-03-02 11:01:11 -08:00
Ben Langmuir
ba2710e493 [CodeCompletion] Fix the mysteriously missing operators
In the experimental operator completion, we were mysteriously missing
some operators like ||.  It turns out it was all operators
alphabetically after '.', because the filtering code was very broken.

rdar://problem/23539465
2016-03-01 18:23:00 -08:00
Ben Langmuir
8955cdc644 [SourceKit] Add decl.var.type tags in property declarations
These Type::print can just reuse the printTypeLoc logic even if they
don't have a TypeRepr.

rdar://problem/24292226
2016-03-01 16:49:33 -08:00
Ben Langmuir
b4469d88dc [SourceKit] Replace decl.name with syntaxtype.keyword as appropriate
We aren't ready to start marking up all keywords yet, but start by
replacing the cases where we currently have decl.name.

rdar://problem/24292226
2016-03-01 15:35:26 -08:00
Ben Langmuir
10c8250352 [SourceKit] Rename local/external to name/argument_label in annotation
rdar://problem/24292226
2016-03-01 15:16:40 -08:00
Dmitri Gribenko
a9f8d97d3e Replace 'unsigned int' with 'unsigned'
'unsigned' is more idiomatic in LLVM style.
2016-02-27 16:20:27 -08:00
Xi Ge
a91cc97058 [SourceKit] Indentation: aligning parameters when argument names are present. rdar://24862107
Fix is in AST by removing unnecessary override.
Originally reported by: https://twitter.com/JohnRHeaton/status/702526804138074112
2016-02-26 12:09:24 -08:00
Ben Langmuir
1a83912c4e [SourceKit] Add fully annotated declaration to DocInfo requests
Also expose the printing function as a SwiftLangSupport static method.
Ideally we could move this into libIDE, but it currently depends on the
UIdent visitor to get decl-specific tag names and it's not obvious how
we should hoist/abstract that out in a nice way.

rdar://problem/24292226
rdar://problem/24292304
2016-02-25 20:12:13 -08:00
Ben Langmuir
e9211c8e4f [SourceKit] Fix cursor-info crash with mismatched pre/post callbacks
The problem was that shouldPrint returned true, but shouldPrintInContext
returned false, so we called printDeclPost without ever printing
anything and therefore never calling the pending printDeclPre. Also
remove the avoidPrintDeclPost in the annotation printer, since it was
incorrectly assuming that avoidPrintDeclPost was paired with
printDeclPre (it's not clear to me that it isn't sometimes paired
though...).

Future work: remove or properly document the difference between the two
shouldPrint* variants; and ensure that callbacks will always be paired
even if we don't end up printing anything. Also verify that
avoidPrintDeclPost behaves correctly with respect to printDeclPre being
called (or not).
2016-02-25 19:40:26 -08:00
mawadah
9494681745 [cmake] Allow Swift libraries to individually build for specific
deployment targets.
2016-02-25 16:54:43 -08:00
Ben Langmuir
dd29bace34 [SourceKit] Tag subscript element types like function return types
FIXME.count -= 1

rdar://problem/24292226
2016-02-25 13:05:06 -08:00
Ben Langmuir
36cc043481 [SourceKit] Be consistent about using the decl.var.parameter.name.local tag
FIXME.count -= 3

rdar://problem/24292226
2016-02-25 10:27:53 -08:00
Ben Langmuir
86bc29cfc6 [SourceKit] Add type tags for parameters and return types
When the type is not just a reference to a nominal type, we still need
to be able to delineate it.

rdar://problem/24292226
2016-02-25 09:07:16 -08:00
Ben Langmuir
0216eecf92 [SourceKit] Factor out getTagForPrintNameContext NFC
rdar://problem/24292226
2016-02-24 15:35:07 -08:00
Ben Langmuir
93f05fc101 [SourceKit] Update doc comment for FullyAnnotatedDeclarationPrinter
We annotate more structure now, so put it in the example.

rdar://problem/24292226
2016-02-24 15:26:46 -08:00
Ben Langmuir
d3e98f52ef [SourceKit] Add parameter.name.local and parameter.name.external tags
... for the fully annotated declarations. More substructure more better.
This has to go through a callback mechanism similar to printDeclLoc and
printDeclPre since it should be scheduled after both of those are
printed.

rdar://problem/24292226
2016-02-24 15:26:46 -08:00
Ben Langmuir
3e9bfa137d [SourceKit] Add decl.var.parameters entries to the fully annotated decl
This is the first part of adding parameter substructure so that clients
can reason about more of the function declaration.

rdar://problem/24292226
2016-02-24 11:39:47 -08: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
bf1436a367 ASTPrinter: Move the logic for collecting all module groups from SourceKit to an IDE API, NFC. 2016-02-22 11:50:34 -08:00
practicalswift
e395ea0f0e [Python] Follow standard Python docstrings conventions (PEP-0257).
https://www.python.org/dev/peps/pep-0257/
2016-02-20 17:11:57 +01:00
Argyrios Kyrtzidis
10dfe5ab5a [SourceKit] Fix issue where the offset of diagnostic fixits is not updated after an edit request.
rdar://23919223
2016-02-19 19:18:44 -08:00
Xi Ge
1872214d40 Swif-ide-test: add a parameter to specify the group names to print. 2016-02-19 17:21:28 -08:00
Nadav Rotem
1347757c7b Merge pull request #1368 from practicalswift/self
[Python] The first argument of a Python method should be named "self"
2016-02-19 14:15:45 -08:00
practicalswift
75740f7872 [Python] The first argument of a Python method should be named "self" 2016-02-19 21:26:43 +01:00