Commit Graph

4125 Commits

Author SHA1 Message Date
Andy
8a52eade2e Make getTextOfIdentifierOrLiteral and getEscapedTextOfIdentifierOrLiteral only accept Identifier | StringLiteralLike | NumericLiteral (#22002) 2018-02-21 11:05:43 -08:00
Andy
dda4bd0d0b fixClassDoesnotImplementInheritedAbstractMember: Don't perform fix for same class twice (#22073) 2018-02-21 10:03:02 -08:00
Andy
dd47f2492b getSemanticDocumentHighlights: Use toMultiMap helper (#22059)
* getSemanticDocumentHighlights: Use `toMultiMap` helper

* Rename to arrayToMultiMap and follow pattern of arrayToMap and arrayToNumericMap
2018-02-21 10:02:34 -08:00
Andy
b00c13b716 Fix bug: Handle QualifiedName in getMeaningFromRightHandSideOfImportEquals (#21779)
* Fix bug: Handle QualifiedName in getMeaningFromRightHandSideOfImportEquals

* Fix lint
2018-02-20 14:32:51 -08:00
Andy
b3edc8f9f4 Apply 'no-unnecessary-type-assertion' lint rule (#22005)
* Apply 'no-unnecessary-type-assertion' lint rule

* Fix type error

* Fix tsconfig.json

* Add --format back
2018-02-16 18:38:00 -08:00
Andy
8e078b9fde Add comment to isGlobalCompletion (#21973) 2018-02-16 16:48:42 -08:00
Andy
69abe49930 Supports more locations for completions contextual types (#21946) 2018-02-16 16:48:03 -08:00
Sergii Bezliudnyi
b6f82adfed add template to jsdoc completion (#21978) 2018-02-16 16:27:57 -08:00
Andrew Casey
8341b1369d Merge pull request #22004 from amcasey/FARBadImport
Make FAR handle non-existent imported symbols
2018-02-16 16:17:04 -08:00
Andrew Casey
b64eefdb20 Remove redundant null check 2018-02-16 15:50:12 -08:00
Andrew Casey
9c2b95dae3 Make FAR handle non-existent imported symbols 2018-02-16 14:49:23 -08:00
Andrew Casey
7a31394788 Group imports before sorting and coalescing 2018-02-16 13:15:07 -08:00
Andrew Casey
5c278cee17 Address PR feedback
Eliminate cancellation token

Add organizeImports.ts to tsconfig.json

Simplify ts.OrganizeImports.organizeImports

Simplify sortImports

Semantic change: all invalid module specifiers are now considered to be
equal.

Simplify comparisons using ||

Pull out imports with invalid modules specifiers

...for separate processing.  They are tacked on to the end of the
organized imports in their original order.

Bonus: downstream functions can now assume imports have valid module
specifiers.

Rename baseline folder with leading lowercase

Simplify coalesceImports

Remove some unnecessary null checks

Simplify baseline generation
2018-02-16 10:56:16 -08:00
Andrew Casey
f4141ac6bf Separate OrganizeImports into its own namespace and file 2018-02-16 10:52:29 -08:00
Andrew Casey
979b14689e Fix lint errors 2018-02-16 10:52:21 -08:00
Andrew Casey
5656f35b6a Introduce an organizeImports command
In phase 1, it coalesces imports from the same module and sorts the
results, but does not remove unused imports.

Some trivia is lost during coalescing, but none should be duplicated.
2018-02-16 10:51:38 -08:00
Andy
cfc234f959 Simplify getBraceMatchingAtPosition (#21979) 2018-02-15 16:29:42 -08:00
Andy
f8f4bb8fdd textChanges: Clean up handling of newLineCharacter (#21970) 2018-02-15 13:02:56 -08:00
Andy
347bff14a9 textChanges: Simplify getChanges (#21971)
* textChanges: Simplify getChanges

* Return ReadonlyArray
2018-02-15 13:02:45 -08:00
Andy
81df5313d7 Simplify getOccurrencesAtPosition (#21977) 2018-02-15 13:02:32 -08:00
Andy
1b6aa1386f Handle non-preserved const enums in debug messages (#21945) 2018-02-15 09:21:33 -08:00
Andy
8518343dc8 Add isStringLiteralLike helper (#21953) 2018-02-14 13:25:04 -08:00
Andy
8c2756fdf6 Support getting string literal completions based on a type argument constraint (#21168)
* Support getting string literal completions based on a type argument constraint

* Fix bug: look for require call before argument info

* Code review

* @sandersn code review

* Remove test cast

* Reduce completions.ts diff

* @weswigham review

* Remove getTypeArgumentConstraint's dependence on checkTypeArgumentConstraints

* Remove TODO
2018-02-13 15:18:26 -08:00
Andy
74f01abfcf Clean up findPrecedingToken and avoid returning whitespace-only jsx text token (#21903) 2018-02-12 14:42:16 -08:00
Andy
458c12fa78 importFixes: Fix bug by using replaceNode and removing changeIdentifierToPropertyAccess (#21898) 2018-02-12 13:05:40 -08:00
Sheetal Nandi
d6d9953f6d Fix completion of jsx attributes in self closing element
Fixes #21844
2018-02-12 11:57:20 -08:00
Andy
fcf348610c documentHighlights: Handle some invalid modifier locations (#21893) 2018-02-12 11:34:49 -08:00
Andrew Casey
ddf206b184 Merge pull request #21845 from amcasey/GH21793
Harden Extract Symbol against symbols without declarations
2018-02-12 10:40:31 -08:00
Mohamed Hegazy
3fb481ff40 Multiple telemetry debug assert failure fixes (#21886)
* Use getAllowSyntheticDefaultImports to access `--allowSyntheticDefaultImport` value

* Fix #21788: Handel missing imporotClause case

* Fix #21789: Add a defensive check to forgottenThisPropertyAccess code fix for non-identifier locations

* Do not suggest prefix with `this` if the name we are looking for is diffrent from the errorLocation

* Fix #21796: Handel case of unknown module

* Add check to capture more info for #21800

* Fix #21807: check for symbol before looking up its flags

* Fix #21812: Gracefully fail if the token is not `this`.
2018-02-12 10:34:17 -08:00
Eric Grube
879cb69d6a add beautifier rule for space after close paren and destructure bracket (#21859) 2018-02-10 12:45:54 -08:00
Priyantha Lankapura
a732ff6b35 Add type infer formatting (#21850)
* add test for type infer formatting

* Fix type infer formatting

* update test to use condtional
2018-02-10 12:36:04 -08:00
Andrew Casey
e65a1a429c Harden Extract Symbol against symbols without declarations
Fixes #21793
2018-02-09 19:42:34 -08:00
Andrew Casey
025418fdb0 Handle class declarations without names in Extract Symbol
Fixes #21816
2018-02-09 19:09:25 -08:00
Andrew Casey
22c4862d9e Merge pull request #21835 from amcasey/GH21786
Handle variable declaration without initializer in Convert to ES6 Module
2018-02-09 18:21:50 -08:00
Andrew Casey
1baae42149 Handle variable declaration without initializer in Convert to ES6 Module
Fixes #21786
2018-02-09 18:08:47 -08:00
Andrew Casey
ab5596e785 Call replaceNode rather than replaceRange
...where convenient.  Same for deleteNode/Range.
2018-02-09 17:51:28 -08:00
Andrew Casey
8d1f316414 Eliminate ChangeMultipleNodesOptions in favor of smart separators 2018-02-09 16:06:14 -08:00
Andy
49e78f68d2 findAllRefs: Fix bug for export not at top-level of a module/namespace (#21846) 2018-02-09 15:10:34 -08:00
Andy
425a4182a3 Handle empty declaration list in Convert to ES6 Module (#21843)
* Handle empty declaration list in Convert to ES6 Module

* Fix test
2018-02-09 14:46:57 -08:00
Benjamin Lichtman
f989ef7261 Merge pull request #21004 from uniqueiniquity/updateATA
Enable typings cache entries to expire and be updated
2018-02-09 14:17:26 -08:00
Andy
171b68c9e7 Add assertions for bad symbol declaration (#21837)
* Add assertions for bad symbol declaration

* Fix lint
2018-02-09 14:08:56 -08:00
Andy
31ec5e7390 findAllReferences: Don't fail on broken re-export (#21841) 2018-02-09 13:56:04 -08:00
Andy
aa1ebda6a6 Fix bug: handle missing symbol.parent for non-accessible symbol (#21834) 2018-02-09 13:48:40 -08:00
Andrew Casey
6dd88b39d5 Merge pull request #21781 from amcasey/TextChangesReplace
Tidy up textChanges.replace*
2018-02-09 10:35:20 -08:00
Andy
1b620886a9 Assert getExportEqualsLocalSymbol returns a defined result (#21831) 2018-02-09 10:28:31 -08:00
Andrew Casey
f77cefee88 Introduce *WithNodes paralleling textChanges.Replace*
1) Take options
2) Return `this`
3) Use adjusted positions
2018-02-08 15:52:12 -08:00
Andrew Casey
80b2c58c51 Eliminate replaceWithSingle in favor of replaceRange 2018-02-08 15:43:46 -08:00
Andrew Casey
8d6e48a2ec Change the meaning of useNonAdjustedStartPosition
Old: getFullStart
New: getStart
Impact: only used in tests
Reason: symmetry with useNonAdjustedEndPosition - both now effectively
mean "exclude trivia from range"
2018-02-08 15:43:41 -08:00
Andy
e2178ecfab In getSymbolAtLocation, return undefined instead of unknownSymbol (#21774)
* In getSymbolAtLocation, return undefined instead of unknownSymbol

* Update check in completions to look for undefined instead of unknownSymbol
2018-02-08 14:35:21 -08:00
Andy
16f3b93ffd Simplify TextSpan creation (#21306)
* Simplify TextSpan creation

* Rename 'start' to 'pos' where possible
2018-02-08 13:51:10 -08:00