Commit Graph
5189 Commits
Author SHA1 Message Date
Orta 2c26ac2e43 Merge pull request #32243 from orta/fix-30536
Adds support for class completions after ASI inserted class property definition
2019-07-15 11:54:13 -04:00
Orta 4bb0aaea06 Merge pull request #32359 from orta/fix_14589
Don't add extra indentation for objects inside function parameters
2019-07-15 11:33:48 -04:00
Orta Therox 1d78218053 Handle feedback from #32359 2019-07-15 10:49:08 -04:00
Andrew Branch 4f3412153a Parse quoted constructors as constructors, not methods (#31949)
* Parse quoted constructors as constructors, not methods

* Update baselines

* Fix disambiguation between quoted constructor and property named constructor

* Clean up parsing a bit

* Support escapes in constructor name

* Update baselines
2019-07-12 14:01:57 -07:00
Orta Therox 59d5585814 Don't indent properties if an object literal follows directly from another object on the same line 2019-07-12 15:24:07 -04:00
Andrew Branch 89badcc9d5 Add 'Remove unnecessary await' suggestion and fix (#32363)
* Add remove unnecessary await fix

* Add test for removing unnecessary parens after await is gone

* Fix handling of numbers in property access expressions

* Don’t offer suggestion when awaited type is any/unknown

* Fix random other test

* Fix new expression edge cases

* Only remove parens for identifiers and call expressions
2019-07-12 11:03:20 -07:00
Andrew Branch 60a1b1dc1a Proposal: If there’s a package.json, only auto-import things in it, more or less (#31893)
* Move package.json related utils to utilities

* Add failing test

* Make first test pass

* Don’t filter when there’s no package.json, fix scoped package imports

* Use type acquisition as a heuristic for whether a JS project is using node core

* Make same fix in getCompletionDetails

* Fix re-exporting

* Change JS node core module heuristic to same-file utilization

* Remove unused method

* Remove other unused method

* Remove unused triple-slash ref

* Update comment

* Refactor findAlias to forEachAlias to reduce iterations

* Really fix re-exporting

* Use getModuleSpecifier instead of custom hack

* Fix offering auto imports to paths within node modules

* Rename things and make comments better

* Add another reexport test

* Inline `symbolHasBeenSeen`

* Simplify forEachAlias to findAlias

* Add note that symbols is mutated

* Symbol order doesn’t matter here

* Style nits

* Add test with nested package.jsons

* Fix and add tests for export * re-exports
2019-07-12 10:08:55 -07:00
Andrew BranchandNathan Shively-Sanders 71bec5b698 Add quick fix to add missing 'await' (#32356)
* Start prototyping addMissingAwait codefix

* Filter by diagnostics that have missing-await related info

* Start writing tests and checking precedence

* Implement codeFixAll, add test for binary expressions

* Add test for iterables

* Add test for passing argument

* Add test for call/construct signatures

* Add test for awaiting initializer

* Improve assertion error

* Replace specific property access error with general one and add await related info

* Add test for property access

* Require code to be inside a function body to offer await

* Accept suggestion

Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Add explicit test for code fix being not available unless something is a Promise

* Skip looking for function body if already in AwaitContext flags

* Inline getCodeActions function for symmetry
2019-07-12 10:07:55 -07:00
Orta Therox dfc97db323 Don't add extra indentation for objects inside function parameters 2019-07-11 14:26:03 -04:00
Florian Regensburger 196db5bbcb Fixed lint error 2019-07-10 02:35:40 +02:00
Florian Regensburger f273448925 Added addMissingConst codefix for comma separated initializers 2019-07-10 02:11:02 +02:00
Florian Regensburger 384669a1ce Finish addMissingConst codefix for single variable and array literal assignments 2019-07-09 01:56:50 +02:00
Florian Regensburger 7d08f172d8 Added fourslash tests for standalone and array initialization cases and started implementing them 2019-07-07 13:56:34 +02:00
Orta Therox 6e9d098d41 Adds support for completions after ASI inserted expressions
Signed-off-by: Andrew Branch <andrew.branch@microsoft.com>
2019-07-03 18:02:44 -04:00
Florian Regensburger bd9f39dbcc Merge branch 'master' into add-codefix-cannot-find-name-in-for-loop 2019-07-02 00:41:27 +02:00
Andrew Branch 11a62cb0ab Merge pull request #31801 from andrewbranch/semicolons
Detect semicolons before writing from TextChanges
2019-07-01 13:23:31 -07:00
Andrew Branch a890275463 Merge pull request #31912 from andrewbranch/bug/31657
Fix smartSelection returning extra span inside string quotes when cursor is outside them
2019-07-01 11:53:24 -07:00
Titian Cernicova-Dragomir e4bca9649a Improved error spans for call errors:
1. When calling a non-callable expression the error span is on the call target not on the whole call
2. When calling a method, the error for overload resolution now includes the arguments (this was previously regressed by #31414)
2019-06-28 23:53:47 +03:00
Titian Cernicova-Dragomir 768318b30c Improved error message for calling/constructing types 2019-06-28 23:23:16 +03:00
Orta a50a5d309c Merge pull request #32088 from orta/fix-32068
Handle making sure that two less thans are never converted into >>
2019-06-26 14:10:02 -07:00
Orta Therox 897fb3a2a6 Handle making sure that two less thans are never converted into >> 2019-06-25 15:16:15 -07:00
Orta Therox 444c3059f6 Handle feeedback 2019-06-25 09:41:26 -07:00
OrtaandAndrew Branch 0a272e04ef Update src/services/formatting/README.md
Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>
2019-06-24 17:08:34 -07:00
OrtaandAndrew Branch 3f9395be39 Update src/services/formatting/README.md
Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>
2019-06-24 17:08:28 -07:00
Orta Therox ba4aad79dc Adds some docs for how a formatter works 2019-06-24 15:42:56 -07:00
Wesley Wigham 1cbace6eee Remove secondary reference lookup implementation (#32016)
* Remove secondary reference lookup implementation

* Remove TODO
2019-06-21 13:26:29 -07:00
Sheetal Nandi 7ed3896a0a Merge pull request #31587 from microsoft/definitionSpan
Include declarationSpan as relevant declaration span when defintion or other places are declaration name
2019-06-18 14:07:15 -07:00
Josh Goldberg ca00b3248b Added --noImplicitThis code fix for functions used as object properties (#31138)
* Added --noImplicitThis code fix for functions used as object properties

Before trying out all the various possibilities for where these functions could be used, I figured I'd start out with a relatively simple use case to verify this is the right approach. Is it? 😄

Starts on #28964.

* Fixed function expression names; included new baselines

* Got JSDocs to work, hooray!

* Added test for 'any' case of no function uses

* Refactored for inferFunctionReferencesFromUsage

* Fixed inference bug: undefined references cause parameters to default

* Removed dead code comments
2019-06-17 19:00:15 -07:00
Andrew Branch 54f5f2baf2 Fix smartSelection returning extra span inside string quotes when cursor is outside them 2019-06-14 15:50:09 -07:00
Sheetal Nandi 73bf2684ac Rename to use contextSpan 2019-06-13 12:41:21 -07:00
Sheetal Nandi da2aa9781e Revert to using spread instead of mutating value later 2019-06-12 15:25:16 -07:00
Benjamin Lichtman 0628adc056 Merge pull request #31865 from amcasey/FunctionHintSpan
Correct outline hint spans for functions
2019-06-12 10:13:21 -07:00
Andrew Casey 65881602b6 Correct outline hint spans for functions 2019-06-11 16:58:08 -07:00
Daniel Rosenwasser 79aff027f3 Merge pull request #31290 from a-tarasyuk/bug/29880
29880 - No completions for computed string properties
2019-06-10 13:45:58 -07:00
Sheetal Nandi a84ed93f72 Merge branch 'master' into definitionSpan 2019-06-06 14:13:09 -07:00
Sheetal Nandi a67b375d0e Handle module specifiers 2019-06-06 13:39:04 -07:00
Sheetal Nandi a120c59015 Handle Lable 2019-06-06 12:04:48 -07:00
Sheetal Nandi 768c9ed8d7 Handle jsx Opening, Closing and Self closing tags 2019-06-06 11:48:45 -07:00
Andrew Branch b37875ff7a Detect semicolons in file before writing quick fixes 2019-06-06 10:49:09 -07:00
Sheetal Nandi e4a2dd510f Handle export keyword of export assignment 2019-06-06 09:09:39 -07:00
Sheetal Nandi 1163a93ed6 Handle default keyword of default export 2019-06-05 16:35:29 -07:00
Sheetal Nandi 004488c0c9 Set declaration span only if its not same as own span 2019-06-04 15:37:43 -07:00
Sheetal Nandi eaeeb06f9a Handle when declarationSpan from declarationNode is undefined 2019-06-04 13:48:13 -07:00
Sheetal Nandi e41533acc7 Handle computed property names 2019-06-03 14:06:30 -07:00
Sheetal Nandi 0fee3b023d Handle destructuring assignments 2019-06-03 13:42:55 -07:00
Sheetal Nandi dfb613c6d6 Use for-of declaration list + expression as span for preview 2019-05-31 16:02:31 -07:00
Sheetal Nandi 9703b3d6c1 Show property assignment for special property assignments in js files 2019-05-31 14:05:15 -07:00
Sheetal Nandi 6c04a0d14e For property name of binding element use binding element as preview node 2019-05-31 11:33:36 -07:00
Sheetal Nandi 15ce996cf5 Export assignment identifier use ExportAssigment as declaration 2019-05-31 11:09:22 -07:00
Sheetal Nandi bbfbf8fa95 Use import export sepcifier as declaration for the property name of import export as well 2019-05-30 14:55:25 -07:00