44 Commits

Author SHA1 Message Date
Andy
9c9f3e3cf9
importFixes: When one file redirects to another, consider both for global import specifiers (#25834)
* importFixes: When one file redirects to another, consider both for global import specifiers

* Add test for #26044

* Avoid a symlinked package globally importing itself (fixes another case of #26044)

* Compare to node_modules with getCanonicalFileName
2018-07-31 17:28:56 -07:00
Andy
806a661be3
Add refactor to convert named to default export and back (#24878)
* Add refactor to convert named to default export and back

* Support ambient module

* Handle declaration kinds that can't be default-exported

* Update API (#24966)
2018-06-25 10:34:24 -07:00
Andy
b3a4b72a16
Always include Jsdoc comment in getTouchingPropertyName (#23379) 2018-06-04 14:15:41 -07:00
Zzzen
2a8ff1c8d9 Merge remote-tracking branch 'ms/master' 2018-05-31 20:49:43 +08:00
Mohamed Hegazy
94c455792a Remove unneeded assertions 2018-05-29 09:06:35 -07:00
Zzzen
dbe87a6741 Document highlights on yield keywords highlight other occurrences in the same body 2018-05-25 20:48:08 +08:00
Andy
e53e56cf82
Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Zen
91a15dc609 improve performance 2018-05-09 22:42:44 +08:00
Zzzen
34323b69fb Document highlights on async/await keywords should highlight other occurrences in the same body fix #22944 2018-05-06 12:27:10 +08:00
Andy
abbb79f972
Combine getTouchingWord and getTouchingPropertyName (#22127) 2018-04-12 11:56:40 -07:00
Andy
f6b206a75a
When testing references, also test documentHighlights respects filesToSearch (#23306)
* When testing references, also test documentHighlights respects filesToSearch

* Fix handling for redirects and move assertion inside getDocumentHighlights

* Add another assert
2018-04-11 14:07:22 -07:00
Andy
7b929e090d
Remove unnecessary length check in getSyntacticDocumentHighlights (#22064) 2018-03-01 13:11:45 -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
fcf348610c
documentHighlights: Handle some invalid modifier locations (#21893) 2018-02-12 11:34:49 -08:00
Andy
ed941c27b8
Don't check modifier legality, highlight anyway (#21335) 2018-02-07 13:51:08 -08:00
Andy
c4362ac4ba
Simplify use of FindAllReferences in inferFromUsage (#20551) 2018-02-07 13:25:36 -08:00
Andy
c03ee9d85d
Use helper functions more in documentHighlights (#21336) 2018-02-05 08:57:17 -08:00
Andy
f34de1a1ca
Support find-all-references starting from a reference path or reference types comment (#21007) 2018-01-08 11:33:14 -08:00
Andy
0c0f4b81ae
Simplify documentHighlights (#20091) 2017-11-17 10:19:35 -08:00
Andy
de9c459d5e Clean up code in getModifierOccurrences (#18948) 2017-10-04 12:20:58 -07:00
Andy
6617819bf3 In getModifierOccurrences, support additional container kinds (#18947) 2017-10-04 09:52:51 -07:00
Andy
eadd084c82 Add 'name' property to Identifier (#17329)
* Add 'name' property to Identifier

* Rename to unescapedText

* Rename 'id.text' to 'id.escapedText'

* Rename 'id.unescapedText' to 'id.text'

* Make escapeIdentifier and unescapeIdentifier do nothing
2017-07-25 13:16:34 -07:00
Andy
194c2bc2ca Make NodeArray readonly (#17213)
* Make NodeArray readonly

* Fix bug: use emptyArray instead of undefined

* Fix bug: Don't expose MutableNodeArray

* Undo trailing whitespace changes
2017-07-18 10:38:21 -07:00
Wesley Wigham
4e6b2f3c93 Created a branded type for identifier-escaped strings (#16915)
* Created a branded type for escaped strings

Then flowed it throughout the compiler, finding and fixing a handful of
bugs relating to underscore-prefixed identifiers in the process.
Includes a test for two cases noticed - diagnostics from conflicting
symbols from export *'s, and enum with underscore prefixed member emit.

* Correctly double underscores WRT mapped types

* Add fourslash tests for other fixed issues

* use function call over cast

* Update forEachEntry type accuracy

* Just use escaped names for ActiveLabel

* Remove casts from getPropertyNameForPropertyNameNode

* This pattern has occurred a few times, could use a helper function.

* Remove duplicated helper

* Remove unneeded check, use helper

* Identifiers list is no longer escaped strings

* Extract repeated string-getting code into helper

* Rename type and associated functions

* Make getName() return UnderscoreEscapedString, add getUnescapedName()

* Add list of internal symbol names to escaped string type to cut back on casting

* Remove outdated comments

* Reassign interned values to nodes, just in case

* Swap to string enum

* Add deprecated aliases to escapeIdentifier and unescapeIdentifier

* Add temp var

* Remove unsafe casts

* Rename escaped string type as per @sandersn's suggestion, fix string enum usages

* Reorganize double underscore tests

* Remove jfreeman from TODO

* Remove unneeded parenthesis
2017-07-06 14:45:50 -07:00
Andrew Casey
587309d029 Update error case check
`getTouchingWord` indicates failure by returning the sourceFile node,
rather than `undefined`.
2017-06-29 10:39:30 -07:00
Andy
44d5c44cb5 Document highlights for a JSX tag should just be the matching tag, not all references (#16453) 2017-06-12 11:08:21 -07:00
Andy Hanson
d646c727e7 Merge branch 'master' into jsdoc 2017-05-19 08:18:18 -07:00
Andy Hanson
38784b761a Support for JSDoc in services 2017-05-15 14:45:30 -07:00
Andy Hanson
71fb02c099 Support find-all-references for a module specifier 2017-05-10 11:02:17 -07:00
Andy Hanson
455492d887 Merge branch 'master' into fallthrough 2017-04-18 09:48:21 -07:00
Andy Hanson
1cf765d664 Lint for fallthrough in switch 2017-03-27 15:09:00 -07:00
Andy Hanson
94f6839aec Factor out FindAllReferences.Core and use Definition/Entry to allow findReferencedSymbols and getImplementationsAtPosition to return different results 2017-03-17 11:47:31 -07:00
Vladimir Matveev
595342615b abstract code in FindReferences from concrete way of creating result reference entry to seamlessly reuse the same code for gotoImplementation (#14637) 2017-03-16 15:53:05 -07:00
Zhengbo Li
5040e1d279 Mark occurence item in string with a special property (#14677)
* mark occurence item in string with a special property

* Adding trailing commas
2017-03-16 11:01:48 -07:00
Andy Hanson
42a832ad3d Refactor findAllReferences. Now supports renamed exports and imports. 2017-02-16 06:48:00 -08:00
Andy Hanson
e8c3d548eb Fix tests 2017-01-24 12:56:21 -08:00
Andy Hanson
2d232c21a2 Support find-all-references for type keywords 2017-01-18 12:27:33 -08:00
Andy Hanson
bddcbc5f20 Move code out of closure in getDocumentHighlights, then again out of getSemanticDocumentHighlights and getSyntacticDocumentHighlights.
Also return a `Node[]` instead of a `HighlightSpan[]` where possible and do mapping from Node to HighlightSpan in one place.
2017-01-17 14:49:52 -08:00
Andy Hanson
6b1cc8972d Use native maps when they're available 2016-12-08 06:40:31 -08:00
Andy Hanson
12f6dcefa1 Revert "Merge pull request #11354 from Microsoft/map4"
This reverts commit adfdae0dc47db5ad8248d26929a7b31cb895a539, reversing
changes made to aad663cebf6a89f7029af57d8cb6a0a011854978.
2016-10-27 15:50:21 -07:00
Andy Hanson
bcc0807198 Respond to PR comments 2016-10-27 13:14:56 -07:00
Andy Hanson
aadcbcc083 Use native maps when they're available 2016-10-06 13:29:18 -07:00
Richard Knoll
ea3752aa18 Merge remote-tracking branch 'origin/master' into go_to_implementation_pr
Refactored goToImplementation out of services
2016-09-14 17:25:56 -07:00
Andy Hanson
4d6bd9df72 Break many functions out of services.ts and into their own modules. 2016-09-07 09:22:11 -07:00