Commit Graph

2621 Commits

Author SHA1 Message Date
Wesley Wigham
fd553df3a6 Path completions for import types (#23082)
* Path completions

* Add missing flag to test

* Minify test, fix lint
2018-04-02 16:15:50 -07:00
Andy
8e14ac7d51 Improve string literal completions from a signature (#23062) 2018-04-02 13:01:31 -07:00
Nathan Shively-Sanders
d3e0929b14 Mark js-assignment functions' symbols as methods (#23078)
This make display more accurate:
1. The functions now print as methods
2. When the type of the function references the class, the type of the
function itself is now printed correctly instead of as `any`.
2018-04-02 12:17:35 -07:00
Andy
d5142a7f45 Don't offer import completions in non-module files unless "--module" is set (#22951)
* Don't offer import completions in non-module files unless "--module" is set

* Even smarter shouldOfferImportCompletions
2018-04-02 10:21:14 -07:00
Wesley Wigham
414bc49cc4 Module or import types (#22592)
* Type side of import types

* Value side of import types

* Accept library changes

* Refined implementation, more tests

* Allow resolutions to be performed late if the resolution still results in a file already in the build

* Add another test case

* Add some jsdoc usages

* Allow nodebuilder to use import types where appropriate

* Parse & check generic instantiations

* use import types in nodebuilder for typeof module symbols

* Wire up go to definition for import types

* Accept updated type/symbol baselines now that symbols are wired in

* PR feedback

* Fix changes from merge

* Walk back late import handling

* Remove unused diagnostic

* Remove unrelated changes

* Use recursive function over loop

* Emit type arguments

* undo unrelated change

* Test for and support import type nodes in bundled declaration emit
2018-04-02 10:18:23 -07:00
Andy
ea65f21677 textChanges: Don't crash when inserting type annotation on function with no parens (#23034) 2018-04-02 08:41:22 -07:00
Andy
86a8e269fa Add 'getNameFromPropertyName' helper (#23036) 2018-04-02 08:14:15 -07:00
Arthur Ozga
9dd3ef4205 Merge pull request #22849 from aozgaa/dev/aozgaa/cSharpObjLiteralFormatting
CSharp Style Object Literal Formatting
2018-03-30 15:45:46 -07:00
Mohamed Hegazy
b47c1fd5a1 Merge pull request #22593 from Kingwl/module-spelling-fix
add spelling suggestion support for module
2018-03-29 16:56:43 -07:00
Arthur Ozga
95a69cbeb4 Merge branch 'master' into dev/aozgaa/cSharpObjLiteralFormatting 2018-03-29 16:10:33 -07:00
Arthur Ozga
5fb5ff7bf3 add option for object literal indent 2018-03-29 15:40:23 -07:00
Andy
4309c0e7f8 Fix bug: ClassDeclaration not guaranteed to be first declaration of a class (#22983)
* Fix bug: ClassDeclaration not guaranteed to be first declaration of a class

* fix test
2018-03-29 14:55:22 -07:00
Sheetal Nandi
5472ca9ed8 Merge pull request #22963 from Microsoft/incrementalEditWithJsDocNode
Correct the incremental parsing when there is jsDoc node
2018-03-28 15:42:18 -07:00
Sheetal Nandi
33e9ef60c4 Correct the incremental parsing when there is jsDoc node
Fixes #22924
2018-03-28 14:32:46 -07:00
Andy
6ec13bb945 Use getAllSuperTypeNodes in more places (#22718) 2018-03-28 13:33:20 -07:00
Andy
659dc03f68 completions: isNewIdentifierLocation = false for string literal where all legal values are known (#22933) 2018-03-27 19:36:54 -07:00
Andy
4f1656035b findAllReferences: Consistently use getTextSpan (#22847)
* findAllReferences: Consistently use getTextSpan

* Remove initializer
2018-03-27 19:36:16 -07:00
Andy
b518120883 findAllReferences: Respect search file set searching for references to an exported symbol (#22657)
* findAllReferences: Respect search file set searching for references to an exported symbol

* Remove debugging code
2018-03-27 18:48:27 -07:00
Andy
3e32e15895 Add 'fixAllDescription' property to CodeFixAction (#22616)
* Add 'fixAllDescription' property to CodeFixAction

* Code review

* Add to protocol

* Make fixAllDescription be just a string
2018-03-27 18:21:21 -07:00
Andy
2cbad6ab06 Support completion details for string literal completions (#22664) 2018-03-27 17:02:04 -07:00
Andy
b9f48c1d5d refactorConvertToEs6Module: Preserve quote style of imports (#22929) 2018-03-27 17:01:31 -07:00
Andy
6ef4d7774a Always test replacementSpan, and don't provide if it would just be an identifier (#22918) 2018-03-27 15:15:50 -07:00
Andy
21cd68dd04 Test for isNewIdentifierLocation, and make true for type with index signature (#22910) 2018-03-27 13:05:41 -07:00
Arthur Ozga
6786d7473d fix test 2018-03-26 16:53:20 -07:00
Arthur Ozga
b86b923aef Merge branch 'master' into dev/aozgaa/cSharpObjLiteralFormatting 2018-03-26 16:45:19 -07:00
Arthur Ozga
d41070a966 more tests 2018-03-26 16:37:55 -07:00
Andy
ced4c00522 importFixes: Distinguish when we need to import JSX constructor or JSX namespace (#22828) 2018-03-26 14:05:03 -07:00
Wesley Wigham
6af764c560 Declaration maps and transparent goto definition using them (#22658)
* Add compiler option to enable declaration sourcemaps

* Transparent goto definition for sourcemapped declaration files

* Post-rebase touchups

* Rename API methods

* Fix lints

* Fix typo in name XD

* Log sourcemap decode errors

* Share the cache more, but also invalidate it more

* Remove todo

* Enable mapping on go to implementation as well

* Allow fourslash to test declaration maps mroe easily

* more test

* Handle sourceRoot

* Add tests documenting current behavior with other sourcemapping flags

* Ignore inline options for declaration file maps, simplify dispatch in emitter

* Change program diagnostic

* Fix nit

* Use charCodeAt

* Rename internal methods + veriables

* Avoid filter

* span -> position

* Use character codes

* Dont parse our sourcemap names until we need to start using them

* zero-index parsed positions

* Handle sourceMappingURL comments, including base64 encoded ones

* Unittest b64 decoder, make mroe robust to handle unicode properly

* Fix lint

* declarationMaps -> declarationMap

* Even more feedback

* USE Mroe lenient combined regexp

* only match base64 characters

* Fix nit
2018-03-26 12:15:34 -07:00
Andy
9557e4ad96 Handle completions in interface / type literal similar to class (#22701)
* Handle completions in interface / type literal similar to class

* Code review
2018-03-23 16:04:29 -07:00
Arthur Ozga
1ea2a52b69 test synthesized object literal formatting 2018-03-23 15:54:01 -07:00
Arthur Ozga
3fc480c0bd cSharp-style formatting for multi-line object literals 2018-03-23 15:38:03 -07:00
Andy
f2f2393f4b convertFunctionToEs6Class: Copy comments from constructor to class (#22738) 2018-03-22 08:12:02 -07:00
Nathan Shively-Sanders
de4a69cb72 In source files and blocks, bind function declarations before other statements (#22766)
* Add test case and temporarily disable inference

(Inference of class members from this-assignments inside a
prototype-assigned function.)

* Update baselines

* In blocks and source files, bind functions first

* Add tests from other bugs

* Remove temporary failsafe

* Update tests to restore intent and clean up errors

* Restore intent even better

* Restore intent even better x2

* Add missed baselines
2018-03-21 14:22:09 -07:00
Andy
cc3921323c Support services settings (#22236)
* Support services settings

* Code review

* More review

* Use different names for Options and GetCompletionsAtPositionOptions (todo: come up with better names)

* More renames

* More renaming

* Support quote style in importFixes

* Add `importModuleSpecifierPreference` option

* Support quote style for `throw new Error('Method not implemented.')` (#18169)

* options -> preferences
2018-03-20 13:07:59 -07:00
Nathan Shively-Sanders
b56093f3ac Fix type when annotated with a JSDoc function type (#22692)
* Fix type when annotated with a JSDoc function type

Previously,
1. A variable annotated with a JSDoc function type would not require all
its parameters to be provided. This should only apply to functions
without a type annotation.
2. A parameter in a function with a JSDoc function type annotation would
still have the type 'any'.
3. Two `var` declarations in a Typescript and Javascript file,
respectively, would error even when they had identical function types.

* Update baselines and add constructor test

* Handle ConstructorType too

* Add test:method sig inside literal type

* Contextually type parameters by parent sig's JSDoc

Instead of a syntactic check in getJSDocTag

* Remove redundant check:isUntypedSignatureInJSFile

* Positive check for value signatures

Instead of excluding type signatures piecemeal.
2018-03-19 16:00:45 -07:00
Andy
c7215a181c findAllRefs: give entry for union its own definition (#22694) 2018-03-19 11:58:20 -07:00
Andy
adf3635a1f For import fix, for "foo/index" module, use "foo" as default export name, not "index" (#22651) 2018-03-16 14:00:33 -07:00
Matt Bierner
9774cd5eb5 Fix await code action crashes when await is not in a function (#22623)
Fixes #22614
2018-03-16 11:53:17 -07:00
Andy
b9f60566d0 For f.prototype.m = function() { this.x = 0; } make x a member of f, not of the function expression (#22643) 2018-03-16 11:35:51 -07:00
Matt Bierner
984aaa3ee9 Fix completions and brace in empty file (#22620)
Fixes #22618
2018-03-16 11:05:33 -07:00
Wesley Wigham
19ec83fcdf Refactor declaration emitter into declaration transformer (#21930)
* Refactor declaration emitter into declaration transformer

* Slight cleanup from code review feedback

* Incorporate fix for new test

* Swaths of PR feedback

* Merge public methods

* Per-file output

* Preserve input import ordering more often

* Unify jsdoc comment start detection under more lenient rule

* Move to per-file transformations to reduce the memory that msut be retained

* Fix typo
2018-03-15 22:23:10 -07:00
Andy
85e9cce3c7 Don't add external module completions in a pure commonjs file (#22583) 2018-03-15 08:13:16 -07:00
王文璐
58b147e4c4 add spelling suggestion support for module 2018-03-15 10:40:01 +08:00
Andy
e7ce3f9457 useNonAdjustedEndPosition when replacing import node (#22517)
* useNonAdjustedEndPosition when replacing import node

* Never adjust positions, and add trivia test
2018-03-14 11:46:45 -07:00
Andy
83b438ffa6 fixUnusedIdentifier: Don't remove setter parameter (#22488) 2018-03-12 16:07:20 -07:00
Andy
ac5a39c709 Fix bug: Don't skip emitting JSX attributes (#21777) 2018-03-12 14:03:25 -07:00
Sheetal Nandi
fa2b7ff6b3 Merge pull request #22421 from Microsoft/typesInTypeArguments
Allow types as well as values in possibly type argument location
2018-03-09 14:36:45 -08:00
Sheetal Nandi
ef64cde621 Merge pull request #22409 from Microsoft/symbolKind
Symbol kind needs to use location before falling back to flags
2018-03-09 13:59:38 -08:00
Mohamed Hegazy
c335c3803c Fix #22133: Expose getOutliningSpans on the server protocol (#22400)
* Fix #22133: Expose getOutliningSpans on the server protocol

* Remove debugger statement from test
2018-03-09 08:50:47 -08:00
Andy
0f47c8a205 annotateWithTypeFromJSDoc: Do less special-casing for arrow functions (#22407)
* annotateWithTypeFromJSDoc: Do less special-casing for arrow functions

* Code review
2018-03-08 16:32:32 -08:00